Differences from psql

View as Markdown

-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

psqlhsql
-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-1write begin and commit in your script
-oa file for query outputa file, or a directory that gets one file per result set
Connection flags-h, -p, -U, built inthe adapter’s, so hsql --help -a postgres lists them
Row limitsnone500 rows by default; --limit -1 removes it
Suppressing chatter-qnothing to suppress: stdout is only ever results
Exit codes1 its own error, 2 connection, 3 script error1 query error, 2 usage/config, 3 connection, 4 timeout
lightbulb icon Warning

-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--catalog and --catalog-search, which produce ordinary result sets.
  • \copy--csv and -o, or --format parquet.
  • \timing--stats, which reports elapsed_ms on 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.