Search Postgresql Archives

Re: Trigger bug ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux