Josh Berkus <josh@agliodbs.com> writes:
> Tom,
>
>> If you're proposing changing the contents of the default prompt, I think
>> that has very little chance of passing. A new option for something to
>> add into a custom prompt might get accepted. I'm not sure that that
>> approach would do much for the scenario you describe, since it's
>> unlikely that anyone would add it to their prompt (at least not before
>> they'd gotten burnt...). However, I don't recall hearing of anyone
>> getting confused like this before, and you say you figured it out pretty
>> quickly, so it doesn't seem like a big problem.
>
> Well, I think having a \ command to show the current \o setting would be
> fine. Actually, it might be better to show *all* psql settings with a
> general command, including things like \timing and \pset.
Actually in my case, I've also used \t and \a psql commands to produce
undecorated machine-readable output and now I think it would be nice to
also show the status of these in the prompt. What if we add '%\'
substitute to expand to the list of all settings with non-default
values? Like this:
postgres=# \set PROMPT1 '%/%\%R%# '
postgres=# -- Nothing is set, so '%\' expands to an empty string.
postgres=# \t
Showing only tuples.
postgres\t=# \a
Output format is unaligned.
postgres\a\t=# \o /path/to/output/file.out
postgres\a\o=/path/to/output/file.out\t=#
Not sure how \pset could fit there, it might be a bit excessive.
Another idea is we could add \O and \G commands that will act like the
plain \o and \g, but will set \a and \t automatically. I mean it must
be quite often that you don't need all the decoration when you save
query results to a file, so instead of doing \a, \t, \g (then setting \a
and \t back) you can just do \G and move on.
--
Alex