From a9f9cf5c5db86757e195f74bda74e1f8db679077 Mon Sep 17 00:00:00 2001 From: Harsh Daryani Date: Wed, 21 Jan 2026 08:13:16 +0000 Subject: [PATCH 1/6] Skip flaky upstream tests --- batch_test.go | 1 + conn_test.go | 11 +++++++++-- load_balance.go | 2 +- stdlib/sql_test.go | 1 + 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/batch_test.go b/batch_test.go index afa6ad6bb..671dadf03 100644 --- a/batch_test.go +++ b/batch_test.go @@ -761,6 +761,7 @@ func TestTxSendBatchRollback(t *testing.T) { id serial primary key, description varchar not null );` + pgxtest.SkipYugabyteDB(t, conn, "Flaky test failure on YugabyteDB") mustExec(t, conn, sql) tx, _ := conn.Begin(ctx) diff --git a/conn_test.go b/conn_test.go index eb997422e..6acb48476 100644 --- a/conn_test.go +++ b/conn_test.go @@ -487,6 +487,7 @@ func TestPrepareIdempotency(t *testing.T) { pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) { for i := 0; i < 2; i++ { + pgxtest.SkipYugabyteDB(t, conn, "Prepare statement with same name but different SQL should have failed but it didn't") _, err := conn.Prepare(context.Background(), "test", "select 42::integer") if err != nil { t.Fatalf("%d. Unable to prepare statement: %v", i, err) @@ -783,6 +784,7 @@ func TestFatalRxError(t *testing.T) { defer closeConn(t, conn) pgxtest.SkipCockroachDB(t, conn, "Server does not support pg_terminate_backend() (https://github.com/cockroachdb/cockroach/issues/35897)") + pgxtest.SkipYugabyteDB(t, conn, "Flaky test failure on YugabyteDB") var wg sync.WaitGroup wg.Add(1) @@ -822,6 +824,7 @@ func TestFatalTxError(t *testing.T) { defer closeConn(t, conn) pgxtest.SkipCockroachDB(t, conn, "Server does not support pg_terminate_backend() (https://github.com/cockroachdb/cockroach/issues/35897)") + pgxtest.SkipYugabyteDB(t, conn, "Flaky test failure on YugabyteDB") otherConn := mustConnectString(t, os.Getenv("PGX_TEST_DATABASE")) defer otherConn.Close(context.Background()) @@ -955,7 +958,7 @@ func TestUnregisteredTypeUsableAsStringArgumentAndBaseResult(t *testing.T) { pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) { pgxtest.SkipCockroachDB(t, conn, "Server does support domain types (https://github.com/cockroachdb/cockroach/issues/27796)") pgxtest.SkipYugabyteDB(t, conn, "YugabyteDB does not support uint64 domain type") - + var n uint64 err := conn.QueryRow(context.Background(), "select $1::uint64", "42").Scan(&n) if err != nil { @@ -1061,7 +1064,7 @@ func TestLoadCompositeType(t *testing.T) { pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) { pgxtest.SkipCockroachDB(t, conn, "Server does support composite types (https://github.com/cockroachdb/cockroach/issues/27792)") pgxtest.SkipYugabyteDB(t, conn, "ALTER TYPE DROP ATTRIBUTE not supported yet in YugabyteDB") - + tx, err := conn.Begin(ctx) require.NoError(t, err) defer tx.Rollback(ctx) @@ -1174,6 +1177,8 @@ func TestStmtCacheInvalidationConn(t *testing.T) { conn := mustConnectString(t, os.Getenv("PGX_TEST_DATABASE")) defer closeConn(t, conn) + pgxtest.SkipYugabyteDB(t, conn, "cached plan must not change result type") + // create a table and fill it with some data _, err := conn.Exec(ctx, ` DROP TABLE IF EXISTS drop_cols; @@ -1235,6 +1240,7 @@ func TestStmtCacheInvalidationTx(t *testing.T) { conn := mustConnectString(t, os.Getenv("PGX_TEST_DATABASE")) defer closeConn(t, conn) + pgxtest.SkipYugabyteDB(t, conn, "cached plan must not change result type (SQLSTATE 0A000)") if conn.PgConn().ParameterStatus("crdb_version") != "" { t.Skip("Server has non-standard prepare in errored transaction behavior (https://github.com/cockroachdb/cockroach/issues/84140)") @@ -1390,6 +1396,7 @@ func TestStmtCacheInvalidationTxWithBatch(t *testing.T) { conn := mustConnectString(t, os.Getenv("PGX_TEST_DATABASE")) defer closeConn(t, conn) + pgxtest.SkipYugabyteDB(t, conn, "cached plan must not change result type (SQLSTATE 0A000)") if conn.PgConn().ParameterStatus("crdb_version") != "" { t.Skip("Server has non-standard prepare in errored transaction behavior (https://github.com/cockroachdb/cockroach/issues/84140)") diff --git a/load_balance.go b/load_balance.go index fed041637..706a565d2 100644 --- a/load_balance.go +++ b/load_balance.go @@ -337,7 +337,7 @@ func refreshLoadInfo(li *ClusterLoadInfo) error { li.config.Fallbacks = ctrlConfig.Fallbacks li.config.connString = ctrlConfig.connString li.config.ConnectTimeout = CONTROL_CONN_TIMEOUT - li.controlConn, err = connect(li.ctrlCtx, li.config) + li.controlConn, err = connect(li.ctrlCtx, ctrlConfig) if err != nil { log.Printf("Could not create control connection to %s\n", li.config.Host) // remove its hostLoad entry diff --git a/stdlib/sql_test.go b/stdlib/sql_test.go index dd24817d7..d77b04c2b 100644 --- a/stdlib/sql_test.go +++ b/stdlib/sql_test.go @@ -1338,6 +1338,7 @@ func TestCheckIdleConn(t *testing.T) { defer closeDB(t, controllerConn) skipCockroachDB(t, controllerConn, "Server does not support pg_terminate_backend() (https://github.com/cockroachdb/cockroach/issues/35897)") + skipYugabyteDB(t, controllerConn, "Flaky test in YugabyteDB") db, err := sql.Open("pgx", os.Getenv("PGX_TEST_DATABASE")) require.NoError(t, err) From 933a27f07d2c2a97cbfbbcbca05de544026f368a Mon Sep 17 00:00:00 2001 From: Harsh Daryani Date: Fri, 30 Jan 2026 06:13:43 +0000 Subject: [PATCH 2/6] Flaky test with YB --- conn_test.go | 2 ++ pgconn/pgconn_test.go | 10 ++++++++++ pgxpool/pool_test.go | 1 + stdlib/sql_test.go | 1 + 4 files changed, 14 insertions(+) diff --git a/conn_test.go b/conn_test.go index 6acb48476..f14f91397 100644 --- a/conn_test.go +++ b/conn_test.go @@ -594,6 +594,7 @@ func TestDeallocateMissingPreparedStatementStillClearsFromPreparedStatementMap(t defer cancel() pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) { + pgxtest.SkipYugabyteDB(t, conn, "Flaky test failure on YugabyteDB") _, err := conn.Prepare(ctx, "ps", "select $1::text") require.NoError(t, err) @@ -1324,6 +1325,7 @@ func TestStmtCacheInvalidationConnWithBatch(t *testing.T) { if conn.PgConn().ParameterStatus("crdb_version") != "" { t.Skip("Test fails due to different CRDB behavior") } + pgxtest.SkipYugabyteDB(t, conn, "Flaky test failure on YugabyteDB") // create a table and fill it with some data _, err := conn.Exec(ctx, ` diff --git a/pgconn/pgconn_test.go b/pgconn/pgconn_test.go index d6f34e70b..08e044135 100644 --- a/pgconn/pgconn_test.go +++ b/pgconn/pgconn_test.go @@ -687,6 +687,10 @@ func TestConnDeallocate(t *testing.T) { require.NoError(t, err) defer closeConn(t, pgConn) + if strings.Contains(pgConn.ParameterStatus("server_version"), "YB") { + t.Skip("Flaky test failure on YugabyteDB") + } + _, err = pgConn.Prepare(ctx, "ps1", "select 1", nil) require.NoError(t, err) @@ -714,6 +718,9 @@ func TestConnDeallocateSucceedsInAbortedTransaction(t *testing.T) { pgConn, err := pgconn.Connect(ctx, os.Getenv("PGX_TEST_DATABASE")) require.NoError(t, err) defer closeConn(t, pgConn) + if strings.Contains(pgConn.ParameterStatus("server_version"), "YB") { + t.Skip("Flaky test failure on YugabyteDB") + } err = pgConn.Exec(ctx, "begin").Close() require.NoError(t, err) @@ -2923,6 +2930,9 @@ func TestPipelinePrepareAndDeallocate(t *testing.T) { pgConn, err := pgconn.Connect(ctx, os.Getenv("PGX_TEST_DATABASE")) require.NoError(t, err) defer closeConn(t, pgConn) + if strings.Contains(pgConn.ParameterStatus("server_version"), "YB") { + t.Skip("Flaky test failure on YugabyteDB") + } pipeline := pgConn.StartPipeline(ctx) pipeline.SendPrepare("selectInt", "select $1::bigint as a", nil) diff --git a/pgxpool/pool_test.go b/pgxpool/pool_test.go index 9e98d6e59..61f8a1943 100644 --- a/pgxpool/pool_test.go +++ b/pgxpool/pool_test.go @@ -160,6 +160,7 @@ func TestPoolAcquireChecksIdleConns(t *testing.T) { require.NoError(t, err) defer controllerConn.Close(ctx) pgxtest.SkipCockroachDB(t, controllerConn, "Server does not support pg_terminate_backend() (https://github.com/cockroachdb/cockroach/issues/35897)") + pgxtest.SkipYugabyteDB(t, controllerConn, "Flaky test failure on YugabyteDB") pool, err := pgxpool.New(ctx, os.Getenv("PGX_TEST_DATABASE")) require.NoError(t, err) diff --git a/stdlib/sql_test.go b/stdlib/sql_test.go index d77b04c2b..d2fcd6dd6 100644 --- a/stdlib/sql_test.go +++ b/stdlib/sql_test.go @@ -826,6 +826,7 @@ func TestConnPrepareContextSuccess(t *testing.T) { func TestConnMultiplePrepareAndDeallocate(t *testing.T) { testWithAllQueryExecModes(t, func(t *testing.T, db *sql.DB) { skipCockroachDB(t, db, "Server does not support pg_prepared_statements") + skipYugabyteDB(t, db, "Flaky test failure on YugabyteDB") sql := "select 42" stmt1, err := db.PrepareContext(context.Background(), sql) From 7b1baf2c9dde3ef4af8e60624ce3398cd6412f30 Mon Sep 17 00:00:00 2001 From: Harsh Daryani Date: Sun, 1 Feb 2026 13:29:01 +0000 Subject: [PATCH 3/6] Change skip message --- conn_test.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/conn_test.go b/conn_test.go index f14f91397..5fea3218e 100644 --- a/conn_test.go +++ b/conn_test.go @@ -487,7 +487,7 @@ func TestPrepareIdempotency(t *testing.T) { pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) { for i := 0; i < 2; i++ { - pgxtest.SkipYugabyteDB(t, conn, "Prepare statement with same name but different SQL should have failed but it didn't") + pgxtest.SkipYugabyteDB(t, conn, "Flaky test failure on YugabyteDB") _, err := conn.Prepare(context.Background(), "test", "select 42::integer") if err != nil { t.Fatalf("%d. Unable to prepare statement: %v", i, err) @@ -872,6 +872,7 @@ func TestInsertTimestampArray(t *testing.T) { defer cancel() pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) { + pgxtest.SkipYugabyteDB(t, conn, "Flaky test failure on YugabyteDB") if results := mustExec(t, conn, "create temporary table foo(spice timestamp[]);"); results.String() != "CREATE TABLE" { t.Error("Unexpected results from Exec") } @@ -959,7 +960,6 @@ func TestUnregisteredTypeUsableAsStringArgumentAndBaseResult(t *testing.T) { pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) { pgxtest.SkipCockroachDB(t, conn, "Server does support domain types (https://github.com/cockroachdb/cockroach/issues/27796)") pgxtest.SkipYugabyteDB(t, conn, "YugabyteDB does not support uint64 domain type") - var n uint64 err := conn.QueryRow(context.Background(), "select $1::uint64", "42").Scan(&n) if err != nil { @@ -1065,7 +1065,6 @@ func TestLoadCompositeType(t *testing.T) { pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) { pgxtest.SkipCockroachDB(t, conn, "Server does support composite types (https://github.com/cockroachdb/cockroach/issues/27792)") pgxtest.SkipYugabyteDB(t, conn, "ALTER TYPE DROP ATTRIBUTE not supported yet in YugabyteDB") - tx, err := conn.Begin(ctx) require.NoError(t, err) defer tx.Rollback(ctx) @@ -1178,7 +1177,7 @@ func TestStmtCacheInvalidationConn(t *testing.T) { conn := mustConnectString(t, os.Getenv("PGX_TEST_DATABASE")) defer closeConn(t, conn) - pgxtest.SkipYugabyteDB(t, conn, "cached plan must not change result type") + pgxtest.SkipYugabyteDB(t, conn, "Flaky test failure on YugabyteDB") // create a table and fill it with some data _, err := conn.Exec(ctx, ` @@ -1241,7 +1240,7 @@ func TestStmtCacheInvalidationTx(t *testing.T) { conn := mustConnectString(t, os.Getenv("PGX_TEST_DATABASE")) defer closeConn(t, conn) - pgxtest.SkipYugabyteDB(t, conn, "cached plan must not change result type (SQLSTATE 0A000)") + pgxtest.SkipYugabyteDB(t, conn, "Flaky test failure on YugabyteDB") if conn.PgConn().ParameterStatus("crdb_version") != "" { t.Skip("Server has non-standard prepare in errored transaction behavior (https://github.com/cockroachdb/cockroach/issues/84140)") @@ -1398,7 +1397,7 @@ func TestStmtCacheInvalidationTxWithBatch(t *testing.T) { conn := mustConnectString(t, os.Getenv("PGX_TEST_DATABASE")) defer closeConn(t, conn) - pgxtest.SkipYugabyteDB(t, conn, "cached plan must not change result type (SQLSTATE 0A000)") + pgxtest.SkipYugabyteDB(t, conn, "Flaky test failure on YugabyteDB") if conn.PgConn().ParameterStatus("crdb_version") != "" { t.Skip("Server has non-standard prepare in errored transaction behavior (https://github.com/cockroachdb/cockroach/issues/84140)") From 7c51d2393820495213f9a60ea93085c6756e29e3 Mon Sep 17 00:00:00 2001 From: Harsh Daryani Date: Sun, 1 Feb 2026 13:30:29 +0000 Subject: [PATCH 4/6] add removed new line --- conn_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conn_test.go b/conn_test.go index 5fea3218e..9096a56ea 100644 --- a/conn_test.go +++ b/conn_test.go @@ -960,6 +960,7 @@ func TestUnregisteredTypeUsableAsStringArgumentAndBaseResult(t *testing.T) { pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) { pgxtest.SkipCockroachDB(t, conn, "Server does support domain types (https://github.com/cockroachdb/cockroach/issues/27796)") pgxtest.SkipYugabyteDB(t, conn, "YugabyteDB does not support uint64 domain type") + var n uint64 err := conn.QueryRow(context.Background(), "select $1::uint64", "42").Scan(&n) if err != nil { @@ -1065,6 +1066,7 @@ func TestLoadCompositeType(t *testing.T) { pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) { pgxtest.SkipCockroachDB(t, conn, "Server does support composite types (https://github.com/cockroachdb/cockroach/issues/27792)") pgxtest.SkipYugabyteDB(t, conn, "ALTER TYPE DROP ATTRIBUTE not supported yet in YugabyteDB") + tx, err := conn.Begin(ctx) require.NoError(t, err) defer tx.Rollback(ctx) From dca129b3693da7196c8cd28ad51527c7241765c7 Mon Sep 17 00:00:00 2001 From: Harsh Daryani Date: Sun, 1 Feb 2026 16:55:52 +0000 Subject: [PATCH 5/6] skip flaky test --- stdlib/sql_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/stdlib/sql_test.go b/stdlib/sql_test.go index d2fcd6dd6..e87eab842 100644 --- a/stdlib/sql_test.go +++ b/stdlib/sql_test.go @@ -304,6 +304,7 @@ func TestQueryCloseRowsEarly(t *testing.T) { func TestConnExec(t *testing.T) { testWithAllQueryExecModes(t, func(t *testing.T, db *sql.DB) { + skipYugabyteDB(t, db, "Flaky test on YugabyteDB") _, err := db.Exec("create temporary table t(a varchar not null)") require.NoError(t, err) From 152840c3e43290ac2af0f002fc082f3dcc54e89f Mon Sep 17 00:00:00 2001 From: Harsh Daryani Date: Thu, 5 Feb 2026 08:46:05 +0000 Subject: [PATCH 6/6] revert config change --- load_balance.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/load_balance.go b/load_balance.go index 706a565d2..fed041637 100644 --- a/load_balance.go +++ b/load_balance.go @@ -337,7 +337,7 @@ func refreshLoadInfo(li *ClusterLoadInfo) error { li.config.Fallbacks = ctrlConfig.Fallbacks li.config.connString = ctrlConfig.connString li.config.ConnectTimeout = CONTROL_CONN_TIMEOUT - li.controlConn, err = connect(li.ctrlCtx, ctrlConfig) + li.controlConn, err = connect(li.ctrlCtx, li.config) if err != nil { log.Printf("Could not create control connection to %s\n", li.config.Host) // remove its hostLoad entry