|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-06-19 20:12 UTC] requinix@php.net
[2021-06-21 09:49 UTC] cmb@php.net
-Status: Open
+Status: Not a bug
-Assigned To:
+Assigned To: cmb
[2021-06-21 09:49 UTC] cmb@php.net
[2021-06-21 18:09 UTC] kachalin dot alexey at gmail dot com
-Type: Bug
+Type: Documentation Problem
-Operating System: Ubuntu
+Operating System: any
[2021-06-21 18:09 UTC] kachalin dot alexey at gmail dot com
[2021-06-21 18:18 UTC] cmb@php.net
-Status: Not a bug
+Status: Open
-Assigned To: cmb
+Assigned To:
[2021-06-21 18:18 UTC] cmb@php.net
[2022-12-28 06:01 UTC] marlynrasavong at gmail dot com
[2023-05-24 17:33 UTC] kachalin dot alexey at gmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 13 05:00:01 2025 UTC |
Description: ------------ Brifely Prepared SQL name collision, because the name implicitly truncated to 63 first characters of given name. Current behavior: Fatal errors and warnings. Desirable behavior: No any error or warning. Uncomment a "//$string63 = 'smallLengthSQL'; line to check execution with any error. Affected version. All 7 and 8. Latest check on 8.1. Notice Don't forget to put your PG server credentials for connection. Test script: --------------- <?php $host = ''; $port = '';// 5432 $db = ''; $user = ''; $pass = ''; $connectString = "host=$host port=$port dbname=$db user=$user password=$pass"; $pg_pconnect = pg_pconnect($connectString); $string63 = '5c6b58ebdd4464734a57a87431ba24b38d2e49ae5c6b58ebdd4464734a57a87';// length - 63 //$string63 = 'smallLengthSQL';// Uncomment for expected result. $sqlPreparedNameA = $string63 . '_A';// length - 65 for error case. $sqlPreparedNameB = $string63 . '_B';// length - 65 for error case. $sqlPreparedBodyA = 'SELECT $1 as result_1' ; $sqlPreparedBodyB = 'SELECT $1 as result_1, $2 as result_2'; $pg_prepareA = pg_prepare($pg_pconnect, $sqlPreparedNameA, $sqlPreparedBodyA); $pg_prepareA = pg_prepare($pg_pconnect, $sqlPreparedNameB, $sqlPreparedBodyB); $pg_executeA = pg_execute($pg_pconnect, $sqlPreparedNameA, array("Result A1" )); $pg_executeB = pg_execute($pg_pconnect, $sqlPreparedNameB, array("Result B1", "Result B2")); $resultA = pg_fetch_all($pg_executeA); $resultB = pg_fetch_all($pg_executeB); var_dump($resultA); var_dump($resultB); Expected result: ---------------- array(1) { [0]=> array(1) { ["result_1"]=> string(9) "Result A1" } } array(1) { [0]=> array(2) { ["result_1"]=> string(9) "Result B1" ["result_2"]=> string(9) "Result B2" } } Actual result: -------------- Warning: pg_prepare(): Query failed: ERROR: prepared statement "5c6b58ebdd4464734a57a87431ba24b38d2e49ae5c6b58ebdd4464734a57a87_B" already exists in Warning: pg_execute(): Query failed: ERROR: bind message supplies 2 parameters, but prepared statement "5c6b58ebdd4464734a57a87431ba24b38d2e49ae5c6b58ebdd4464734a57a87_B" requires 1 in Fatal error: Uncaught TypeError: pg_fetch_all(): Argument #1 ($result) must be of type PgSql\Result, bool given in