From ffca3e1760c340d49369d825666261343663181c Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Mon, 9 Apr 2018 14:36:24 +0800 Subject: [PATCH] fix: add const value for public scheam name of postgres. --- dialect_postgres.go | 2 ++ engine.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) 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 }