Variable column name in plpgsql function

Поиск
Список
Период
Сортировка
От George Woodring
Тема Variable column name in plpgsql function
Дата
Msg-id 54D4D0185B2D114A84630606A603DC9219A37E@iglassmail.istructure.com
обсуждение исходный текст
Ответы Re: Variable column name in plpgsql function  (Richard Huxton <dev@archonet.com>)
Список pgsql-general
I am trying to create a trigger that needs to capture the primary key
value out of NEW variable.

However the trigger can be called from 2 different tables whose PKs are

Table1id
Table2id

Is possible to declare a variable to build the column name

Tableid varchar(20) := TG_RELNAME || ''id'';

And then use this variable to get the PK value?

Tableidvalue int4 := NEW.tableid;


Thanks,
Woody

----------------------------------------
iGLASS Networks
211-A S. Salem St
Apex NC 27502
(919) 387-3550 x813
www.iglass.net

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [PERFORM] pg_restore taking 4 hours!
Следующее
От: Jan Wieck
Дата:
Сообщение: Re: Upcoming Changes to News Server ...