[pgpool-committers: 9236] pgpool: Judge multi statement query using psqlscan.
Tatsuo Ishii
ishii at sraoss.co.jp
Tue Mar 28 19:14:19 JST 2023
Judge multi statement query using psqlscan.
Psqlscan is a module in the PostgreSQL source tree. It is essentially
subset of PostgreSQL SQL scanner but it is specialized for detecting
the end of each SQL statement. Therefore we can count the number of
SQL statements in a query string by using it.
Because psqlscan is not designed as an external library, it is hard to
call it from outside of PostgreSQL source tree. So I decided to import
psqlscan source code. This module consists of multiple files. Program
sources are deployed in src/utils directory and header files are
deployed in src/include/utils directory.
psqlscan module was originally designed for frontend programs and uses
malloc directly. So I changed them so that it calls palloc and
friends. Additionally pgstrcasecmp.c and pqexpbuffer.c are also
imported. They are used by psqlscan.
The example usage of psqlscan can be found in
multi_statement_query():src/protocol/pool_proto_modules.c.
Discussion:
https://www.pgpool.net/pipermail/pgpool-hackers/2023-February/004291.html
Branch
------
master
Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=48da8715bf403965507eef0321c0ab10054ac71c
Modified Files
--------------
src/Makefile.am | 9 +-
src/include/utils/pgstrcasecmp.h | 22 +
src/include/utils/pqexpbuffer.h | 192 +++++
src/include/utils/psqlscan.h | 90 +++
src/include/utils/psqlscan_int.h | 157 ++++
src/protocol/pool_proto_modules.c | 105 ++-
src/utils/pgstrcasecmp.c | 154 ++++
src/utils/pqexpbuffer.c | 418 ++++++++++
src/utils/psqlscan.l | 1620 +++++++++++++++++++++++++++++++++++++
9 files changed, 2751 insertions(+), 16 deletions(-)
More information about the pgpool-committers
mailing list