PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » MDB_QueryTool » Bug #7570

Postgres SQL bug (case sensitive inserts)

Details

Submitted2006-05-07 02:20 UTC
Fromsendto at ronald-douglas dot com
Assignedhugoki
StatusClosed
PackageMDB_QueryTool
PHP Version5.1.2
OSRedhat Linux Enterprise
Roadmaps(Not assigned)

Comments

[2006-05-07 02:20 UTC] sendto at ronald-douglas dot com

Description:
------------
Apply to line 646

Test script:
---------------
Patch idea: Apply to line 646
if($this->db->phptype == 'pgsql')
{
foreach($newData as $k => $v)
$newDataEncapsulated['`'.$k.'`'] = $v;

$newData = $newDataEncapsulated;
}

Description:

Postgres REQUIRES double quotations around case sensitive
fieldsnames.

INSERT INTO Users (Email, FirstName, LastName, ip, BusinessName, Website, OptIn, userId) VALUES ('foo@bar.com', 'Ronald', 'Partridge', '127.0.0.0', 'Ronald Douglas Consulting', 'http://www.ronald-douglas.com', 'YES', 105)
<DOES NOT WORK UNDER POSTGRES>

INSERT INTO Users ("Email", "FirstName", "LastName", "ip", "BusinessName", "Website", "OptIn", "userId") VALUES ('foo@bar.com', 'Ronald', 'Partridge', '127.0.0.0', 'Ronald Douglas Consulting', 'http://www.ronald-douglas.com', 'YES', 105)
<WORKS UNDER POSTGRES>

Expected result:
----------------
I expect that if the postgres database has been selected within the object, that the add() method will wrap double quotes " around fieldnames.

INSERT INTO Users ("Email", "FirstName", "LastName", "ip", "BusinessName", "Website", "OptIn", "userId") VALUES ('foo@bar.com', 'Ronald', 'Partridge', '127.0.0.0', 'Ronald Douglas Consulting', 'http://www.ronald-douglas.com', 'YES', 105)

Actual result:
--------------
Please give me your thoughts and feedback. <sendto@ronald-douglas.com

I will be patching MDB_QueryTool on my system and my clients production system.