Thread: How Do I Toggle Quoted Identifiers?

How Do I Toggle Quoted Identifiers?

From
googlemike@hotpop.com (Google Mike)
Date:
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?

Quoted identifiers, as I understand them, are where you must put
double quotes around any table or column name in order to preserve its
case, or in order to preserve an internal space it may have in the
identifier name.

I was looking for something like:
SET QUOTED_IDENTIFIERS = OFF;
SELECT Username FROM Logins;

For that matter, how do I turn case-sensitivity off?


Re: How Do I Toggle Quoted Identifiers?

From
Richard Huxton
Date:
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


Re: How Do I Toggle Quoted Identifiers?

From
Peter Eisentraut
Date:
Google Mike writes:

> 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?

There is no setting for that.

> For that matter, how do I turn case-sensitivity off?

There is no setting for that either.

-- 
Peter Eisentraut   peter_e@gmx.net