RE: [PHP] Problem querying postgres

From: Date: Fri, 13 Aug 2004 16:29:52 +0000
Subject: RE: [PHP] Problem querying postgres
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-193717@lists.php.net to get a copy of this message
Joshua Capy wrote: > of PHPADMIN and try use pg_query() to do a select such as "SELECT > PersonID FROM person" > > the string that is sent is "select personid from person". Now this is > a problem because in the data base the field PersonID is not the same > case as in the select that is sent and I get the error > > Warning: pg_query(): Query failed: ERROR: column "personid" does not > exist in /Users/jcapy2/Sites/Jesper/SyncPosgresToMbrMaxData.php on > line 70 > > If I change the field to all lower case in the database this does not > happen. Are you certain that the query is being sent in lowercase? Have you echo()'ed the query to the browser to verify that? I believe in Postgres that you have to quote any identifiers contain mixed case or spaces. Try sending your query as SELECT "PersonID" FROM person and see if that makes a difference. I wouldn't be surprised if phpAdmin quotes all identifiers just to be safe...

« previous php.general (#193717) next »