pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Patrick Gibson <postgres_list@patrickg.com>
To: Roj Niyogi <niyogi@pghoster.com>
Cc: pgsql-php@postgresql.org
Subject: Re: Case insensitivity in column and table names
Date: Wed, 14 May 2003 10:27:56 -0700
Message-ID: <BAE7CAAC.C1CA%postgres_list@patrickg.com> (raw)
In-Reply-To: <3EC2737A.5060004@pghoster.com>

On 5/14/03 9:48, Roj Niyogi wrote:

> You can use quotes around each column to preserve case when creating
> your tables in PostgreSQL.  That should help retrieval of data via PHP
> in the manner you desire.

Hi Roj, thanks for the tip. It sort of works:

> create table USERS
> (
>     "ID" int not null primary key,
>     "EMAIL" varchar(255) not null
> );

> insert into USERS values ('1', 'user@email.com');

This query works:

> # select * from USERS;
>  ID |     EMAIL  
> ----+----------------
>   1 | user@email.com

... but:

> # select ID, EMAIL from USERS;
> ERROR:  Attribute "id" not found

does not. If I quote the columns like ``select "ID", "EMAIL" from USERS;''
it works, however the same query does not work in MySQL. I'm hoping to find
a solution that works with both databases, as we still plan to use MySQL for
some stuff. Our framework has some required tables and shared code, so the
same queries must work on both.

Ultimately if we have to, we will convert everything to lowercase -- but
that is really undesirable for us.

Any ideas?

Thanks,

Patrick

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




view thread (6+ messages)  latest in thread

Message-ID: <BAE7CAAC.C1CA%postgres_list@patrickg.com>
Permalink:  ../BAE7CAAC.C1CA%25postgres_list@patrickg.com/
Also on:    postgresql.org/message-id/BAE7CAAC.C1CA%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, niyogi@pghoster.com
  Subject: Re: Case insensitivity in column and table names
  In-Reply-To: <BAE7CAAC.C1CA%postgres_list@patrickg.com>
  References: <3EC2737A.5060004@pghoster.com> <BAE7CAAC.C1CA%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