-
Notifications
You must be signed in to change notification settings - Fork 14
Enhance the behavior of obtaining default schema through database con… #32
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
Conversation
…nection string by specifying the default schema through the SearchPath parameter in the connection string
| /// </summary> | ||
| public static class PostgresqlExtensions | ||
| { | ||
| private static readonly string pattern= @"(?i)SearchPath=([^;]+)"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to https://www.postgresql.org/docs/current/ddl-schemas.html
Default search path would be:
"$user", public
Normally to customize search path one would use:
SET search_path TO myschema,public;
In both cases search path contains multiple schemas delimited by comma.
This regex does not seem to respect multiple schemas in search path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method only processes connection strings and does not support this parameter like 'search_path' in connection strings. If this parameter is not set, the database will default to reading public
| /// </summary> | ||
| public static class PostgresqlExtensions | ||
| { | ||
| private static readonly string pattern= @"(?i)SearchPath=([^;]+)"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to https://www.npgsql.org/doc/connection-string-parameters.html parameter should be named "Search Path" and not "SearchPath"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Common connection strings, like this
"Server=xxxx;Port=xxx;Database=xxx;User Id=xxxx;Password=xxxx;Pooling=false;Search Path=xxxx;IncludeErrorDetail=true;"
The schema parameters support SearchPath and Search Path and ignore case.
I modified the regular expression to support the above parameter types.
Enhance the behavior of obtaining default schema through database connection string by specifying the default schema through the SearchPath parameter in the connection string