From: | "Robert Haas" <robertmhaas(at)gmail(dot)com> |
---|---|
To: | "Alvaro Herrera" <alvherre(at)commandprompt(dot)com> |
Cc: | "PostgreSQL-development Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: patch: Add columns via CREATE OR REPLACE VIEW |
Date: | 2008-08-07 15:42:49 |
Message-ID: | 603c8f070808070842h2843a0fdkc283c9c5f773de2b@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Aug 7, 2008 at 11:17 AM, Alvaro Herrera
<alvherre(at)commandprompt(dot)com> wrote:
> Robert Haas escribió:
>> Here's a patch that allows CREATE OR REPLACE VIEW to add new columns
>> to an existing view.
>>
>> Any feedback would be appreciated, especially if it meant that I could
>> fix any problems before the next commitfest.
>
> What happens with the columns previously defined? What happens if I
> specify a different column definition for them; does it raise an error?
Yes. CheckViewTupleDesc() errors out, same as before.
Basically, the old algorithm was:
1. Check [new # of columns] = [old # of columns]
2. For each column: check that [old definition] = [new definition]
The new algorithm is:
1. Check [new # of columns] >= [old # of columns]
2. For each column <= [old # of columns]: check that [old definition]
= [new definition]
3. For each column > [old # of columns]: add the new column to the
relation (as ALTER TABLE ADD COLUMN, except bypassing the usual
prohibition on adding columns to views)
...Robert
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2008-08-07 15:43:53 | Re: patch: Add columns via CREATE OR REPLACE VIEW |
Previous Message | Richard Huxton | 2008-08-07 15:42:44 | Re: Avoiding Application Re-test |