View Issue Details

IDProjectCategoryView StatusLast Update
0000758Pgpool-IIBugpublic2022-06-26 22:28
Reporterpalmalcheg Assigned Topengbo  
PrioritynormalSeverityminorReproducibilityalways
Status feedbackResolutionopen 
Summary0000758: Mixed SQL construction causes PgPool "show pool_*" forwarding to backend
DescriptionMulti statement command doesn't dispatch statements correctly.

"SET lock_timeout TO '100ms';SHOW POOL_VERSION" - forward every statement to backend, causing failure

"SHOW POOL_VERSION; SET lock_timeout TO '100ms'" - executes every statement on frontend.
Steps To Reproducepostgres@postgres-db-pg-cluster-0:~$ psql -h postgres-db-pg-cluster-pgpool.pf -c "SET lock_timeout TO '100ms';SHOW POOL_VERSION"
Password for user postgres:
ERROR: unrecognized configuration parameter "pool_version"

postgres@postgres-db-pg-cluster-0:~$ psql -h postgres-db-pg-cluster-pgpool.pf -c "SHOW POOL_VERSION"
Password for user postgres:
pool_version

4.2.2 (chichiriboshi)
(1 row)

postgres@postgres-db-pg-cluster-0:~$ psql -h postgres-db-pg-cluster-pgpool.pf -c "SHOW POOL_VERSION;SET lock_timeout TO '100ms'"
Password for user postgres:
pool_version

4.2.2 (chichiriboshi)
(1 row)
TagsNo tags attached.

Activities

pengbo

2022-06-26 22:28

developer   ~0004060

Thank you.

The multiple SQLs passed to "-c" option will be sent to the server as a single request.
It is the feature of psql: https://www.postgresql.org/docs/14/app-psql.html

To prevent such error, you can use the solutions below:

(1)
/usr/pgsql-14/bin/psql -h 127.0.0.1 -U pengbo -p 11000 test -c "SET lock_timeout TO '100ms'" -c "SHOW POOL_VERSION"
SET
     pool_version
-----------------------
 4.2.2 (chichiriboshi)
(1 row)

(2)
$ /usr/pgsql-14/bin/psql -h 127.0.0.1 -U pengbo -p 11000 test <<EOF
SET lock_timeout TO '100ms';
show pool_version;
EOF

SET
     pool_version
-----------------------
 4.2.2 (chichiriboshi)
(1 row)

(3)
$ /usr/pgsql-14/bin/psql -h 127.0.0.1 -U pengbo -p 11000 test
test=# SET lock_timeout TO '100ms';show pool_version;
SET
     pool_version
-----------------------
 4.2.2 (chichiriboshi)
(1 row)


However, in same cases, Pgpool-II couldn't process multi-statement queries.
See doc:
https://www.pgpool.net/docs/latest/en/html/restrictions.html
Multi-statement Query
Pgpool-II cannot process multi-statement queries. However, when Pgpool-II is connected by psql, It is no problem. psql parse multi-statement, send a statement one by one.

Issue History

Date Modified Username Field Change
2022-06-23 23:32 palmalcheg New Issue
2022-06-24 14:05 pengbo Assigned To => pengbo
2022-06-24 14:05 pengbo Status new => assigned
2022-06-26 22:28 pengbo Note Added: 0004060
2022-06-26 22:28 pengbo Status assigned => feedback