pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Patrick Gibson <postgres_list@patrickg.com>
To: pgsql-php@postgresql.org
Subject: Case insensitivity in column and table names
Date: Wed, 14 May 2003 09:46:21 -0700
Message-ID: <BAE7C0ED.C1BC%postgres_list@patrickg.com> (raw)

We are in the process of converting some databases from MySQL to PostgreSQL
-- our code to access these databases is in PHP. Our convention for column
and table names is to use uppercase words.

e.g. select ID, USERNAME from USERS where ID=42;

(We find that this convention visually makes it easy to see the important
details of the query.)

In the PHP, we may have something like:

$result = mysql_query('select ID, USERNAME from USERS where ID=42');
$row = mysql_fetch_assoc($result);

$id = $row['ID'];
$username = $row['USERNAME'];

We have encountered a big problem when doing the same thing in Postgres, as
Postgres seems to lowercase all the column names. Since associative arrays
in PHP *are* case-sensitive, all of our existing code thus breaks with the
exact same tables.

Is there any way possible to get Postgres to preserve the case we give it
when we create our tables? I've done many searches, and can't seem to find
anything helpful. Surely others have encountered this problem in the past.

Thanks,

Patrick

---
 patrick gibson
 http://patrickgibson.com/




view thread (6+ messages)  latest in thread

Message-ID: <BAE7C0ED.C1BC%postgres_list@patrickg.com>
Permalink:  ../BAE7C0ED.C1BC%25postgres_list@patrickg.com/
Also on:    postgresql.org/message-id/BAE7C0ED.C1BC%postgres_list@patrickg.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: postgres_list@patrickg.com
  Subject: Re: Case insensitivity in column and table names
  In-Reply-To: <BAE7C0ED.C1BC%postgres_list@patrickg.com>
  References: <BAE7C0ED.C1BC%postgres_list@patrickg.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