From 8e06863df1e2a39b57a90678a23af44146f6542d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Nieto?= <jose.carlos@menteslibres.net> Date: Tue, 10 Jun 2014 20:25:59 -0500 Subject: [PATCH] Adding table_catalog to columns condition. --- postgresql/database.go | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/postgresql/database.go b/postgresql/database.go index 44912553..9cf8c988 100644 --- a/postgresql/database.go +++ b/postgresql/database.go @@ -330,13 +330,13 @@ func (self *Source) tableExists(names ...string) error { rows, err := self.doQuery(sqlgen.Statement{ Type: sqlgen.SqlSelect, - Table: sqlgen.Table{"information_schema.tables"}, + Table: sqlgen.Table{`information_schema.tables`}, Columns: sqlgen.Columns{ - {"table_name"}, + {`table_name`}, }, Where: sqlgen.Where{ - sqlgen.ColumnValue{sqlgen.Column{"table_catalog"}, "=", sqlPlaceholder}, - sqlgen.ColumnValue{sqlgen.Column{"table_name"}, "=", sqlPlaceholder}, + sqlgen.ColumnValue{sqlgen.Column{`table_catalog`}, `=`, sqlPlaceholder}, + sqlgen.ColumnValue{sqlgen.Column{`table_name`}, `=`, sqlPlaceholder}, }, }, self.config.Database, name) @@ -383,19 +383,16 @@ func (self *Source) Collection(names ...string) (db.Collection, error) { rows, err := self.doQuery(sqlgen.Statement{ Type: sqlgen.SqlSelect, - Table: sqlgen.Table{"information_schema.columns"}, + Table: sqlgen.Table{`information_schema.columns`}, Columns: sqlgen.Columns{ - {"column_name"}, - {"data_type"}, + {`column_name`}, + {`data_type`}, }, Where: sqlgen.Where{ - sqlgen.ColumnValue{ - sqlgen.Column{"table_name"}, - "=", - sqlPlaceholder, - }, + sqlgen.ColumnValue{sqlgen.Column{`table_catalog`}, `=`, sqlPlaceholder}, + sqlgen.ColumnValue{sqlgen.Column{`table_name`}, `=`, sqlPlaceholder}, }, - }, name) + }, self.config.Database, name) if err != nil { return nil, err -- GitLab