Closed rdsedmundo closed 3 years ago
You need dsn to connect to the database.
trdsql -driver postgres -dsn 'host=localhost port=5432 dbname=postgres' -ih -ocsv "SELECT * FROM file.csv WHERE lpad(a, 9, '0') != replace(b, '-', '') LIMIT 10"
UNIX Domain Socket
trdsql -driver postgres -dsn 'host=/var/run/postgresql/ port=5432 dbname=postgres' -ih -ocsv "SELECT * FROM file.csv WHERE lpad(a, 9, '0') != replace(b, '-', '') LIMIT 10"
See https://pkg.go.dev/github.com/lib/pq#hdr-Connection_String_Parameters for more information.
You can also disable sslmode in dsn(sslmode=disable
).
Thanks, I ended up using PGSSLMODE=disable
env var to control it so I can just pass -driver postgres
.
I'm not sure what I'm supposed to do here. I just wanted to use the
lpad
function thus I added the-driver
option. Setting up SSL on a localhost instance seems overkill.