From 398f577dcca60f907edf6641012c3c20bfb1e163 Mon Sep 17 00:00:00 2001 From: Vitya Date: Thu, 15 Feb 2018 10:42:19 +0300 Subject: [PATCH] solution for issue #3949 use server_version_num instead of parsing the text version. See: https://www.postgresql.org/docs/10/static/functions-info.html --- physical/postgresql/postgresql.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/physical/postgresql/postgresql.go b/physical/postgresql/postgresql.go index d54598f34674..cc75e8e3056f 100644 --- a/physical/postgresql/postgresql.go +++ b/physical/postgresql/postgresql.go @@ -71,7 +71,7 @@ func NewPostgreSQLBackend(conf map[string]string, logger log.Logger) (physical.B // Determine if we should use an upsert function (versions < 9.5) var upsert_required bool - upsert_required_query := "SELECT string_to_array(setting, '.')::int[] < '{9,5}' FROM pg_settings WHERE name = 'server_version'" + upsert_required_query := "SELECT current_setting('server_version_num')::int < 90500" if err := db.QueryRow(upsert_required_query).Scan(&upsert_required); err != nil { return nil, fmt.Errorf("failed to check for native upsert: %v", err) }