Re: pgbench - allow backslash-continuations in custom scripts

Поиск
Список
Период
Сортировка
От Kyotaro HORIGUCHI
Тема Re: pgbench - allow backslash-continuations in custom scripts
Дата
Msg-id 20150904.141114.155567080.horiguchi.kyotaro@lab.ntt.co.jp
обсуждение исходный текст
Ответ на Re: pgbench - allow backslash-continuations in custom scripts  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Ответы Re: pgbench - allow backslash-continuations in custom scripts  (Fabien COELHO <coelho@cri.ensmp.fr>)
Список pgsql-hackers
Hello, Thank you for registering this to CF-Sep.
I missed the regtration window.. It ended earlier than usual..

Most troubles have gone and I'll be back next week.

> The work to be left is eliminating double-format of Command
> struct.

This is done as the additional fourth patch, not merged into
previous ones, to show what's changed in the manner of command
storing.

I repost on this thread the new version of this patch including
this and posted before. This is rebased to current master.

The changes in behaviors brought by this patch has been described
in the privous mail as the following,

> Hmm. psqlscan.l handles multistatement naturally.
> I worked on that and the attached patche set does,
> 
>  - backslash continuation for pgbench metacommands.
> 
>    set variable \
>        <some value>
> 
>  - SQL statement natural continuation lines.
> 
>    SELECT :foo
>     FROM  :bar;
> 
>  - SQL multi-statement.
> 
>    SELECT 1; SELECT 2;

Each of the four patches does the following thigs,

1. 0001-Prepare-to-share-psqlscan-with-pgbench.patch
 The global variable pset, VariableSpace and backslash syntax of psql are the obstacles for psqlscan.l from being used
bypgbench.  This patch eliminates direct reference to pset and masks VariableSpace feature (looks ugry..), and enables
backslashsyntax in psqlscan.l to be hidden from outside psql by defining the symbol OUTSIDE_PSQL.
 
 No behavioral changes of pasql are introduced by ths patch.

2. 0002-Make-use-of-psqlscan-for-parsing-of-custom-script.patch
 This is the core of this patch, which makes pgbench to use psqlscan.l and enables multi-statements,
multiline-SQL-statementand backslash-continuation of metacommands.
 
 The struct Command is modified that it can be chained in order to convey multistatement in one line. But the commands
arestored in an array of Command just outside process_commands as of old. This double-formatting will be removed by the
fourthpatch.
 
 psqlscan.c is compiled as a part of mainloop.c for some reason described at the end of the file. I haven't confirmed
thatthe same thing will happen in pgbench, but I did the same thing for pgbenc.c.
 
 Compilation will fail on Windows as of this patch.

3. 0003-Change-MSVC-Build-script.patch
 Changes the build script for Windows platform. It certainly works but might look a bit odd because of the anormaly of
thecompilation way of psqlscan.l
 

4. 0004-Change-the-way-to-hold-command-list.patch
 Changes the way to hold commad list from an array to linked list, to remove the double formatting of Command-list
introducedby the second patch. This removes the explicit limitation on the number of commands in scripts, as a
side-effect.


regards,

-- 
Kyotaro Horiguchi
NTT Open Source Software Center

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Langote
Дата:
Сообщение: Re: BRIN INDEX value
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Allow replication roles to use file access functions