Re: pgbench post-connection command
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Simon Riggs <simon@2ndQuadrant.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2012-01-12T17:32:15Z
Lists: 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