Triggers

Поиск
Список
Период
Сортировка
От Jean-Christian Imbeault
Тема Triggers
Дата
Msg-id 3D5D012D.3080202@mega-bucks.co.jp
обсуждение исходный текст
Ответы Re: Triggers  (Oliver Elphick <olly@lfix.co.uk>)
Re: Triggers  (Darren Ferguson <darren@crystalballinc.com>)
Список pgsql-general
I have a with a a column defined as not null. The value however can be
found by looking it up in another table. I would like to create a
trigger that after insert would look up the need value and put it in the
record being inserted.

Unfortunately the column is defined as not null so I fear the insert
would fail and the trigger never get called. How can I get around this?

i.e.

create table t {

id  serial  primary key,
a   integer not null,
b   integer not null  -- b can be found in another table
};

insert into t(a) values('1'); -- this would start the trigger and turn
the insert into:

insert into t(a,b) values('1', 'some value from another table');

Are thriggers the wrong way to go about this?

Jc


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

Предыдущее
От: Jean-Christian Imbeault
Дата:
Сообщение: Good PL/pgSQL ressources>
Следующее
От: Eric Crampton
Дата:
Сообщение: Re: Good PL/pgSQL ressources>