pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: googlemike@hotpop.com
To: pgsql-sql@postgresql.org
Subject: Re: How Do I Toggle Quoted Identifiers?
Date: Thu, 4 Dec 2003 20:45:20 +0000
Message-ID: <200312042045.20911.dev@archonet.com> (raw)
In-Reply-To: <25d8d6a8.0312041142.6ac4a5cd@posting.google.com>
References: <25d8d6a8.0312041142.6ac4a5cd@posting.google.com>

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



view thread (3+ messages)  latest in thread

Message-ID: <200312042045.20911.dev@archonet.com>
Permalink:  ../200312042045.20911.dev@archonet.com/
Also on:    postgresql.org/message-id/200312042045.20911.dev@archonet.com

 · 

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: dev@archonet.com, googlemike@hotpop.com
  Subject: Re: How Do I Toggle Quoted Identifiers?
  In-Reply-To: <200312042045.20911.dev@archonet.com>

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

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