Enhance the behavior of obtaining default schema through database con…#32
Enhance the behavior of obtaining default schema through database con…#32
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.
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.
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.
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.
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