Re: NEW variable values in trigger functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Ken Winter" <ken(at)sunward(dot)org>
Cc: "PostgreSQL pg-general List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: NEW variable values in trigger functions
Date: 2006-01-06 00:48:37
Message-ID: 8020.1136508517@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Ken Winter" <ken(at)sunward(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Klint Gore 2006-01-06 02:17:38 Re: Putting restrictions on pg_dump?
Previous Message Jim C. Nasby 2006-01-06 00:29:04 Re: create summaries and update a second table?