Skip to content

Commit

Permalink
solution for issue hashicorp#3949
Browse files Browse the repository at this point in the history
use server_version_num instead of parsing the text version. See: https://www.postgresql.org/docs/10/static/functions-info.html
  • Loading branch information
vitya-ne authored Feb 15, 2018
1 parent 32c81ea commit 398f577
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion physical/postgresql/postgresql.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 398f577

Please sign in to comment.