|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41860 Identifiers should be double quoted
Submitted: 2007-06-29 23:34 UTC Modified: 2007-07-03 03:34 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: brian at derocher dot org Assigned:
Status: Wont fix Package: PostgreSQL related
PHP Version: 5.2.3 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: brian at derocher dot org
New email:
PHP Version: OS:


 [2007-06-29 23:34 UTC] brian at derocher dot org
Quoting table names and other identifiers is needed because they are 
case-sensitive in PostgreSQL.  As Marco pointed out reserved words 
also need to be quoted.

See section 4.1.1. Identifiers and Key Words

I'm not sure why marked bug #28020 as bodus 3 years 

Reproduce code:
$Conn = pg_connect( "dbname=db" );

pg_query( $Conn, "insert into \"caseTest\" (foo) values (2)" ); // works
//pg_query( $Conn, "insert into   caseTest   (foo) values (2)" ); // fails correctly

echo pg_insert( $Conn, 'caseTest', array( 'foo' => 1 ), PGSQL_DML_STRING );
// INSERT INTO caseTest (foo) VALUES (1);

if (pg_insert( $Conn, 'caseTest', array( 'foo' => 1 ) ))
        echo 'success';
        echo 'failure';

Expected result:
 INSERT INTO caseTest (foo) VALUES (1);success

db=# select * from "caseTest";
(2 rows)

Actual result:
 INSERT INTO caseTest (foo) VALUES (1);failure

db=# select * from "caseTest";
(1 row)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-02 15:51 UTC]
This fix would break backwards compatibility for people relying on the 
case-insensetive behavior.
 [2007-07-03 03:34 UTC] brian at derocher dot org
pg_insert(), pg_select(), pg_delete(), and pg_update() are marked as 
EXPERIMENTAL.  Nobody should be relying on them since they are 
subject to change.  Now's the time to fix the bug.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Sep 16 10:03:36 2021 UTC