I would like the ability to absolutely set parameters/settings in psql
so that our psql scripts could generate predictable output absent a
known or controllable initial state. Original discussion at bottom of
One alternate and easier approach I've thought of is to simply add
something akin to a \factory-reset meta-command which would return all
settings to the state they would be in immediately after starting psql
with the --no-psqlrc option. This would at least provide one solution to
the problem and might be a handy meta-command even if absolute settings
If a "factory reset" meta-command were added I think that \o should be
exempted as it is already an absolute setting that can be predictably
used in scripts and, where output redirection isn't specified in the
script, we shouldn't interfere with the ability to save the output of a
script or scripts as the user desires.
Peter Eisentraut wrote:
> Steve Crawford wrote:
>> We create psql scripts that can be used at various times by various
>> users. I have been unable to find how to absolutely set various
>>options (timing, expanded, etc.) rather than toggle them.
>> The --no-psqlrc option provides a partial workaround - as long as
>> the user remembers to include it and as long as they are only
>> running the one script. But if they forget or if they are already
>> running a session there is no telling what settings have been
>> toggled by previously run scripts or the users themselves.
>> So...have I overlooked an interactive psql option that will let me
>> reset all options to "factory-defaults" or a method of specifying an
>> absolute setting to the various options?
> Probably not.
>> If not, do psql users out there feel this is worth a feature request?
> I think so.
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend