Subject Re: Ambiguous query or bug ?
Author dianeb77x
--- In ib-support@y..., "Claudio Valderrama C." <cvalde@u...> wrote:
> ""dianeb77x"" <dianeb77@h...> wrote in message
> news:9ula7n+p9mu@e...
< some snipping of headings ...>
> > > > > SELECT RQSEL.D_KEYID
> > > > > FROM RQSEL
> > > > > INNER JOIN RQSEL R1
> > > > > ON (RQSEL."D_KEYID" =3D R1."D_KEYID")
> > > > > WHERE
> > > > > (RQSEL.WO_WORD =3D 'CIVILES' AND R1.WO_WORD =3D 'ADMIN')
> > >=20
> > > It's ambiguous: one of the table instances is not qualified, so
what=20
> > should
> > > the engine use? When a table appears twice, both places should
carry=20
> > an
> > > alias. Otherwise, results are almost random.
> >
> > What's ambiguous here? One instance is "RQSEL", the other is
"R1".=20=20
> > As far as I can see, all column references are qualified with one
name=20
> > or the other.
> > What's not to like?
>
> Diane, please be clear:

[ Ah, would that I could be ...]

>if the alias takes precedence over the table name,
> how the h*ll is the engine going to assume that in one case it
should use
> the original table name and in the other case, it should use the
alias?

Umm, how complicated is it? If alias exists, then that's the name of
the table-like-thing; otherwise, the simple table name is considered
the name of the table-like-thing.
[*rrr, tabl* nam*, what*v*r.]

> This is totally confusing at least, but I don't expect more from
SQL.

Good. Low expectations are good.

> Furthermore, I've seen code that often uses the name and the alias
without
> care, so really allowing this in a join is opening a Big Can Of
Worms.

I hesitate (particularly in my unclear state) to ask, but "how is this
opening a BCOW?"

> Whatever Mr Melton has to say, this is ambiguous from common sense
> perspective. I wouldn't allow it in any case.

Good for you, th*n don't allow it.

db