|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-01-01 19:35 UTC] iliaa@php.net
[2009-01-02 14:37 UTC] thuejk at gmail dot com
[2009-01-02 14:55 UTC] thuejk at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 20:00:02 2025 UTC |
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