From 4ed8bf352738816f80b1e2b3e1a112422fe2ffd4 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Tue, 24 Mar 2020 09:42:37 +0800 Subject: [PATCH] Fix postgres schema problem --- dialects/dialect.go | 5 ----- dialects/postgres.go | 4 ---- dialects/table_name.go | 1 - 3 files changed, 10 deletions(-) diff --git a/dialects/dialect.go b/dialects/dialect.go index a3328e05..4bc220ce 100644 --- a/dialects/dialect.go +++ b/dialects/dialect.go @@ -43,7 +43,6 @@ type Dialect interface { URI() *URI SQLType(*schemas.Column) string FormatBytes(b []byte) string - DefaultSchema() string IsReserved(string) bool Quoter() schemas.Quoter @@ -83,10 +82,6 @@ func (b *Base) Quoter() schemas.Quoter { return b.quoter } -func (b *Base) DefaultSchema() string { - return "" -} - func (b *Base) Init(dialect Dialect, uri *URI) error { b.dialect, b.uri = dialect, uri return nil diff --git a/dialects/postgres.go b/dialects/postgres.go index a83c3a5c..cd4751a5 100644 --- a/dialects/postgres.go +++ b/dialects/postgres.go @@ -817,10 +817,6 @@ func (db *postgres) SetQuotePolicy(quotePolicy QuotePolicy) { } } -func (db *postgres) DefaultSchema() string { - return postgresPublicSchema -} - func (db *postgres) SQLType(c *schemas.Column) string { var res string switch t := c.SQLType.Name; t { diff --git a/dialects/table_name.go b/dialects/table_name.go index a989b386..e190cd4b 100644 --- a/dialects/table_name.go +++ b/dialects/table_name.go @@ -18,7 +18,6 @@ func TableNameWithSchema(dialect Dialect, tableName string) string { // Add schema name as prefix of table name. // Only for postgres database. if dialect.URI().Schema != "" && - dialect.URI().Schema != dialect.DefaultSchema() && strings.Index(tableName, ".") == -1 { return fmt.Sprintf("%s.%s", dialect.URI().Schema, tableName) }