Re: WIP: Automatic view update rules - Mailing list pgsql-hackers

From Bernd Helmle
Subject Re: WIP: Automatic view update rules
Date
Msg-id 61043.91.48.33.48.1230474598.squirrel@tooney.at.xencon.de
Whole thread Raw
In response to Re: WIP: Automatic view update rules  ("Jaime Casanova" <jcasanov@systemguards.com.ec>)
Responses Re: WIP: Automatic view update rules
Re: WIP: Automatic view update rules
List pgsql-hackers
> On Mon, Dec 22, 2008 at 8:53 AM, Bernd Helmle <mailings@oopsware.de>
> wrote:
>> --On Mittwoch, November 26, 2008 10:54:01 +0100 Bernd Helmle
>> <mailings@oopsware.de> wrote:
>>
>> Okay, i've finally managed to create an updated version with (hopefully)
>> all
>> issues mentioned by Robert adressed.
>>
>
> Hi Bernd,
>
> 1) i found a crash type bug, try this:
>
> create table foo (
>     id  integer     not null    primary key,
>     name    varchar(30)
> ) with oids;
>
> create view foo_view as select oid, * from foo;
>
> with this you will get an error like this one:
> ERROR:  RETURNING list's entry 1 has different type from column "oid"
>

Hrm, seems i've introduced a bug while implementing RETURNING support.

> but if you make this:
>
> alter table foo add column description text;
> create view foo_view as select oid, * from foo;
>
> then, the server crash.
>
> STATEMENT:  create or replace view v_foo as select oid, * from foo;
> LOG:  server process (PID 16320) was terminated by signal 11: Segmentation
> fault
> LOG:  terminating any other active server processes
>
> maybe the better solution is to not allow such a view to be updatable
>

Yes, it seems we have to check for target lists having negative attnums in
checkTree(). Another solution would be to simply ignore those columns
(extract them from the target list and include all updatable columns
only).

> 2) Another less important bug, the WITH CHECK OPTION is accepted even
> when that functionality is not implemented.
>
> updatable_views=# create or replace view v2 as select * from foo where
> id < 10 with check option;
> NOTICE:  CREATE VIEW will create implicit INSERT/UPDATE/DELETE rules
> CREATE VIEW
>

What do we want in this case? We can throw an error telling that CHECK
OPTION isn't supported yet or simply issueing a warning.

> 3) one final point: seems like you'll have to update the rules
> regression test (attached the regression.diffs)

okay

Thanks for the review so far.

Bernd




pgsql-hackers by date:

Previous
From: "Robert Haas"
Date:
Subject: Re: WIP: Automatic view update rules
Next
From: "David Rowley"
Date:
Subject: Re: Windowing Function Patch Review -> Standard Conformance