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. 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 ? -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html