Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.4.1

Bug #1114 bug fix 561 flawed; single-quoting fields errors in pgsql
Submitted: 2004-04-01 23:27 UTC
From: crain at fuse dot net Assigned: datenpunk
Status: Closed Package: DB_NestedSet
PHP Version: 4.3.4 OS: winXP, Debian
Roadmaps: (Not assigned)    
Subscription  


 [2004-04-01 23:27 UTC] crain at fuse dot net
Description: ------------ Bug fix 561, specifically the fix to DB_NestedSet->_getSelectFields(), adding a call to _quote() around aliased field names, causes problems, at least in Postgres. _quote() adds single quotes (') which work for mysql (although it should be back ticks (`)). But it generates an error in pgsql queries. See http://marc.theaimsgroup.com/?t=108085269100002&r=1&w=2 for pgsql results. I think you need to use quoteIdentifier() instead of _quote().

Comments

 [2004-04-01 23:36 UTC] crain at fuse dot net
Actually, there's another problem with fix 561. Instead of _quote(), _values2InsertQuery() was edited to place back ticks around insert field values, which also breaks pgsql. I think both cases should use quoteIdentifier().
 [2004-04-01 23:58 UTC] datenpunk at php dot net
Hello Andy, this is really dumb. I spent some hours on the quoting issue and found out that different RDBM's have totally complementary implementations for the quoting things. E.g. mySQL only accepts backticks for field names used inside an insert/update query. But I thought I had figured it out - I was wrong :\ Unfortunately MDB doesn't support quoteIdentifier yet. Which means that MDB will not work with reserved words used for column names till it supports this type of quoting. Could you please fetch NestedSet.php and Nested/set/DB.php,MDB.php to see if the problem is fixed for you now? I'll add pgsql to my testsuite setup now - promise! -- Daniel Khan
 [2004-04-02 00:22 UTC] datenpunk at php dot net
O.K. here's a snapshot http://devel.webcluster.at/~daniel/DB_NestedSet/DB_NestedSet-1.3.4.tgz As soon as I know that it works for you now I'll do a new release.
 [2004-04-02 00:56 UTC] crain at fuse dot net
Hi Daniel, Eyeballed the changes and they appear OK. And testing on MySQL I found no problems. I forwarded this on to other Seagull developers for testing on pgsql (I don't have it either) and will let you know what they say. Andy
 [2004-04-02 00:59 UTC] datenpunk at php dot net
Thanks a lot. Yes mySQL should work for sure as I am using it in my testsuites.
 [2004-04-03 23:05 UTC] crain at fuse dot net
 [2004-04-04 19:29 UTC] datenpunk at php dot net
Thank you for your bug report. This issue has already been fixed in the latest released version of the package, which you can download at http://pear.php.net/packages.php