Little Suggestion for 6.6

Started by Daniele Orlandiover 26 years ago6 messages
#1Daniele Orlandi
daniele@orlandi.com

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.com
Via Mezzera 29/A - 20030 - Seveso (MI) - Italy
-------------------------------------------------------------------------------

#2Bruce Momjian
maillist@candle.pha.pa.us
In reply to: Daniele Orlandi (#1)
Re: [HACKERS] Little Suggestion for 6.6

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, Pennsylvania 19026
#3The Hermit Hacker
scrappy@hub.org
In reply to: Daniele Orlandi (#1)
Re: [HACKERS] Little Suggestion for 6.6

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

#4Don Baccus
dhogaza@pacifier.com
In reply to: The Hermit Hacker (#3)
Re: [HACKERS] Little Suggestion for 6.6

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

#5Daniele Orlandi
daniele@orlandi.com
In reply to: The Hermit Hacker (#3)
Re: [HACKERS] Little Suggestion for 6.6

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.com
Via Mezzera 29/A - 20030 - Seveso (MI) - Italy
-------------------------------------------------------------------------------

#6The Hermit Hacker
scrappy@hub.org
In reply to: Daniele Orlandi (#5)
Re: [HACKERS] Little Suggestion for 6.6

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