From ee9a1dcaee1679a1e8815471277f4254450e22b8 Mon Sep 17 00:00:00 2001 From: Song Gao Date: Tue, 12 Dec 2023 13:44:16 +0800 Subject: [PATCH] fix: fix pgsql lookup sql (#2476) Signed-off-by: yisaer --- extensions/sources/sql/ext/sqlLookup.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extensions/sources/sql/ext/sqlLookup.go b/extensions/sources/sql/ext/sqlLookup.go index 6c40dd62a9..0d4f84a5a1 100644 --- a/extensions/sources/sql/ext/sqlLookup.go +++ b/extensions/sources/sql/ext/sqlLookup.go @@ -144,9 +144,9 @@ func (g defaultSQLGen) buildQuery(fields []string, keys []string, values []inter return query } -type sqlServerSQLGen struct{ table string } +type noQuoteSQLGen struct{ table string } -func (g sqlServerSQLGen) buildQuery(fields []string, keys []string, values []interface{}) string { +func (g noQuoteSQLGen) buildQuery(fields []string, keys []string, values []interface{}) string { query := "SELECT " if len(fields) == 0 { query += "*" @@ -175,8 +175,8 @@ func (g sqlServerSQLGen) buildQuery(fields []string, keys []string, values []int func (s *sqlLookupSource) buildQuery(fields []string, keys []string, values []interface{}) string { switch strings.ToLower(s.driver) { - case "sqlserver", "mssql": - return sqlServerSQLGen{table: s.table}.buildQuery(fields, keys, values) + case "sqlserver", "mssql", "postgres": + return noQuoteSQLGen{table: s.table}.buildQuery(fields, keys, values) default: return defaultSQLGen{table: s.table}.buildQuery(fields, keys, values) }