Skip to content

Commit 7c307a8

Browse files
committed
compose/compare: Add PG compat session variables
Previously, `TestComposeCompare` would fail due to differences in how floats were cast to strings and the default behavior of NULL ordering. This commit sets PG compatibility session variables for the CockroachDB instances used in this test. This commit only fixes failures when: 1. A float is being cast to a string (`SELECT 1234567::FLOAT8::STRING`) 2. A `SELECT` contains an `ORDER BY` _without_ specifying how `NULLS` should be handled. There are still other known and unknown failures. Epic: None Informs: #99181
1 parent dc2c52d commit 7c307a8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/compose/compare/compare/compare_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ func TestCompare(t *testing.T) {
6565
addr: "postgresql://root@cockroach1:26257/postgres?sslmode=disable",
6666
init: []string{
6767
"SET CLUSTER SETTING cluster.organization = 'Cockroach Labs - Production Testing'",
68+
"SET extra_float_digits = 0", // For Postgres Compat when casting floats to strings.
69+
"SET null_ordered_last = true", // For Postgres Compat, see https://www.cockroachlabs.com/docs/stable/order-by#parameters
6870
fmt.Sprintf("SET CLUSTER SETTING enterprise.license = '%s'", license),
6971
"drop database if exists postgres",
7072
"create database postgres",
@@ -74,6 +76,8 @@ func TestCompare(t *testing.T) {
7476
addr: "postgresql://root@cockroach2:26257/postgres?sslmode=disable",
7577
init: []string{
7678
"SET CLUSTER SETTING cluster.organization = 'Cockroach Labs - Production Testing'",
79+
"SET extra_float_digits = 0", // For Postgres Compat when casting floats to strings.
80+
"SET null_ordered_last = true", // For Postgres Compat https://www.cockroachlabs.com/docs/stable/order-by#parameters
7781
fmt.Sprintf("SET CLUSTER SETTING enterprise.license = '%s'", license),
7882
"drop database if exists postgres",
7983
"create database postgres",

0 commit comments

Comments
 (0)