Re: Triggers
От | Oliver Elphick |
---|---|
Тема | Re: Triggers |
Дата | |
Msg-id | 1029510525.4031.568.camel@linda обсуждение исходный текст |
Ответ на | Re: Triggers (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-general |
On Fri, 2002-08-16 at 15:14, Tom Lane wrote: > Oliver Elphick <olly@lfix.co.uk> writes: > >> 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? > > > Surely you can use a BEFORE trigger, can't you? > > I think we check constraints (including NOT NULL) before firing > triggers. No, I just tried it (in 7.2.1). The BEFORE trigger successfully replaced a null, thus satisfying the constraint. > The simple answer to this is not to use a constraint, but to rely on > insert and update triggers to substitute for a null (or throw an error) > in that column. > > regards, tom lane -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "And whatsoever ye shall ask in my name, that will I do, that the Father may be glorified in the Son." John 14:13
В списке pgsql-general по дате отправления: