Re: Case insensitivity in column and table names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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@xxxxxxxxx');

This query works:

> # select * from USERS;
>  ID |     EMAIL  
> ----+----------------
>   1 | user@xxxxxxxxx

... 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/



[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux