On 3rd of October, Robert Haas committed patch:
psql: Make \pset without arguments show all settings. Gilles Darold, reviewed by Pavel Stehule
I am sucker for psql enhancements. That's mostly because I am using psql all the time, so any bit of change has huge effect on me.
When you're in psql, you have at least three different “set" commands:
- SET – changes settings on server side – so called GUCs
- \pset – changes output formatting of results
- \set – changes behavior of psql, or sets custom variables
For the first and second – we had a way to see all settings – “SHOW ALL" or “\set".
But there was no such way for \pset. Now, we have it (well, we'll have it, once 9.4 will get released).
How this works? That's simple:
$ \pset Border STYLE (border) IS 1. Target width (COLUMNS) unset. Expanded display (expanded) IS off. FIELD separator (fieldsep) IS "|". DEFAULT footer (footer) IS ON. Output format (format) IS aligned. Line STYLE (linestyle) IS ascii. NULL display (NULL) IS "[null]". Locale-adjusted NUMERIC output (numericlocale) IS off. Pager (pager) IS always used. Record separator (recordsep) IS <newline>. TABLE attributes (tableattr) unset. Title (title) unset. Tuples ONLY (tuples_only) IS off.
Is it good? Well, it's definitely better than nothing. I would prefer to get the output like:
Name | Setting | Description ---------------+-------------+-------------------------------- border | 1 | Border STYLE COLUMNS | unset | Target width expanded | off | Expanded display fieldsep | "|" | FIELD separator footer | ON | DEFAULT footer format | aligned | Output format linestyle | ascii | Line STYLE NULL | "[null]" | NULL display numericlocale | off | Locale-adjusted NUMERIC output pager | always used | Pager recordsep | <newline> | Record separator tableattr | unset | TABLE attributes title | unset | Title tuples_only | off | Tuples ONLY
But even as is, it's helpful. Thanks guys.
All data are on client side, so we cannot to use a tabular infrastructure 🙁
+1 for discoverability! As to the tabular format, being client side just means you don’t get it for free w/ reusing the results tabular format.
I have to agree on that the tabular output would be way better. The current output is barely readable.
Why not follow \set and just return:
border = 1
columns = ‘unset’
expanded = ‘off’
Shell scripters will thank you!
Or maybe even json
{
‘border’: 1,
‘columns’: ‘unset’,
‘expanded’: ‘off’
}
Programmers will thank you!
Those informations are psql specific settings. They are variables used to specifies printing options and they are defined at client side. The tabular structure may confuse users because this is the default infrastructure used to display settings or queries results from server side.
I don’t see any interest for programmers to have those informations in a more structured manner. Also unset is not a value, it just says that the variable is not set.
The name of the variable is just recalled into the message for convenience but this is the same message used when a printing option is set. Not sure that we also want a tabular infrastructure to display the result of the variable definition.