Subject | Re: Ambiguous query or bug ? |
---|---|
Author | dianeb77x |
Post date | 2001-12-05T15:51:21Z |
--- In ib-support@y..., "Ivan Prenosil" <prenosil@m...> wrote:
By SQL92 rules, yes.
db
P.S. In case you are disappointed at not receiving a long and dreary
reply, I'll do the SQL92 incantation thing :-). [But where is my SQL92
hat? Ahh, here it is, a bit dusty, but warmer than the tiara.]:
From SQL92, subclause 6.3 <table reference>:
"<table reference> ::=
<table name> [ [ AS ] <correlation name> <etc. etc.>
Syntax Rules:
1) A <correlation name> immediately contained in a <table reference>
TR is exposed by TR. A <table name> immediately contained in a <table
reference> TR is exposed by TR if and only if TR does not specify a
<correlation name>."
<blah blah blah ... exposed name must be unique in scope ... blah blah
blah>
5) A <table name> immediately contained in a <table reference> TR has
a scope clause and scope defined by that <table reference> if and only
if the <table name> is exposed by TR.
<blah blah blah>"
[Translated: When it comes time to figure out which table-like-thing a
particular name refers to in a particular query context/scope, the
"name" of this table is the <correlation name> if it exists, otherwise
it's the <table name>. (Or perhaps: If there is a <correlation name>,
then <table name> doesn't get to play in the scope games.)]
From SQL92, subclause (or "cubslause", for the dyslexic among me) 6.4
<column reference>:
"<column reference> ::= [ <qualifier> <period> ] <column name>
<qualifier> ::= <table name> | <correlation name>
<...>
Syntax rules:
1) Let CR be the <column reference>, <... blah blah let a train leave
Chicago travelling west etc. etc.>
2) If CR contains a <qualifier> Q, then CR shall appear within the
scope of one or more <table name>s or <correlation name>s that are
equal to Q."
[In the previous clause, the only <table name>s or <correlation name>s
to be considered are those that have scope clauses ... in other words,
"exposed" things.]
Does that help?
db
> Diane,??
> Are you saying that
>
> SELECT tab.x
> FROM tab myalias
>
> is wrong, because the original table name is totally hidden by alias
By SQL92 rules, yes.
db
P.S. In case you are disappointed at not receiving a long and dreary
reply, I'll do the SQL92 incantation thing :-). [But where is my SQL92
hat? Ahh, here it is, a bit dusty, but warmer than the tiara.]:
From SQL92, subclause 6.3 <table reference>:
"<table reference> ::=
<table name> [ [ AS ] <correlation name> <etc. etc.>
Syntax Rules:
1) A <correlation name> immediately contained in a <table reference>
TR is exposed by TR. A <table name> immediately contained in a <table
reference> TR is exposed by TR if and only if TR does not specify a
<correlation name>."
<blah blah blah ... exposed name must be unique in scope ... blah blah
blah>
5) A <table name> immediately contained in a <table reference> TR has
a scope clause and scope defined by that <table reference> if and only
if the <table name> is exposed by TR.
<blah blah blah>"
[Translated: When it comes time to figure out which table-like-thing a
particular name refers to in a particular query context/scope, the
"name" of this table is the <correlation name> if it exists, otherwise
it's the <table name>. (Or perhaps: If there is a <correlation name>,
then <table name> doesn't get to play in the scope games.)]
From SQL92, subclause (or "cubslause", for the dyslexic among me) 6.4
<column reference>:
"<column reference> ::= [ <qualifier> <period> ] <column name>
<qualifier> ::= <table name> | <correlation name>
<...>
Syntax rules:
1) Let CR be the <column reference>, <... blah blah let a train leave
Chicago travelling west etc. etc.>
2) If CR contains a <qualifier> Q, then CR shall appear within the
scope of one or more <table name>s or <correlation name>s that are
equal to Q."
[In the previous clause, the only <table name>s or <correlation name>s
to be considered are those that have scope clauses ... in other words,
"exposed" things.]
Does that help?
db