Through the help of some inexperienced embedded SQL coders I stubled across
a strang Postgres quirk. I am wondering if this is normal or if I have
configured something incorrectly. Here's the situation...
The following two selects return very different values:
select b.name from foo f, bar b
where f.foo_id = 1
and f.bar_id = b.bar_id;
select bar.name from foo f, bar b
where f.foo_id = 1
and f.bar_id = b.bar_id;
The first returns the rows in the name column of bar that have the same
bar_id as the foo record with foo_id = 1. (Correct)
The second returns all rows in the name column of the bar table. (?)
I am quite aware that if you declare an alias for a table that you should
use it, but I am very surprised that the select becomes unqualified if you
mistakenly use the full table name. Is this normal behavior?
Thanks!
Darrin
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information about yourself, create your own public profile at
http://profiles.msn.com.