plpgsql problemer
Hejsa, har lidt problemer med følgende:--------------------------------------
BEGIN
IF TG_OP = 'INSERT' THEN
INSERT INTO tbl_users(id, user, pass, name, email, available, active, root, restricted)
VALUES (NEW.id, NEW.username, NEW.value, NEW.username, '', 1, 1, 0, 0);
INSERT INTO tbl_usersites(user, site, usertype, defaultflag)
VALUES (NEW.id, 1, 1, 1);
INSERT INTO tbl_userdomains(user, domain, defaultflag)
VALUES (NEW.id, 1, 1);
INSERT INTO dbmail_users(user_idnr, userid, passwd, client_idnr, maxmail_size, curmail_size, encryption_type)
VALUES (NEW.id, NEW.username, NEW.value, 0, 26214400, 0, '');
ELSE
IF TG_OP = 'UPDATE' THEN
UPDATE tbl_users SET pass = NEW.value AND user = NEW.username WHERE id = NEW.id;
UPDATE dbmail_users SET passwd = NEW.value AND userid = NEW.username WHERE user_idnr = NEW.id;
ELSE
UPDATE tbl_users SET active = 0 WHERE id = OLD.id;
DELETE FROM dbmail_aliases WHERE deliver_to = OLD.id;
DELETE FROM dbmail_users WHERE user_idnr = OLD.id;
END IF;
END IF;
RETURN NEW;
END;
--------------------------------------
pgsql siger:
ERROR: syntax error at or near "user" at character 27 CONTEXT: PL/pgSQL function "radcheck_autoupdate" line 4 at SQL statement.
Når jeg eksekverer funktionen... meget mærkeligt :/