Peter Eisentraut wrote:
> We need a function like this in the main line. The "show all" variety
> isn't top priority, but we need something that gets you the "show" result
> as a query output. The original idea was to make SHOW return a query
> result directly, but a function is fine with me too.
>
Originally I wrote this as "showvars(varname)" and accepted 'all' in a
similar fashion to SHOW ALL. But it seemed redundant since you can still do:
test=# select * from showvars() where varname = 'wal_sync_method'; varname | varval
-----------------+----------- wal_sync_method | fdatasync
(1 row)
but you can also do:
test=# select * from showvars() where varname like 'show%'; varname | varval
---------------------+-------- show_executor_stats | off show_parser_stats | off show_planner_stats | off
show_query_stats | off show_source_port | off
(5 rows)
which also seemed useful.
I was thinking that if we wanted to replace SHOW X with this, it could
be done in the parser by rewriting it as "SELECT * FROM showvars() WHERE
varname = 'X'", or for SHOW ALL just "SELECT * FROM showvars()".
In any case, I'll fit the showvars() function into the backend and
submit a patch.
Thanks,
Joe