Re: Case insensitivity in column and table names

From: Patrick Gibson <postgres_list(at)patrickg(dot)com>
To: Roj Niyogi <niyogi(at)pghoster(dot)com>
Cc: <pgsql-php(at)postgresql(dot)org>
Subject: Re: Case insensitivity in column and table names
Date: 2003-05-14 17:27:56
Message-ID: BAE7CAAC.C1CA%postgres_list@patrickg.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

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(at)email(dot)com');

This query works:

> # select * from USERS;
> ID | EMAIL
> ----+----------------
> 1 | user(at)email(dot)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/

In response to

Browse pgsql-php by date

  From Date Subject
Next Message Patrick Gibson 2003-05-15 17:47:56 Re: Case insensitivity in column and table names
Previous Message ryanne cruz 2003-05-14 16:52:28 Re: unsubscribe