Re: missing FROM-clause notice but nothing is missing ...

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: missing FROM-clause notice but nothing is missing ...
Date: 2003-03-28 05:46:15
Message-ID: 20030327213825.R88217-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Fri, 28 Mar 2003, Jean-Christian Imbeault wrote:

> Stephan Szabo wrote:
> >
> > I think this is because by the time you get to the order by, products and
> > rel_cast_crew_movies are treated as being out of scope. The column
> > produced by the union is just named "id" I think.
>
> You're right. changing the ORDER by products.id to simply ORDER by id
> solved the problem ...
>
> I don't know much about SQL scoping but I would have hoped that a UNION
> could have kept the fully-qualified column names (i.e. products.id
> instead of simply ID).

I believe the appropriate portion of the rules is (7.10 SR12b)

1) Let C be the <column name> of the i-th column of T1. If
the <column name> of the i-th column of T2 is C, then
the <column name> of the i-th column of TR is C.

2) Otherwise, the <column name> of the i-th column of TR is
implementation-dependent and different from the <column
name> of any column, other than itself, of any table
referenced by any <table reference> contained in the
SQL-statement.

Note that AFAIK the column name reference above is just the column name
not a qualified name.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Hadley Willan 2003-03-28 06:03:22 Re: missing FROM-clause notice but nothing is missing ...
Previous Message Lincoln Yeoh 2003-03-28 05:37:36 Re: Solution to UPDATE...INSERT problem