Re: BUG #5234: ALTER TABLE ... RENAME COLUMN change view definition incorrectly

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Sergey Burladyan <eshkinkot(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5234: ALTER TABLE ... RENAME COLUMN change view definition incorrectly
Date: 2009-12-10 16:54:47
Message-ID: 24712.1260464087@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Thu, Dec 10, 2009 at 1:46 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> My reading of the spec is that USING (and therefore NATURAL) is defined
>> to join identically named columns. Therefore, renaming one of the input
>> columns as the OP did *should* indeed *must* break the view. The problem
>> is not how to make it work, it's how to give an error message that
>> doesn't look like an internal failure.

> That seems ugly and unnecessary. I think we might be able to define
> ourselves out of this problem. We don't guarantee (and have never
> guaranteed) that selecting from a stored view will produce the same
> results as re-executing the original query. For example, * refers the
> list of columns at definition-time, not execution-time,

Um, aren't you contradicting yourself there?

The problem with USING is that it is not merely a join condition but
affects the set of columns emitted by the join. It can't be converted
to a simple ON without changing the semantics, and I don't believe we
should try.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2009-12-10 16:57:40 Re: BUG #5234: ALTER TABLE ... RENAME COLUMN change view definition incorrectly
Previous Message Robert Haas 2009-12-10 16:00:12 Re: BUG #5234: ALTER TABLE ... RENAME COLUMN change view definition incorrectly