Re: How Do I Toggle Quoted Identifiers?

From: Richard Huxton <dev(at)archonet(dot)com>
To: googlemike(at)hotpop(dot)com (Google Mike), pgsql-sql(at)postgresql(dot)org
Subject: Re: How Do I Toggle Quoted Identifiers?
Date: 2003-12-04 20:45:20
Message-ID: 200312042045.20911.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thursday 04 December 2003 19:42, Google Mike wrote:
> I'm on PHP 4.2.2 and RedHat 9 with PGSQL. I want to turn quoted
> identifiers off with my SQL queries. What SQL statement or .CONF
> setting do I need to change so that I can turn quoted identifiers off?

Short answer - you don't. Your understanding is correct, basically PG will
lowercase identifiers unless you quote them, in which case you will want to
use quotes when accessing them. So...

CREATE TABLE AAA ...
CREATE TABLE "BBB" ...
CREATE TABLE "ccc" ...
SELECT * FROM AAA; -- works
SELECT * FROM aaa; -- works
SELECT * FROM "AAA" -- fails
SELECT * FROM BBB; -- fails
SELECT * FROM "BBB"; -- works
SELECT * FROM CCC; -- works
SELECT * FROM "ccc"; -- works
SELECT * FROM "CCC"; -- fails

So long as you don't create your identifiers with quotes, you can refer to
them as upper/lower case. Personally, I create them all lower-case anyway and
use caps for SQL keywords.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Eisentraut 2003-12-04 20:54:12 Re: How Do I Toggle Quoted Identifiers?
Previous Message Google Mike 2003-12-04 19:42:56 How Do I Toggle Quoted Identifiers?