Re: Shorthand syntax for triggers

Поиск
Список
Период
Сортировка
От Sergey Konoplev
Тема Re: Shorthand syntax for triggers
Дата
Msg-id CAL_0b1uZzehYCvg3GcUydz9vDUiqSrFUOxCPT13SmYe46KG46w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Shorthand syntax for triggers  (Moshe Jacobson <moshe@neadwerx.com>)
Список pgsql-general
On Mon, Oct 15, 2012 at 11:36 AM, Moshe Jacobson <moshe@neadwerx.com> 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@gmail.com Skype: gray-hemp Phone: +14158679984


В списке pgsql-general по дате отправления:

Предыдущее
От: Moshe Jacobson
Дата:
Сообщение: Re: Shorthand syntax for triggers
Следующее
От: "Daniel Serodio (lists)"
Дата:
Сообщение: Is pg_basebackup also for "regular" backups?