-
Notifications
You must be signed in to change notification settings - Fork 13
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
base: release/6.0.0
Are you sure you want to change the base?
Conversation
* Add NpgsqlDataSource support to PostgresqlConnectionManager * Used new GHA workflows * Updated to dbup-core 6.0 beta, targeted netstandard2 and update Npgsql reference * Bump to the next beta of dbup-core * Merge fix * Removed stray #If * fix: #680 PostgreSQL statements split implemented (DbUp#19) * fix: #680 PostgreSQL statements split implemented Co-authored-by: shokurov <[email protected]> * Updated approval file --------- Co-authored-by: shokurov <[email protected]> Co-authored-by: Robert Wagner <[email protected]> * Update of libs * File scoped namespaces and primary ctors * Target `net8` so we can use the latest version of Npgsql (DbUp#24) * Target net8 so we can use the latest version of Npgsql * Used new APIs * Added Npgsql licence information (DbUp#25) * fix(DbUp#26): avoid NullReferenceException when creating database (DbUp#27) * fix(DbUp#26): avoid NullReferenceException when creating database * Updated approval file --------- Co-authored-by: Robert Wagner <[email protected]> * fix: fix delimiter parsing (DbUp#28) * Lowered Connection string printing to debug, resolves DbUp#30 --------- Co-authored-by: Sébastien Crocquesel <[email protected]> Co-authored-by: Campbell Harding-Deason <[email protected]> Co-authored-by: shokurov <[email protected]> Co-authored-by: nvierge-addactis <[email protected]>
…nection string by specifying the default schema through the SearchPath parameter in the connection string
@@ -15,6 +16,7 @@ | |||
/// </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
@@ -15,6 +16,7 @@ | |||
/// </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