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

Re: case-sensitivity inconsistency in quoted column aliases

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Mike Hoolehan <mike(at)sycamorehq(dot)com>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: case-sensitivity inconsistency in quoted column aliases
Date: 2002-01-09 19:55:00
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
On Wed, 9 Jan 2002, Mike Hoolehan wrote:

> Please enter a FULL description of your problem:
> ------------------------------------------------
> if a quoted column alias in a FROM clause sub-select contains upper-case
> chars, then that column cannot be later referenced without using quotes
> Please describe a way to repeat the problem.   Please try to provide a
> concise reproducible example, if at all possible:
> ----------------------------------------------------------------------
> 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.

Unquoted column and table names are folded to lower case (thus Foo
is the same as foo or FOO or "foo", but "Foo" is different).  In
general, although "foo" will be matched, if you use quotes around
the name in its creation you should always use quotes thereafter.

In response to

pgsql-bugs by date

Next:From: Tom LaneDate: 2002-01-09 20:26:12
Subject: Re: 'natural join' and 'join ... using' giving different results
Previous:From: Peter EisentrautDate: 2002-01-09 19:42:36
Subject: Re: case-sensitivity inconsistency in quoted column aliases

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