Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UuWUZ-0008Af-EQ for pgsql-sql@arkaria.postgresql.org; Wed, 03 Jul 2013 23:29:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1UuWUY-0000Rd-Uf for pgsql-sql@arkaria.postgresql.org; Wed, 03 Jul 2013 23:29:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UuWUX-0000RW-Vy for pgsql-sql@postgresql.org; Wed, 03 Jul 2013 23:29:42 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UuWUU-0005SW-UD for pgsql-sql@postgresql.org; Wed, 03 Jul 2013 23:29:41 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1UuWUQ-0001EV-A5; Wed, 03 Jul 2013 19:29:34 -0400 Date: Wed, 3 Jul 2013 19:29:34 -0400 From: Bruce Momjian To: Dev Kumkar Cc: Tom Lane , Alvaro Herrera , Thomas Kellerer , pgsql-sql@postgresql.org Subject: Re: Unquoted column names fold to lower case Message-ID: <20130703232934.GE6492@momjian.us> References: <20130703152402.GA6492@momjian.us> <20130703153524.GB6492@momjian.us> <20130703190831.GG3592@eldon.alvh.no-ip.org> <24100.1372880857@sss.pgh.pa.us> <20130703200652.GD6492@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org On Thu, Jul 4, 2013 at 02:00:24AM +0530, Dev Kumkar wrote: > On Thu, Jul 4, 2013 at 1:36 AM, Bruce Momjian 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 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