Browse Source

add const value for public scheam name of postgres

xormplus 7 years ago
parent
commit
23ae16d3cf
2 changed files with 3 additions and 1 deletions
  1. 2 0
      dialect_postgres.go
  2. 1 1
      engine.go

+ 2 - 0
dialect_postgres.go

@@ -769,6 +769,8 @@ var (
 	DefaultPostgresSchema = "public"
 )
 
+const postgresPublicSchema = "public"
+
 type postgres struct {
 	core.Base
 }

+ 1 - 1
engine.go

@@ -560,7 +560,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
 	}