Re: create or replace rule/view (fwd)

From: Neil Conway <neilc(at)samurai(dot)com>
To: Rod Taylor <rbt(at)zort(dot)ca>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: create or replace rule/view (fwd)
Date: 2002-08-28 19:47:35
Message-ID: 8765xudaug.fsf@mailbox.samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Rod Taylor <rbt(at)zort(dot)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(at)samurai(dot)com> || PGP Key ID: DB3C29FC

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2002-08-28 20:01:28 Re: pg_dump and serial
Previous Message Bruce Momjian 2002-08-28 19:11:09 Re: [HACKERS] Proposed GUC Variable