Values of fields in Rules
Hi,
when i create rule(on insert) on view(select id, name from users), i
will recieve values that were inserted in form of reference words
new.id, new.name.
if i insert into users (id, name) values (null, null);
then new.id = null and new.name = null
if i insert into users (name) values (null);
then new.id = null and new.name = null
is there any way how to distinguish that id column wasnt explicitly named?
mito wrote:
Hi,
when i create rule(on insert) on view(select id, name from users), i
will recieve values that were inserted in form of reference words
new.id, new.name.if i insert into users (id, name) values (null, null);
then new.id = null and new.name = nullif i insert into users (name) values (null);
then new.id = null and new.name = nullis there any way how to distinguish that id column wasnt explicitly named?
is there any way how to determinate in rule that null comes from
explicit insert or from not naming column in insert statment
mito escribi�:
is there any way how to determinate in rule that null comes from
explicit insert or from not naming column in insert statment
Not that I know of (and yes, this sucks).
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
--On Dienstag, Mai 05, 2009 20:25:54 -0400 Alvaro Herrera
<alvherre@commandprompt.com> wrote:
Not that I know of (and yes, this sucks).
But doesn't this also apply to triggers? I can't think of a reliable way to
distinguish specified or unspecified fields in trigger functions as
well....maybe fiddling with DEFAULT expressions.
--
Thanks
Bernd