pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matt Mello <alien@spaceship.com>
To: pgsql-sql@postgresql.org
Subject: implied FROM
Date: Thu, 1 May 2003 21:06:37 -0500 (CDT)
Message-ID: <34943.24.243.219.116.1051841197.squirrel@earth.spaceship.com> (raw)

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




view thread (6+ messages)  latest in thread

Message-ID: <34943.24.243.219.116.1051841197.squirrel@earth.spaceship.com>
Permalink:  ../34943.24.243.219.116.1051841197.squirrel@earth.spaceship.com/
Also on:    postgresql.org/message-id/34943.24.243.219.116.1051841197.squirrel@earth.spaceship.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: alien@spaceship.com
  Subject: Re: implied FROM
  In-Reply-To: <34943.24.243.219.116.1051841197.squirrel@earth.spaceship.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox