JuliaDatabases / LibPQ.jl

A Julia wrapper for libpq
MIT License
217 stars 51 forks source link

Use PG environment variables to complement connection string in Connection #303

Closed markmnl closed 2 months ago

markmnl commented 2 months ago

Attempting to use the PG environment variables https://www.postgresql.org/docs/current/libpq-envars.html, e.g.:

$ set | grep PG
PGDATABASE=timescale
PGHOST=localhost
PGPASSWORD=xxx
PGPORT=5434
PGUSER=aaa

I expected to LibPQ.Connection("") to use these vars that weren't supplied in connection string. However it seems they are not.

Am I missing something or does LibPQ.Connection() not use environment?

markmnl commented 2 months ago

Funnily enough export ing my PG vars again seem to solve the issue and LibPQ.Connection() does in indeed use them. Still unsure what happened before even though I could see the vars with set command but I guess its not a problem with LibPQ!