#41860 [WFx]: Identifiers should be double quoted
| From: | brian at derocher dot org | Date: | Tue, 03 Jul 2007 03:34:04 +0000 |
| Subject: | #41860 [WFx]: Identifiers should be double quoted | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-114567@lists.php.net to get a copy of this message | ||
ID: 41860
User updated by: brian at derocher dot org
Reported By: brian at derocher dot org
Status: Wont fix
Bug Type: PostgreSQL related
Operating System: Linux
PHP Version: 5.2.3
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2007-07-02 15:51:39] iliaa@php.net
This fix would break backwards compatibility for people relying on the
case-insensetive behavior.
------------------------------------------------------------------------
[2007-06-29 23:34:28] 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)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41860&edit=1