agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: Dev Kumkar <devdas.kumkar@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Thomas Kellerer <spam_eater@gmx.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: Unquoted column names fold to lower case
Date: Wed, 3 Jul 2013 19:29:34 -0400
Message-ID: <20130703232934.GE6492@momjian.us> (raw)
In-Reply-To: <CALSLE1NcZj2gQAr9PxUC_2o_OJVQYbvLqr_0zhGPSLrjyXocTQ@mail.gmail.com>
References: <20130703152402.GA6492@momjian.us>
	<CALSLE1N-WnxujTjD+ED9u4pjFrUnHbm8zr9+SmMvu5NPAMGw1g@mail.gmail.com>
	<20130703153524.GB6492@momjian.us>
	<CALSLE1Pxn7aL1P4tW5vL6GL7h9V1YrZU2KmFeTaHQ2ok4hb_xg@mail.gmail.com>
	<kr1i4m$s2o$1@ger.gmane.org>
	<CALSLE1Ofnbp=3WqrNQCG8g36w1h5ndwk4o4Vj9ruUHepzsMLHQ@mail.gmail.com>
	<20130703190831.GG3592@eldon.alvh.no-ip.org>
	<24100.1372880857@sss.pgh.pa.us>
	<20130703200652.GD6492@momjian.us>
	<CALSLE1NcZj2gQAr9PxUC_2o_OJVQYbvLqr_0zhGPSLrjyXocTQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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@momjian.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@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

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


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (23+ messages)  latest in thread

Message-ID: <20130703232934.GE6492@momjian.us>
Permalink:  ../20130703232934.GE6492@momjian.us/
Also on:    postgresql.org/message-id/20130703232934.GE6492@momjian.us

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: bruce@momjian.us, devdas.kumkar@gmail.com, tgl@sss.pgh.pa.us, alvherre@2ndquadrant.com, spam_eater@gmx.net
  Subject: Re: Unquoted column names fold to lower case
  In-Reply-To: <20130703232934.GE6492@momjian.us>

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

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