Only test numeric infinity on PG 14+
This commit is contained in:
@@ -4,6 +4,8 @@ import (
|
||||
"database/sql"
|
||||
"errors"
|
||||
"net"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/jackc/pgx/v5"
|
||||
@@ -76,6 +78,25 @@ func skipCockroachDB(t testing.TB, msg string) {
|
||||
}
|
||||
}
|
||||
|
||||
func skipPostgreSQLVersionLessThan(t testing.TB, minVersion int64) {
|
||||
conn := testutil.MustConnectPgx(t)
|
||||
defer testutil.MustCloseContext(t, conn)
|
||||
|
||||
serverVersionStr := conn.PgConn().ParameterStatus("server_version")
|
||||
serverVersionStr = regexp.MustCompile(`^[0-9]+`).FindString(serverVersionStr)
|
||||
// if not PostgreSQL do nothing
|
||||
if serverVersionStr == "" {
|
||||
return
|
||||
}
|
||||
|
||||
serverVersion, err := strconv.ParseInt(serverVersionStr, 10, 64)
|
||||
require.NoError(t, err)
|
||||
|
||||
if serverVersion < minVersion {
|
||||
t.Skipf("Test requires PostgreSQL v%d+", minVersion)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTypeMapScanNilIsNoOp(t *testing.T) {
|
||||
m := pgtype.NewMap()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user