From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Fernando Nasser <fnasser(at)redhat(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Do FROM items of different schemas conflict? |
Date: | 2002-03-08 23:28:32 |
Message-ID: | 22655.1015630112@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Fernando Nasser <fnasser(at)redhat(dot)com> writes:
> If you had
> SELECT * FROM schema1.tab1, schema2.tab2;
> you could abbreviate:
> SELECT tab1.col1, tab2.col5 FROM schema1.tab1, schema2.tab2 WHERE...
> i.e., as long as it is not ambiguous you can omit the schema
> qualification.
What I am wondering about is how you tell whether it is ambiguous.
In particular, if schema1 is not in the search path then I do not
see how the spec can be read to say that "tab1.col1" matches "FROM
schema1.tab1" (note no AS here). It does seem that everyone agrees that
that is the meaning --- there is a footnote in Date that shows he thinks
so too --- but as far as I can tell this directly contradicts the text
of the spec, because there is noplace that says how to match an
unqualified "tab1" against the qualified "schema1.tab1", except for
5.4-10 which would clearly disallow such a match. Where am I missing
something?
>> What I would like to do is say the following:
>>
>> 1. Two FROM-items in the same scope cannot have equal <correlation
>> name>s or <qualified identifier>s.
> Only if the qualified identifiers are exposed. As soon as you give
> then an alias with AS the original name is hidden.
Right, of course. Sorry for the imprecision.
>> These rules essentially say that a FROM entry "FROM foo.bar" is exactly
>> equivalent to "FROM foo.bar AS bar",
> A small difference. With the first you can refer to columns as
> foo.bar.col1
> with the second you cannot. You must say: bar.col1
Well, the point is that I would like to allow that, specifically because
I would like to say that the equivalence is exact. I don't see any
value in enforcing this particular nitpick.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Fernando Nasser | 2002-03-08 23:48:42 | Re: Do FROM items of different schemas conflict? |
Previous Message | Joe Conway | 2002-03-08 23:26:01 | Re: Do FROM items of different schemas conflict? |