X-Original-To: pgsql-php@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0AE52476B2E for ; Thu, 15 May 2003 15:18:51 -0400 (EDT) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with ESMTP id 81883-07 for ; Thu, 15 May 2003 15:18:18 -0400 (EDT) Received: from strongbad.retrix.com (strongbad.retrix.com [64.69.86.68]) by postgresql.org (Postfix) with ESMTP id 34CDD47678E for ; Thu, 15 May 2003 13:48:17 -0400 (EDT) Received: from [192.168.2.185] ([204.244.59.82]) (authenticated bits=0) by strongbad.retrix.com (8.12.6p2/8.12.3) with ESMTP id h4FHoEBF079086; Thu, 15 May 2003 10:50:15 -0700 (PDT) (envelope-from postgres_list@patrickg.com) User-Agent: Microsoft-Entourage/10.1.1.2418 Date: Thu, 15 May 2003 10:47:56 -0700 Subject: Re: Case insensitivity in column and table names From: Patrick Gibson To: Dani Oderbolz Cc: Message-ID: In-Reply-To: <3EC38E67.3070800@ecologic.de> Mime-version: 1.0 Content-type: text/plain; charset="ISO-8859-1" Content-transfer-encoding: quoted-printable X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/15 X-Sequence-Number: 2020 On 5/15/03 5:56, Dani Oderbolz wrote: >> We have encountered a big problem when doing the same thing in Postgres,= as >> Postgres seems to lowercase all the column names. Since associative arra= ys >> in PHP *are* case-sensitive, all of our existing code thus breaks with t= he >> exact same tables. >>=20 > I don=B4t quite get your point. > In Postgres 7.3.2 I can do this: >=20 > Select MyColumn from MyTable; > --Works >=20 > as well as > Select mycolumn from mytable; > --Works as well >=20 > Its just that internally postgres stores your object names in lowercase - > which should not matter to you. It does matter because when it comes back to PHP, the keys in the array are lowercase, even though the query specified them as uppercase. In the past (with MySQL) we've always been able to rely on the database returning keys in the same case as we specify -- PHP arrays are case sensitive, which is where the problem comes in. If we have the query, 'select ID, USERNAME from USERS' with a MySQL database, we'd get an associate array with 'ID' and 'USERNAME' being the keys. The same query with Postgres will give us keys of 'id' and 'username', which is different. The goal of what we want to do is to be able to use the same code no matter which database we are using. We ultimately will switch to a lowercase convention to accommodate Postgres, but I'm trying to find out if that really is the only option. The quoting technique does not work either because MySQL handles it differently. Patrick --- patrick gibson http://patrickgibson.com/