Are serial fields in NEW variable inside a before insert trigger function in postgresql initialized? -
In PostgreSQL 9.1, I have to enter another field in a table with the same value as the ID column, which is the serial
.
For now I am adding the returning
part to the INSERT
command and a consistent UPDATE
record in the same transaction Command to update
I really want to do this operation in this transaction and preferably only one SQL command (without the need to take support after the inclusion trigger).
My question is before the included trigger on the same table, it is the new
variable which is considered to contain the record, which is already starting with the value back Is the next code ('seq_table') for the id
field or not?
Can I assign this value to any other field in a similar trigger function? Is this valid?
NEW.custom_field: = NEW.id;
Comments
Post a Comment