Re: pgbench post-connection command - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pgbench post-connection command
Date
Msg-id 23944.1326389535@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgbench post-connection command  (Simon Riggs <simon@2ndQuadrant.com>)
Responses Re: pgbench post-connection command
List pgsql-hackers
Simon Riggs <simon@2ndQuadrant.com> writes:
> On Thu, Jan 12, 2012 at 4:24 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I don't believe that works for multiple \set commands, which is the
>> more likely use-case for this; as noted upthread, executing SET here
>> is quite unnecessary since you can get that behavior with
>> "export PGOPTIONS".

> OK, so you want...

> \setonce <command>

More like "\once ... any SQL command or meta command here ..."
if we want to extend the scripting language.  But I'd be perfectly happy
with a command-line switch that specifies a script file to be run once.

A difficulty with \once is that it's not very clear what should happen
in the case of multiple scripts (multiple -f switches).  Should we go
through all of them at startup looking for \once switches?  Or should
it happen the first time a given script is selected for execution?
And do conflicting \once \sets in different scripts affect each other?
If we go with a command-line switch then the confusion goes away, as it
is then clear that the start script's settings should be inherited by
all the client tasks.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Florian Pflug
Date:
Subject: Re: Remembering bug #6123
Next
From: Josh Berkus
Date:
Subject: Re: Sending notifications from the master to the standby