Re: [HACKERS] pgbench - allow to store select results intovariables - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: [HACKERS] pgbench - allow to store select results intovariables
Date
Msg-id alpine.DEB.2.21.1811171127180.16105@lancre
Whole thread Raw
In response to Re: [HACKERS] pgbench - allow to store select results into variables  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: [HACKERS] pgbench - allow to store select results into variables
List pgsql-hackers
> 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.

> 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.

-- 
Fabien.


pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: Re: [HACKERS] pgbench - allow to store select results intovariables
Next
From: Fabien COELHO
Date:
Subject: RE: pgbench - doCustom cleanup