Thread: Little Suggestion for 6.6

Little Suggestion for 6.6

From
Daniele Orlandi
Date:
I don't know what SQL standards say about this, but in:

tacacs=> SELECT * FROM users,counters WHERE users.username=counters.username AND
username='foobar';
ERROR:  Column 'username' is ambiguous

...username is NOT ambiguous...

Bye!

-- Daniele

-------------------------------------------------------------------------------Daniele Orlandi - Utility Line Italia -
http://www.orlandi.comViaMezzera 29/A - 20030 - Seveso (MI) - Italy
 
-------------------------------------------------------------------------------


Re: [HACKERS] Little Suggestion for 6.6

From
Bruce Momjian
Date:
> 
> I don't know what SQL standards say about this, but in:
> 
> tacacs=> SELECT * FROM users,counters WHERE
> users.username=counters.username AND username='foobar'; ERROR:
> Column 'username' is ambiguous
> 
> ...username is NOT ambiguous...

I don't believe you.

-- Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: [HACKERS] Little Suggestion for 6.6

From
The Hermit Hacker
Date:
On Wed, 30 Jun 1999, Daniele Orlandi wrote:

> 
> I don't know what SQL standards say about this, but in:
> 
> tacacs=> SELECT * FROM users,counters WHERE users.username=counters.username AND
> username='foobar';
> ERROR:  Column 'username' is ambiguous
> 
> ...username is NOT ambiguous...

Of course it is...which username do you want to match on, users.username
or counters.username?

Marc G. Fournier                   ICQ#7615664               IRC Nick: Scrappy
Systems Administrator @ hub.org 
primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org 



Re: [HACKERS] Little Suggestion for 6.6

From
Daniele Orlandi
Date:

The Hermit Hacker wrote:
> 
> > tacacs=> SELECT * FROM users,counters WHERE users.username=counters.username 
> > AND username='foobar';
> > ERROR:  Column 'username' is ambiguous
> >
> > ...username is NOT ambiguous...
> 
> Of course it is...which username do you want to match on, users.username
> or counters.username?

IMHO it's the same, since they have to be equal...

Pardon me if I'm not seeing something obvious :^)

Bye.

-- Daniele

-------------------------------------------------------------------------------Daniele Orlandi - Utility Line Italia -
http://www.orlandi.comViaMezzera 29/A - 20030 - Seveso (MI) - Italy
 
-------------------------------------------------------------------------------


Re: [HACKERS] Little Suggestion for 6.6

From
Don Baccus
Date:
At 08:56 PM 6/29/99 -0300, The Hermit Hacker wrote:
>On Wed, 30 Jun 1999, Daniele Orlandi wrote:
>
>> 
>> I don't know what SQL standards say about this, but in:
>> 
>> tacacs=> SELECT * FROM users,counters WHERE
users.username=counters.username AND
>> username='foobar';
>> ERROR:  Column 'username' is ambiguous
>> 
>> ...username is NOT ambiguous...

>Of course it is...which username do you want to match on, users.username
>or counters.username?

He's saying that the expression can be resolved because 
their values are equal, so it doesn't matter which username
you match on. 

Which means he thinks that expression semantics rather than
scoping/parsing/type rules ought to determine what is
and what is not an ambiguous expression.  Which is...well...
just wrong :)





- Don Baccus, Portland OR <dhogaza@pacifier.com> Nature photos, on-line guides, and other goodies at
http://donb.photo.net


Re: [HACKERS] Little Suggestion for 6.6

From
The Hermit Hacker
Date:
On Wed, 30 Jun 1999, Daniele Orlandi wrote:

> 
> 
> The Hermit Hacker wrote:
> > 
> > > tacacs=> SELECT * FROM users,counters WHERE users.username=counters.username 
> > > AND username='foobar';
> > > ERROR:  Column 'username' is ambiguous
> > >
> > > ...username is NOT ambiguous...
> > 
> > Of course it is...which username do you want to match on, users.username
> > or counters.username?
> 
> IMHO it's the same, since they have to be equal...
> 
> Pardon me if I'm not seeing something obvious :^)

If I understand things (which could be pushing it), the join that is being
attempted (simplistically) gets broken down as something like:

a) find all usernames in users that exist in counters
b) find all usernames in ?? that equals foobar
c) find all a AND b

Very simplistic, mind you...

IN the above sample, b can't be resolved, since you don't tell it which
table to search for the username...

Marc G. Fournier                   ICQ#7615664               IRC Nick: Scrappy
Systems Administrator @ hub.org 
primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org