Re: rule system oddity

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Jaime Casanova <systemguards(at)yahoo(dot)com>
Cc: Bernd Helmle <bernd(dot)helmle(at)oopsware(dot)de>, pgsql hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: rule system oddity
Date: 2005-01-05 07:45:40
Message-ID: 20050105074540.GA15048@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 04, 2005 at 11:51:54PM -0600, Jaime Casanova wrote:

> create view vfoo as select oid, * from foo;
> ...
> create rule insrule as on insert to vfoo
> do instead
> insert into foo(id, name) values (new.id, new.name);
> ...
> insert into vfoo values(1, 'test1');
> ERROR: invalid input syntax for integer: "test1"
>
> it seems like it's trying to insert into the oid
> column is that the intended behaviour? or is it a bug?
> (i think is the latter).

vfoo has three fields: oid, id, and name. If you INSERT without a
column list, the values are assigned to the columns in order: oid=1,
id='test1', name=NULL. Are you suggesting that the insert should
ignore oid since its source is a system column? I'm not sure such
behavior would be desirable because of the inconsistency it would
introduce: sometimes values would be assigned to the displayed
columns in order, but other times one or more of those columns might
be implicitly skipped.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stuart Bishop 2005-01-05 08:01:30 Re: PostgreSQL 8.0.0 Release Candidate 3
Previous Message Jaime Casanova 2005-01-05 05:53:05 rule system oddity