pg_query_params doesn't substitute parameters
Open
Nobody has claimed this yet.
Extension: pgsql
- Dominant language
- XML
- Stars
- 596
- Forks
- 890
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 55
Description
From manual page: https://php.net/function.pg-query-params
Code:
$result = pg_query_params($dbconn_postgres, 'CREATE DATABASE $1', array("Joe's Widgets"));
Error:
PHP Warning: pg_query_params(): Query failed: ERROR: syntax error at or near "$1"
LINE 1: CREATE DATABASE $1
^ in /root/db_test.php on line 38
PHP Version:
# php8.1 --version
PHP 8.1.2-1ubuntu2.11 (cli) (built: Feb 22 2023 22:56:18) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
with Zend OPcache v8.1.2-1ubuntu2.11, Copyright (c), by Zend Technologies
Postgres version:
psql (PostgreSQL) 15.2 (Ubuntu 15.2-1.pgdg22.04+1)
OS:
Linux [HOSTNAME-EDITED] 5.15.0-69-generic #76-Ubuntu SMP Fri Mar 17 17:19:29 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the pg_query_params manual page linked in the issue and reproduce the supplied CREATE DATABASE example using PHP 8.1 and PostgreSQL 15. Compare the documented behavior with the observed syntax error, then clarify the page's parameter-substitution guidance and example so the documented usage matches PostgreSQL behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, postgresql
- Domain
- databases, documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100