Differences from psql
-c, -f, -t, -A and -x mean what they mean in psql, so this prints a
bare number in either program:
$ hsql -tAc "select count(*) from orders" It prints it the same way against every adapter, which is the part psql cannot do.
What Is Different
| psql | hsql | |
|---|---|---|
-P | --pset, an output setting | --profile, a config-file profile |
| Field separator | -F | --csv, --format tsv, or any other --format |
| Listing databases | -l | --catalog |
| Describing an object | \d, \dt | --catalog --path, --catalog-search |
| Stopping on the first error | -v ON_ERROR_STOP=1 | --on-error stop, the default |
| One transaction | -1 | write begin and commit in your script |
-o | a file for query output | a file, or a directory that gets one file per result set |
| Connection flags | -h, -p, -U, built in | the adapter’s, so hsql --help -a postgres lists them |
| Row limits | none | 500 rows by default; --limit -1 removes it |
| Suppressing chatter | -q | nothing to suppress: stdout is only ever results |
| Exit codes | 1 its own error, 2 connection, 3 script error | 1 query error, 2 usage/config, 3 connection, 4 timeout |
-t is tuples only, as in psql, not Harlequin’s theme flag. Connection
strings are positional, so hsql -t nord -c "..." parses, nord becomes a
connection string, and hsql says so on stderr.
No Backslash Commands
hsql has no meta-commands. What they do, options do:
\d,\dt,\l—--catalogand--catalog-search, which produce ordinary result sets.\copy—--csvand-o, or--format parquet.\timing—--stats, which reportselapsed_mson stderr.\c— a different profile:-P NAME.\set— the profile, or the command line. One invocation, no session variables.
No Interactive Session
hsql executes what it was passed and exits; there is no prompt. For an
interactive session, Harlequin uses the same
adapters, config files and profiles: harlequin -P prod.