pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Stephen Frost <sfrost@snowman.net>
Cc: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Cc: PostgreSQL Developers <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] pgbench - allow to store select results into variables
Date: Sat, 17 Nov 2018 08:06:54 -0300
Message-ID: <20181117110654.ekd2duiss4lwph6y@alvherre.pgsql> (raw)
In-Reply-To: <alpine.DEB.2.21.1811171127180.16105@lancre>

On 2018-Nov-17, Fabien COELHO wrote:

> 
> > I think this patch's Command->lines would benefit from using PQExpBuffer
> > (or maybe StringInfo?) for the command string instead of open-coding
> > string manipulation and allocation.
> 
> Indeed it could be used, but it is not used anywhere in "pgbench": not for
> lines, not for variable subtitutions, not for the PREPARE stuff... So I did
> not think that it was time to start, I just kept the current style.
> 
> Probably it could be a refactoring patch to replace all basic string stuff
> with PQExpBuffer infrastructure within pgbench.

Well, I think command handling was mostly straightforward before, but
it's not as straightforward after your patch.  Also, PQExpBuffer is
already in use in pgbench when interacting with the lexer, so yeah I
think we should fix that.  I don't think we should replace *ALL* string
handling in pgbench with PQExpBuffer, just the command stuff.


> > I'm not sure that Command->first_line is really all that useful.  It
> > seems we go to a lot of trouble to keep it up to date.  Isn't it easier
> > to chop Command->lines at the first newline when it is needed?
> 
> Hmmm, it is needed quite often (about 12 times) to report errors, that would
> mean having to handle the truncation in many places, so I felt it was worth
> the trouble.

Ok, as long as we don't repeat the work during script execution.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




view thread (120+ messages)  latest in thread

Message-ID: <20181117110654.ekd2duiss4lwph6y@alvherre.pgsql>
Permalink:  ../20181117110654.ekd2duiss4lwph6y@alvherre.pgsql/
Also on:    postgresql.org/message-id/20181117110654.ekd2duiss4lwph6y@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@2ndquadrant.com, coelho@cri.ensmp.fr, michael@paquier.xyz, sfrost@snowman.net, andrew.dunstan@2ndquadrant.com
  Subject: Re: [HACKERS] pgbench - allow to store select results into variables
  In-Reply-To: <20181117110654.ekd2duiss4lwph6y@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox