Skip site navigation (1) Skip section navigation (2)

Re: Case insensitivity in column and table names

From: Roj Niyogi <niyogi(at)pghoster(dot)com>
To: Patrick Gibson <postgres_list(at)patrickg(dot)com>
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: Case insensitivity in column and table names
Date: 2003-05-14 16:48:58
Message-ID: (view raw or whole thread)
Lists: pgsql-php
Hi Patrick:

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.



pgHoster - PostgreSQL Database & Web Hosting

Patrick Gibson wrote:

>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.
> patrick gibson
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster

In response to


pgsql-php by date

Next:From: ryanne cruzDate: 2003-05-14 16:52:28
Subject: Re: unsubscribe
Previous:From: Patrick GibsonDate: 2003-05-14 16:46:21
Subject: Case insensitivity in column and table names

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group