diff --git a/dialect_postgres.go b/dialect_postgres.go index 2b2a0b78..f2858f19 100644 --- a/dialect_postgres.go +++ b/dialect_postgres.go @@ -769,6 +769,8 @@ var ( DefaultPostgresSchema = "public" ) +const postgresPublicSchema = "public" + type postgres struct { core.Base } diff --git a/engine.go b/engine.go index 0eff164a..29415cae 100644 --- a/engine.go +++ b/engine.go @@ -551,7 +551,7 @@ func (engine *Engine) tbSchemaName(v string) string { // Only for postgres database. if engine.dialect.DBType() == core.POSTGRES && engine.dialect.URI().Schema != "" && - engine.dialect.URI().Schema != DefaultPostgresSchema && + engine.dialect.URI().Schema != postgresPublicSchema && strings.Index(v, ".") == -1 { return engine.dialect.URI().Schema + "." + v }