Re: patch: Add columns via CREATE OR REPLACE VIEW

From: "Robert Haas" <robertmhaas(at)gmail(dot)com>
To: "Bernd Helmle" <mailings(at)oopsware(dot)de>
Cc: "PostgreSQL-development Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: patch: Add columns via CREATE OR REPLACE VIEW
Date: 2008-11-28 13:48:51
Message-ID: 603c8f070811280548n52954dffpaee5f8f8d199e82b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> I had a deeper look at this now. The patch looks clean and applies without
> any problems, regression tests passes. However, ATRewriteTables() has a
> problem when adding columns with domains and constraints. Consider this
> small test case:
>
> CREATE TABLE bar (id INTEGER);
> CREATE OR REPLACE VIEW vbar AS SELECT * FROM bar;
> CREATE DOMAIN person AS TEXT CHECK(value IN ('haas', 'helmle'));
> ALTER TABLE bar ADD COLUMN name person;
> CREATE OR REPLACE VIEW vbar AS SELECT * FROM bar;
>
> The last command confuses ATRewriteTable(), which wants to scan the relation
> leading to this error:
> ERROR: could not open relation base/16384/16476:
>
> I see that ATRewriteTable() errors out on heap_beginscan(), since needscan
> is set to TRUE. One solution would be to teach ATRewriteTable(s) to handle
> view alteration differently in this case.

Thanks for the review - I'll take a look.

...Robert

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2008-11-28 15:13:54 Re: Re: [COMMITTERS] pgsql: Add support for matching wildcard server certificates to the new
Previous Message Robert Haas 2008-11-28 13:42:39 Re: PLUGINS Functionlity in Win32 build scripts