On 2022-02-12 13:23:39 -0800, Adrian Klaver wrote:
> On 2/12/22 13:17, Peter J. Holzer wrote:
> > A shell could also provide an "expand select list" function using
> > explain.
> >
> > In fact, you can sort of do that manually:
> >
> > 1) Prefix your query with explain(verbose)
> > 2) Copy the "Output:" line of the top node.
> > 3) Edit your query, remove the explain(verbose) and replace the select
> > list with the content of the clipboard
> > 4) (optional) remove any unwanted columns
>
> Or:
>
> \pset format csv
>
> select * from cell_per limit 0;
>
> line_id,category,cell_per,ts_insert,ts_update,user_insert,user_update,plant_type,season,short_category
Good idea. Even better:
select * from cell_per limit 0 \g (format=csv)
Saves you having to stash the query somewhere.
(You still have to look out for duplicate column names, though)
hp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"