From 0b841796fa51b91b58f1ca2da65cf4b5af470c75 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Mon, 9 Apr 2018 14:57:11 +0800 Subject: [PATCH] fix: add const value for public scheam name of postgres. (#877) --- 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 }