Re: Trigger bug ?
От | Adrian Klaver |
---|---|
Тема | Re: Trigger bug ? |
Дата | |
Msg-id | 0514c201-42f8-2cf4-2325-015ef78f65bb@aklaver.com обсуждение исходный текст |
Ответ на | Re: Trigger bug ? (PegoraroF10 <marcos@f10.com.br>) |
Список | pgsql-general |
On 5/22/19 3:21 PM, PegoraroF10 wrote: > sorry, I wasn´t clear, when I sad returning Null I tried to say that new.PK > was Null, not the function result > Try to create exactly what I sent you and you´ll see null values on that pk. Yes because FOR EACH STATEMENT may deal with multiple rows, so it is undefined what NEW.pk is referring to. More below. > And that occurs just because that trigger was created without EACH > ROW/STATEMENT. > So, my question is, PG should return an error and not create that trigger > because ROW/STATEMENT was not specified, correct ? It was implicitly specified. Per the docs it will be FOR EACH STATEMENT by default in the absence of user input. If you just need the new PK why not?: INSERT INTO some_table ... RETURNING pk; > > > > -- > Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html > > > -- Adrian Klaver adrian.klaver@aklaver.com
В списке pgsql-general по дате отправления: