X-Original-To: pgsql-php@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 98FAA475EC9 for ; Wed, 14 May 2003 12:50:37 -0400 (EDT) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with ESMTP id 94585-06 for ; Wed, 14 May 2003 12:50:35 -0400 (EDT) Received: from secure.pghoster.com (unknown [64.246.32.44]) by postgresql.org (Postfix) with ESMTP id 80537475E25 for ; Wed, 14 May 2003 12:50:35 -0400 (EDT) Received: from pghoster.com (12-239-205-206.client.attbi.com [12.239.205.206]) (authenticated (0 bits)) by secure.pghoster.com (8.11.6/8.11.6) with ESMTP id h4EGoDK04264; Wed, 14 May 2003 11:50:13 -0500 Message-ID: <3EC2737A.5060004@pghoster.com> Date: Wed, 14 May 2003 11:48:58 -0500 From: Roj Niyogi User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4b) Gecko/20030507 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Patrick Gibson Cc: pgsql-php@postgresql.org Subject: Re: Case insensitivity in column and table names References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/13 X-Sequence-Number: 2018 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. Regards, Roj -- niyogi@pghoster.com pgHoster - PostgreSQL Database & Web Hosting www.pghoster.com 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. > >Thanks, > >Patrick > >--- > patrick gibson > http://patrickgibson.com/ > > >---------------------------(end of broadcast)--------------------------- >TIP 4: Don't 'kill -9' the postmaster > >