Re: pgbench - allow backslash-continuations in custom scripts

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgbench - allow backslash-continuations in custom scripts
Date: 2016-03-16 15:57:25
Message-ID: CA+Tgmobvu1aBRdRaKvqMVp0ifhQpgvnOEZa2Rg3AHfRWPE5-Tg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 18, 2016 at 6:54 AM, Kyotaro HORIGUCHI <
horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> wrote:

> It is the SQL part of old psqlscan.l but the difference between
> them is a bit bothersome to see. I attached the diff between them
> as "psqlscanbody.l.diff" for convenience.
>

This is a huge diff, and I don't see that you've explained the reason for
all the changes. For example:

-/*
- * We use a stack of flex buffers to handle substitution of psql variables.
- * Each stacked buffer contains the as-yet-unread text from one psql
variable.
- * When we pop the stack all the way, we resume reading from the outer
buffer
- * identified by scanbufhandle.
- */
-typedef struct StackElem
-{
- YY_BUFFER_STATE buf; /* flex input control structure */
- char *bufstring; /* data actually being scanned by
flex *
/
- char *origstring; /* copy of original data, if needed
*/
- char *varname; /* name of variable providing data,
or N
ULL */
- struct StackElem *next;
-} StackElem;

Perhaps we could separate this part of the code motion into its own
preliminary patch? I see this went to psqlscan_int.h, but there's no
obvious reason for that particular name, and the comments don't explain it;
in fact, they say that's psqlscan.h. psqlscan_slash.h has the same
problem; perhaps moving things there could be another preliminary patch.

- yyless(0);
+ my_yyless(0);

Why do we need to do this? Is "my_" really the best prefix? Is this
another change that could be its own patch?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Steele 2016-03-16 16:01:21 Re: [PATCH] Phrase search ported to 9.6
Previous Message David Steele 2016-03-16 15:56:44 Re: Proposal: Generic WAL logical messages