Re: patch: Add columns via CREATE OR REPLACE VIEW - Mailing list pgsql-hackers

From Robert Haas
Subject Re: patch: Add columns via CREATE OR REPLACE VIEW
Date
Msg-id 603c8f070808071415t13811290ided123afb8c138db@mail.gmail.com
Whole thread Raw
In response to Re: patch: Add columns via CREATE OR REPLACE VIEW  ("Robert Haas" <robertmhaas@gmail.com>)
Responses Re: patch: Add columns via CREATE OR REPLACE VIEW  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> I'm not too familiar with the syntax "a AS a(x, y)" but I think it's
> asking that the first two columns of a (whatever they are at the
> moment) be aliased to x and y.

Another possible option would be to introduce a syntax along the lines of

table AS table_alias (column AS column_alias, column AS column_alias)

and decree that a(x, y) is in essence expanded to a(a as x, b as y) at
the time you originally execute the statement, much the same way we
handle *.

This has a major implementation advantage in that it frees us from
worrying about whether columns were originally referenced by position
or by name.  It does change the answers I gave in my previous email,
but I guess that doesn't matter very much since (1) we're not
proposing to implement this now and (2) either decision is
upward-compatible with the proposed patch.

Although several people have said that they prefer the idea of using
ALTER VIEW to make changes to views, no one has really expanded on the
reasons for their preference.  Also, no one has offered any argument
at all as to why any future ALTER VIEW functionality that might be
added would conflict with the semantics of the patch I proposed.

...Robert


pgsql-hackers by date:

Previous
From: "Robert Haas"
Date:
Subject: Re: patch: Add columns via CREATE OR REPLACE VIEW
Next
From: Tom Lane
Date:
Subject: Re: patch: Add columns via CREATE OR REPLACE VIEW