ID:               46954
 Updated by:       [email protected]
 Reported By:      thuejk at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         PostgreSQL related
 Operating System: Linux
 PHP Version:      5.2.8
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

The truncation is done by Postgre and the PQPrepare() function does not

provide any indicators about truncation.


Previous Comments:
------------------------------------------------------------------------

[2008-12-27 15:17:26] thuejk at gmail dot com

Description:
------------
When using pg_prepare(string $stmtname, string $query) with a very long
$stmtname, the $stmtname will be silently truncated. It would be nice if
PHP emitted an E_NOTICE, as postgresql itself does:

psql=> PREPARE
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
as SELECT NOW();
NOTICE:  identifier
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
will be truncated to
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk"
PREPARE

Note that it is a sane idea to try to use the query itself as $stmtname
(less bookkeeping), which naturally leads to trying large $stmtname's.

Reproduce code:
---------------
pg_connect(...);

pg_prepare("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
1", "SELECT 1");
pg_prepare("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
2", "SELECT 2");

Expected result:
----------------
An E_NOTICE because the name was truncated.

Actual result:
--------------
No E_NOTICE.

pg_prepare() [function.pg-prepare]: Query failed: ERROR:  prepared
statement
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
2" already exists



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=46954&edit=1

Reply via email to