Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I specify the schema in a URI with psql?

When connecting to a database with psql I can specify the database using a URI:

psql postgres://user:pass@hostname/my_db

But how do I specify the schema?

like image 697
Tamlyn Avatar asked Oct 19 '25 23:10

Tamlyn


1 Answers

You can specify it using the options query parameter:

psql "postgres://user:pass@hostname/my_db?options=--search_path%3Dmy_schema"

%3D is a URL encoded = sign. It has to be URL encoded or psql gets confused.

like image 145
Tamlyn Avatar answered Oct 22 '25 00:10

Tamlyn