From 0fd0688d4f70600369238b7af0668846c27a43c8 Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Tue, 22 Mar 2022 19:56:48 -0500 Subject: [PATCH] Alter some tests for CockroachDB --- query_test.go | 8 +++++++- values_test.go | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/query_test.go b/query_test.go index dfb8d2a4..1cff72bf 100644 --- a/query_test.go +++ b/query_test.go @@ -268,6 +268,8 @@ func TestRowsScanDoesNotAllowScanningBinaryFormatValuesIntoString(t *testing.T) conn := mustConnectString(t, os.Getenv("PGX_TEST_DATABASE")) defer closeConn(t, conn) + skipCockroachDB(t, conn, "Server does not support point type") + var s string err := conn.QueryRow(context.Background(), "select point(1,2)").Scan(&s) @@ -373,7 +375,7 @@ func TestConnQueryReadWrongTypeError(t *testing.T) { defer closeConn(t, conn) // Read a single value incorrectly - rows, err := conn.Query(context.Background(), "select generate_series(1,$1)", 10) + rows, err := conn.Query(context.Background(), "select n::int4 from generate_series(1,$1) n", 10) if err != nil { t.Fatalf("conn.Query failed: %v", err) } @@ -960,6 +962,10 @@ func TestQueryRowErrors(t *testing.T) { conn := mustConnectString(t, os.Getenv("PGX_TEST_DATABASE")) defer closeConn(t, conn) + if conn.PgConn().ParameterStatus("crdb_version") != "" { + t.Skip("Skipping due to known server missing point type") + } + type allTypes struct { i16 int16 i int diff --git a/values_test.go b/values_test.go index 7a6cb3a2..15c16746 100644 --- a/values_test.go +++ b/values_test.go @@ -1042,7 +1042,7 @@ func TestScanIntoByteSlice(t *testing.T) { sql string err string }{ - {"int binary", "select 42", "can't scan into dest[0]: cannot scan OID 23 in binary format into *[]uint8"}, + {"int binary", "select 42::int4", "can't scan into dest[0]: cannot scan OID 23 in binary format into *[]uint8"}, } { t.Run(tt.name, func(t *testing.T) { var buf []byte