Update pgsql

This commit is contained in:
sunkaixuan
2025-04-21 20:08:27 +08:00
parent 381b8d1024
commit e516f7103d

View File

@@ -603,23 +603,45 @@ WHERE tgrelid = '"+tableName+"'::regclass");
private string GetSchema() private string GetSchema()
{ {
var schema = "public"; var schema = "public";
if (System.Text.RegularExpressions.Regex.IsMatch(this.Context.CurrentConnectionConfig.ConnectionString.ToLower(), "searchpath=")) var pgSqlIsAutoToLowerSchema = this.Context?.CurrentConnectionConfig?.MoreSettings?.PgSqlIsAutoToLowerSchema == false;
if (pgSqlIsAutoToLowerSchema)
{ {
var regValue = System.Text.RegularExpressions.Regex.Match(this.Context.CurrentConnectionConfig.ConnectionString.ToLower(), @"searchpath\=(\w+)").Groups[1].Value; if (System.Text.RegularExpressions.Regex.IsMatch(this.Context.CurrentConnectionConfig.ConnectionString, "searchpath=", RegexOptions.IgnoreCase))
if (regValue.HasValue())
{ {
schema = regValue; var regValue = System.Text.RegularExpressions.Regex.Match(this.Context.CurrentConnectionConfig.ConnectionString, @"searchpath\=(\w+)").Groups[1].Value;
if (regValue.HasValue())
{
schema = regValue;
}
}
else if (System.Text.RegularExpressions.Regex.IsMatch(this.Context.CurrentConnectionConfig.ConnectionString, "search path=", RegexOptions.IgnoreCase))
{
var regValue = System.Text.RegularExpressions.Regex.Match(this.Context.CurrentConnectionConfig.ConnectionString.ToLower(), @"search path\=(\w+)").Groups[1].Value;
if (regValue.HasValue())
{
schema = regValue;
}
} }
} }
else if (System.Text.RegularExpressions.Regex.IsMatch(this.Context.CurrentConnectionConfig.ConnectionString.ToLower(), "search path=")) else
{ {
var regValue = System.Text.RegularExpressions.Regex.Match(this.Context.CurrentConnectionConfig.ConnectionString.ToLower(), @"search path\=(\w+)").Groups[1].Value; if (System.Text.RegularExpressions.Regex.IsMatch(this.Context.CurrentConnectionConfig.ConnectionString.ToLower(), "searchpath="))
if (regValue.HasValue())
{ {
schema = regValue; var regValue = System.Text.RegularExpressions.Regex.Match(this.Context.CurrentConnectionConfig.ConnectionString.ToLower(), @"searchpath\=(\w+)").Groups[1].Value;
if (regValue.HasValue())
{
schema = regValue;
}
}
else if (System.Text.RegularExpressions.Regex.IsMatch(this.Context.CurrentConnectionConfig.ConnectionString.ToLower(), "search path="))
{
var regValue = System.Text.RegularExpressions.Regex.Match(this.Context.CurrentConnectionConfig.ConnectionString.ToLower(), @"search path\=(\w+)").Groups[1].Value;
if (regValue.HasValue())
{
schema = regValue;
}
} }
} }
return schema; return schema;
} }
private static void ConvertCreateColumnInfo(DbColumnInfo x) private static void ConvertCreateColumnInfo(DbColumnInfo x)