Debian Codegraph @

README.md

raw symbols SCIP
1 # harlequin-postgres
2
3 This project provides the Harlequin adapter for Postgres. For more information, see [harlequin.sh](https://harlequin.sh/docs/postgres/index).
4
5
6 ## Installation
7
8 You must install the `harlequin-postgres` package into the same environment as `harlequin`. The best and easiest way to do this is to use `uv` to install Harlequin with the `postgres` extra:
9
10 ```bash
11 uv tool install 'harlequin[postgres]'
12 ```
13
14 ## Using Harlequin with Postgres
15
16 To connect to a Postgres database, run Harlequin with the `-a postgres` option and pass a [Posgres DSN](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING) as an argument:
17
18 ```bash
19 harlequin -a postgres "postgres://my-user:my-pass@localhost:5432/my-database"
20 ```
21
22 ## Connection Options
23
24 You can also pass all or parts of the connection string as separate options. The following is equivalent to the above DSN:
25
26 ```bash
27 harlequin -a postgres -h localhost -p 5432 -U my-user --password my-pass -d my-database
28 ```
29
30 The supported connection options are:
31
32 ```
33 host
34 port
35 dbname
36 user
37 password
38 passfile
39 require_auth
40 channel_binding
41 connect_timeout
42 sslmode
43 sslcert
44 sslkey
45 ```
46
47 For descriptions of each option, run:
48
49 ```
50 harlequin --help
51 ```
52
53 ## Read-Only Mode
54
55 This adapter supports Harlequin's `--read-only` option:
56
57 ```bash
58 harlequin --read-only -a postgres "postgres://my-user:my-pass@localhost:5432/my-database"
59 ```
60
61 Every connection this adapter opens is configured with `set session characteristics as transaction read only`, so the server rejects any statement that would write, in both Auto and Manual transaction modes. If the server does not report `default_transaction_read_only` as `on` after connecting, Harlequin refuses to start.
62
63 ## Catalog Search
64
65 This adapter implements `search_catalog()`, so you can find an object without walking the catalog a level at a time:
66
67 ```bash
68 hsql -a postgres "postgres://my-user:my-pass@localhost:5432/my-database" --catalog-search orders
69 ```
70
71 A term matches a database, schema, relation, or column whose name contains it, case-insensitively. Relations and columns come from the connected database, since that is the database the catalog shows them for; the other databases on the server are matched by name, which is all the catalog's top level shows for them.
72
73 ## Environment Variables
74
75 Harlequin's Postgres driver will load connection information from the standard `PG*` environment variables. Any options supplied at the command-line will override environment variables.
76
77
78 ## Manual Transactions
79
80 To use Manual transaction mode, click on the label in the Run Query Bar to toggle the transaction mode from Auto to Manual.
81
82 ## Further Documentation
83
84 For more information, see the [Harlequin Docs](https://harlequin.sh/docs/postgres/index).