From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | possible enhancing of UPDATE syntax? |
Date: | 2013-08-20 07:13:16 |
Message-ID: | CAFj8pRDy9ALQ+fwUYXAkqEeqNRWqQs_1fV1y6QUL-VEi-JK_zA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello
we support syntax for INSERT and DELETE statements, that allows a simple
triggers for these statements.
CREATE FUNCTION trg_insert()
RETURNS trigger AS $$
BEGIN
INSERT INTO target_tbl VALUES(NEW.*)
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
* is not allowed in DELETE, but we can use a virtual column
CREATE FUNCTION trg_delete()
RETURNS trigger AS $$
BEGIN
DELETE FROM target_tbl WHERE target_tbl = OLD;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
Same functionality is missing for UPDATE, although we support (targetlist)
= (ROW) syntax
So should be nice and consistent with previous behave
UPDATE target_tbl SET (target_tbl.*) = (NEW) WHERE target_tbl = OLD;
What do you think about it?
Regards
Pavel
From | Date | Subject | |
---|---|---|---|
Next Message | amulsul | 2013-08-20 07:15:40 | Re: undefined symbol: PQescapeLiteral |
Previous Message | Andres Freund | 2013-08-20 06:57:46 | Re: StrategyGetBuffer optimization, take 2 |