Home > Software engineering >  Why does psql only works when I pass in a string?
Why does psql only works when I pass in a string?

Time:10-21

This fails with tlsv1 alert unknown ca

psql -h localhost -p 4566 -d dev -U root --set=sslmode=disable

This works:

psql "port=4566 host=localhost user=root dbname=dev sslmode=disable"

Why? Why does one work when the other does not? Is the --set ignored?

Is this a bug or a feature?

CodePudding user response:

The --set is not ignored, it just doesn't do anything meaningful. It tells psql to set the psql variable named 'sslmode', but that variable is not in charge of anything. If you could connect and you then ran select :'sslmode';, you find that it had indeed been set, but since it isn't in charge of anything this doesn't really matter much.

TheA way to do this correctly, assuming you are using bash, is:

PGSSLMODE=disable psql -h localhost -p 4566 -d dev -U root
  • Related