Re: NEW variable values in trigger functions - Mailing list pgsql-general

From Tom Lane
Subject Re: NEW variable values in trigger functions
Date
Msg-id 8020.1136508517@sss.pgh.pa.us
Whole thread Raw
In response to NEW variable values in trigger functions  ("Ken Winter" <ken@sunward.org>)
Responses Re: NEW variable values in actions in rules  ("Ken Winter" <ken@sunward.org>)
List pgsql-general
"Ken Winter" <ken@sunward.org> writes:
> 1. What is the value of the NEW variable for a column that is not mentioned
> in an UPDATE statement?  Is it NULL?  If not NULL, what?

No, it's whatever value is going to be assigned to the new row (which in
this particular case would be the same as the OLD value).

> 2. Same questions re the value of a NEW variable that is not assigned a
> value in an INSERT statement.

Same answer: whatever value is due to go into the row (in this case,
whatever the default is for the column).

> 3. If an UPDATE query set a column to DEFAULT, what value does a trigger
> function see for the column's NEW variable?

Same answer.

            regards, tom lane

pgsql-general by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: create summaries and update a second table?
Next
From: Klint Gore
Date:
Subject: Re: Putting restrictions on pg_dump?