Search Postgresql Archives

Re: Shorthand syntax for triggers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 15, 2012 at 11:36 AM, Moshe Jacobson <moshe@xxxxxxxxxxxx> wrote:
>> IF TG_OP = 'DELETE' THEN RENAME OLD TO myrow;
>> ELSE RENAME NEW TO myrow; END IF;
>
> Does the RENAME syntax actually work? My understanding is that it has been
> broken for a long time.

Oh, you got a point! It does not work since 9.0. I forget it, sorry.

Another way to do it is:

DECLARE
    myrow record;
    ...
BEGIN
    myrow := CASE WHEN TG_OP = 'DELETE' THEN OLD ELSE NEW END;
    ...

-- 
Sergey Konoplev

a database and software architect
http://www.linkedin.com/in/grayhemp

Jabber: gray.ru@xxxxxxxxx Skype: gray-hemp Phone: +14158679984


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux