Re: plpgsql/rule question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Ed L(dot)" <pgsql(at)bluepolka(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: plpgsql/rule question
Date: 2005-01-12 03:40:14
Message-ID: 6573.1105501214@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Ed L." <pgsql(at)bluepolka(dot)net> writes:
> For example, if I have the following table:

> create table foo(id serial, msg varchar)

> Is it possible to distinguish within plpgsql between these two queries?

> insert into foo (msg) values ('Hello')
> insert into foo (id, msg) values (NULL, 'Hello')

Well, yes, because the default value in the former case will not be
NULL. But in general a trigger function cannot tell whether a field
value that happens to equal the default was explicitly specified or
defaulted. All it can see is the proposed field value; not how that
value was arrived at.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-01-12 03:43:44 Re: Bug in pg_dump in 7.4.6?
Previous Message Ed L. 2005-01-12 02:13:25 plpgsql/rule question