Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specific schema using connection string #1013

Closed
nvcnvn opened this issue May 19, 2021 · 2 comments
Closed

Specific schema using connection string #1013

nvcnvn opened this issue May 19, 2021 · 2 comments

Comments

@nvcnvn
Copy link

nvcnvn commented May 19, 2021

Can I connect to a specific schema using only connection string?

For example a connection string with specific schema:

jdbc:postgresql://localhost:5432/mydatabase?currentSchema=myschema

I guess another option is using connection hooks and set default search path.

@jackc
Copy link
Owner

jackc commented May 22, 2021

You can set the search path in the connection string. e.g. postgresql://example.com/mydatabase?search_path=myschema

@nvcnvn
Copy link
Author

nvcnvn commented May 25, 2021

Ah thanks you, I should check Test for example first:

connString := "postgres://jack:secret@localhost:5432/mydb?application_name=pgxtest&search_path=myschema&connect_timeout=5"
for one who have the same question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants