No error when column doesn't exist

From: Dean Rasheed <dean_rasheed(at)hotmail(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: No error when column doesn't exist
Date: 2008-09-10 17:02:28
Message-ID: BAY102-W9B6A6BCCA4DD85B34F56CF2570@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


I've just spent a couple of hours tracking down a bug which turned out
to be a typo in my code. What surprises me is that the SQL in question
didn't immediately produce an error. Here's a simplified example:

CREATE TABLE foo(a int, b int);
INSERT INTO foo VALUES(1,2);
SELECT foo.text FROM foo;

I expected that to generate an error: column foo.text does not exist.
Instead it treats "foo.text" as "foo.*::text AS text":

SELECT foo.text FROM foo;
text
-------
(1,2)
(1 row)

If foo actually does have a column called text, this works as expected,
selecting just that column.

Is this a feature or a bug?

Dean

_________________________________________________________________
Make a mini you and download it into Windows Live Messenger
http://clk.atdmt.com/UKM/go/111354029/direct/01/

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Ross 2008-09-10 17:07:29 Re: Can interval take a value from a field?
Previous Message Andy Colson 2008-09-10 16:48:43 Re: 64-bit Compile Failure on Solaris 10 with OpenSSL