How do I specify the search_path
while connecting to my postgres db using PQconnectdb
? I want to set the search_path
to my_schema
. I'm currently using the following connection command:
PQconnectdb("host=localhost user=my_user password=my_password port=5432 dbname=my_db")
You could add the following to your connection info:
options='-csearch_path=my_schema'
So, it would become:
PQconnectdb("host=localhost user=my_user password=my_password port=5432 dbname=my_db options='-csearch_path=my_schema'")
Reference: