Subject Re: [ib-support] Re: Ambiguous query or bug ?
Author Claudio Valderrama C.
""dianeb77x"" <dianeb77@...> wrote in message
> --- In ib-support@y..., "Claudio Valderrama C." <cvalde@u...> wrote:
> > ""B=E9ru"" <beru@m...> wrote in message
> > news:9ufmae+6h8p@e...
> > > JJM posted the following problem on the french IB newsgroup:
> > >
> > > > FROM RQSEL
> > > > ON (RQSEL."D_KEYID" =3D R1."D_KEYID")
> > > > WHERE
> >=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: 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? This
is totally confusing at least, but I don't expect more from SQL.
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.
Whatever Mr Melton has to say, this is ambiguous from common sense
perspective. I wouldn't allow it in any case.

Claudio Valderrama C. - -
Independent developer
Owner of the Interbase® WebRing