Re: pgbench - allow to store select results into variables
Fabien COELHO <coelho@cri.ensmp.fr>
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Tatsuo Ishii <ishii@sraoss.co.jp>
Cc: tgl@sss.pgh.pa.us, rafia.sabih@enterprisedb.com,
michael.paquier@gmail.com,
Langote_Amit_f8@lab.ntt.co.jp, robertmhaas@gmail.com,
pavel.stehule@gmail.com,
PostgreSQL Developers <pgsql-hackers@postgresql.org>
Date: 2017-04-08T20:24:37Z
Lists: pgsql-hackers
Attachments
- pgbench-utf8-vars-1.sql (application/x-sql)
- pgbench-utf8-vars.sql (application/x-sql)
Hello Tatsuo-san, >>> If I understand correctly, the patch is moved because of the unrelated >>> issue that variables cannot be utf8 in pgbench, and it is a condition >>> to consider this patch that existing pgbench variables (set with \set) >>> can be utf8? >> >> I'm not sure if it is "unrelated" because the new feature relies on >> existing pgbench variable infrastructure. > > Sure. I meant that the constraint on variable names exists before the patch > and the patch is not related to variable names, but the patch is about > variables, obviously. > > As "psql" variables can be utf8 and that the same scanner is used, but the > variables values are not stritcly the same (they are typed in pgbench), I'm > wondering whether the effort should be do share more code/abstraction between > psql & pgbench or just adjust/replicate the needed small functions/code > excerpts. As the variable infrastructures are pretty different between psql & pgbench (typed vs untyped values, sorted array vs linked list data structure, no hook vs 2 hooks, name spaces vs no such thing...), I have chosen the simplest option of just copying the name checking function and extending the lexer to authorize non-ascii letters, so that psql/pgbench would accept the same variable names with the same constraint about encodings. See patch attached & test script. -- Fabien.
Commits
-
pgbench: Remove \cset
- 25ee70511ec2 12.0 landed
-
pgbench: add \cset and \gset commands
- 6260cc550b0e 12.0 landed
-
Adjust pgbench to allow non-ASCII characters in variable names.
- 9d36a386608d 11.0 landed
-
Refactor script execution state machine in pgbench.
- 12788ae49e19 10.0 cited
-
Allow empty queries in pgbench.
- 6471045230f5 10.0 cited