pgbench-continuation-5.patch
text/x-diff
Filename: pgbench-continuation-5.patch
Type: text/x-diff
Part: 0
Patch
Format: unified
| File | + | − |
|---|---|---|
| doc/src/sgml/ref/pgbench.sgml | 3 | 1 |
| src/bin/pgbench/exprscan.l | 10 | 0 |
diff --git a/doc/src/sgml/ref/pgbench.sgml b/doc/src/sgml/ref/pgbench.sgml
index 3fb29f8..eb0e8ac 100644
--- a/doc/src/sgml/ref/pgbench.sgml
+++ b/doc/src/sgml/ref/pgbench.sgml
@@ -810,6 +810,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<para>
Script file meta commands begin with a backslash (<literal>\</>) and
extend to the end of the line.
+ They can spread over several lines with backslash-return continuations.
Arguments to a meta command are separated by white space.
These meta commands are supported:
</para>
@@ -838,7 +839,8 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
Examples:
<programlisting>
\set ntellers 10 * :scale
-\set aid (1021 * random(1, 100000 * :scale)) % (100000 * :scale) + 1
+\set aid (1021 * random(1, 100000 * :scale)) % \
+ (100000 * :scale) + 1
</programlisting></para>
</listitem>
</varlistentry>
diff --git a/src/bin/pgbench/exprscan.l b/src/bin/pgbench/exprscan.l
index 9a3be3d..ec58ae3 100644
--- a/src/bin/pgbench/exprscan.l
+++ b/src/bin/pgbench/exprscan.l
@@ -65,6 +65,7 @@ alnum [a-zA-Z0-9_]
space [ \t\r\f\v]
nonspace [^ \t\r\f\v\n]
newline [\n]
+continuation \\{newline}
/* Exclusive states */
%x EXPR
@@ -90,6 +91,11 @@ newline [\n]
/* INITIAL state */
+{nonspace}+{continuation} {
+ /* Found "word\\\n", just emit word and return it */
+ psqlscan_emit(cur_state, yytext, yyleng-2);
+ return 1;
+ }
{nonspace}+ {
/* Found a word, emit and return it */
psqlscan_emit(cur_state, yytext, yyleng);
@@ -104,6 +110,8 @@ newline [\n]
return 0;
}
+{continuation} { /* ignore */ }
+
/* EXPR state */
<EXPR>{
@@ -138,6 +146,8 @@ newline [\n]
return FUNCTION;
}
+{continuation} { /* ignore */ }
+
{newline} {
/* report end of command */
last_was_newline = true;