Re: create or replace rule/view (fwd) - Mailing list pgsql-patches

From Neil Conway
Subject Re: create or replace rule/view (fwd)
Date
Msg-id 8765xudaug.fsf@mailbox.samurai.com
Whole thread Raw
In response to Re: create or replace rule/view (fwd)  (Rod Taylor <rbt@zort.ca>)
Responses Re: create or replace rule/view (fwd)
Re: create or replace rule/view (fwd)
List pgsql-patches
Rod Taylor <rbt@zort.ca> writes:
> REPLACE VIEW shouldn't change the visible structure at all.  It defeats
> the purpose.

So what changes to the view should be allowed? Adding new attributes,
but not removing any or changing the properties of an attribute?
(e.g. data type).

In which case, the logic would be:

        - construct TupleDesc based on ColumnDefs in view definition

        - spin through the pg_attribute tuples that match the relid of
          the view we're replacing

                - if we find a pg_attribute tuple that is not in the
                  TupleDesc, bail out

                - if we find a pg_attribute tuple that is in the
                  TupleDesc but has a different data-type (or other
                  properties), bail out

                - if we find a TupleDesc attr that is not in
                  pg_attribute, add it to pg_atribute

Just want to make sure I understand Rod/Tom's objection before I
implement anything.

(BTW, Gavin asked me to finish off the patch for him -- I'd like to
see this in 7.3....)

Cheers,

Neil

--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Proposed GUC Variable
Next
From: Bruce Momjian
Date:
Subject: Re: pg_dump and serial