implied FROM
От | Matt Mello |
---|---|
Тема | implied FROM |
Дата | |
Msg-id | 34943.24.243.219.116.1051841197.squirrel@earth.spaceship.com обсуждение исходный текст |
Ответы |
Re: implied FROM
|
Список | pgsql-sql |
Hello, all. New to this list. If this isn't the right place for this issue, please let me know. Here is a condensed version of the situation. I have two tables (STORE and APPLIANCE). They share a field name STOREID, where the field is a primary key in STORE and a foreign key in APPLIANCE. 1) Here is what I *should* have typed in: select appliance.storeid from appliance where appliance.applianceid = 32; 2) Here is what I accidentally typed in: select store.storeid from appliance where appliance.applianceid = 32; #1 gives me a single int4 column in a single-row resultset. #2 gives me a single int4 column in a resultset that has a row for every row in STORE. I finally figured out my error, but I would have found it much faster if the problem query had thrown an exception. So, why doesn't asking for a field from a table that IS NOT in the from clause throw an exception? Isn't it violating the SQL language? Why is PG implying FROM tables? Thanks! -- Matt Mello
В списке pgsql-sql по дате отправления: