2

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")

1 Answer 1

4

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:

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.