Re: Unquoted column names fold to lower case

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Dev Kumkar <devdas(dot)kumkar(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Thomas Kellerer <spam_eater(at)gmx(dot)net>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Unquoted column names fold to lower case
Date: 2013-07-03 23:29:34
Message-ID: 20130703232934.GE6492@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, Jul 4, 2013 at 02:00:24AM +0530, Dev Kumkar wrote:
> On Thu, Jul 4, 2013 at 1:36 AM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
>
> And let's not forget that column aliases can be used as indentifiers in
> queries:
>
> test=> SELECT 1 AS x
> test-> ORDER BY x;
> x
> ---
> 1
> (1 row)
>
> test=> SELECT 1 AS "X"
> ORDER BY x;
> ERROR: column "x" does not exist
> LINE 2: ORDER BY x;
>
> Changing this would mean that the same identifier would have different
> case-folding rules depending on where it appeared in the query.
>
>
> Sorry but I am not sure about your point here. Currently if the alias is quoted
> then same needs to be used in queries as identifies:
> SELECT 1 AS "X"
> ORDER BY "X";

You would need to double-quote 'x' in the ORDER BY, but not in the
target list (because case would be preserved there) --- that is
confusing.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Andreas 2013-07-08 12:18:17 monthly statistics
Previous Message Dev Kumkar 2013-07-03 21:01:20 Re: Unquoted column names fold to lower case