Skip site navigation (1) Skip section navigation (2)

Re: case-sensitivity inconsistency in quoted column aliases in FROM subselects

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mike Hoolehan <mike(at)sycamorehq(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: case-sensitivity inconsistency in quoted column aliases in FROM subselects
Date: 2002-01-09 19:37:58
Message-ID: 14499.1010605078@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Mike Hoolehan <mike(at)sycamorehq(dot)com> writes:
> SELECT * FROM (SELECT col1 as "Foo" from table1) AS innerQuery 
>   WHERE Foo = 'whatever';
> results in 
> "ERROR:  Attribute 'foo' not found"
> no matter what capitalization is used for "Foo" in the where clause 
> (i.e. foo='whatever', FOO='whatever', etc).
> I assume this is a bug, since if the column is aliases as "foo" (with
> quotes, all lowercase), then the column can later be referenced
> without quotes with case-insensitivity.

This is not a bug, it's the expected behavior.  See the discussion of
identifier case sensitivity in the manual, eg
http://www.ca.postgresql.org/users-lounge/docs/7.1/postgres/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: Peter EisentrautDate: 2002-01-09 19:42:36
Subject: Re: case-sensitivity inconsistency in quoted column aliases
Previous:From: Bruno Wolff IIIDate: 2002-01-09 17:29:28
Subject: 'natural join' and 'join ... using' giving different results

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group