postgresql - psql - save results of command to a file -


I am using \ dt of psql to list all the tables in the database . I need to save the result in the file.

I'm sure I did this before but can not remember the syntax.

Thank you.

Div>

With the help of psql ( \? ):

\ o [FILE] All query results file or. Send pipe

The sequence of commands will look like this:

  [wist @ scifres ~] $ psql Db Welcome to psql 8.3.6, PostgreSQL interactive terminal DB = & gt; \ O Out.Tech DB = & gt; \ Dt db = & gt; \ Q [wist @ scifres ~] $    

Comments