php.net |  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
Votes:1
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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: brian at derocher dot org
New email:
PHP Version: OS:

 

 [2007-06-29 23:34 UTC] brian at derocher dot org
Description:
------------
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
http://www.postgresql.org/docs/8.1/static/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS

I'm not sure why sniper@php.net marked bug #28020 as bodus 3 years 
ago.

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';
else
        echo 'failure';


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

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

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

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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-02 15:51 UTC] iliaa@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC