From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Bernd Helmle <mailings(at)oopsware(dot)de>, PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: patch: Add columns via CREATE OR REPLACE VIEW |
Date: | 2008-12-06 23:23:10 |
Message-ID: | 200812062323.mB6NNAK25649@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Patch applied, thanks.
---------------------------------------------------------------------------
Robert Haas wrote:
> > 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.
>
> After looking at this, I think the root cause of this problem is that
> ATPrepAddColumn isn't smart enough to know that when the underlying
> relation is a view, there's no point in asking for a table rewrite.
> Please find an updated patch that addresses this problem.
>
> Thanks again for the review - let me know what you think of this version!
>
> ...Robert
[ Attachment, skipping... ]
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2008-12-06 23:57:29 | Re: [PATCH] allow has_table_privilege(..., 'usage') on sequences |
Previous Message | Bruce Momjian | 2008-12-06 23:21:13 | Re: Updates of SE-PostgreSQL 8.4devel patches (r1268) |