Reputation: 41
I have to create a script that saves the output of my command to a HTML file. I got something like that:
\o file.html
\pset format html
SELECT * FROM clients;
\o
It works pretty well, but the problem is that it changes my format to HTML while I'm in classic mode. Is there any easy way to just export the output of the SELECT
statement in HTML format without turning on HTML mode permanently?
Upvotes: 1
Views: 517
Reputation: 247865
You can do that by replacing the semicolon with the appropriate \g
directive:
SELECT * FROM clients \g (format=html) file.html
Upvotes: 3