Using the SQL terminal
When you open the SQL Terminal, there's an empty query field awaiting your input.
Type a query and hit ⌘⏎ to execute it.
The SQL Terminal has a very dynamic user interface. The query field automatically increases in size to accomodate multi-line queries. Status and error messages are displayed with informative icons. Tabular query results are displayed graphically, with resizable columns.
PG Commander tries to combine the best features of graphical and text based clients. Similar to a shell, queries and results are displayed in a list. This allows you to quickly try different variations of your query. Simply scroll up to see the results of previous queries.
When your list becomes too long, hit ⌘L to clear the terminal.
Query History
PG Commander remembers the last 1000 executed queries. Hit ⌘⎇← and ⌘⎇→ to move backward and forward. Query history is stored separately for each favorite. Only queries smaller than 100KB are stored in the query history to avoid filling up disk space.
Exporting & the COPY command
The easiest way to export data is the convenient little “Export…” button next to each query result. Click it to export save the rows as a CSV file.
PG Commander also supports PostgreSQL's COPY command. Using COPY, you can import and export data in a variety of formats. Usually, COPY works with file on the server. To work with files on your local machine, use COPY ... FROM STDIN or COPY ... TO STDOUT. Then PG Commander will open a dialog and ask you to select an input file, or provide an output file name.
For example, to export a table named ‘users’ as a tab seperated text file, type:
COPY users TO STDOUT
Then PG Commander will prompt you for a file name, and then write the contents of the ‘users’ table to this file.
For more details see the PostgreSQL docs for the COPY command.