From e9110de7e1d2c0c32e454b8b8963249a9d328de4 Mon Sep 17 00:00:00 2001 From: Mehmet YILMAZ Date: Mon, 2 Dec 2024 13:08:21 +0300 Subject: [PATCH] PG17 compatibility: Fix Test Failure in multi_name_lengths multi_create_table_constraints (#7726) PG 17 Removes outer parentheses from CHECK constraints we add them back for pg15,pg16 compatibility e.g. change CHECK other_col >= 100 to CHECK (other_col >= 100) Relevant PG commit: e59fcbd712c777eb2987d7c9ad542a7e817954ec https://github.com/postgres/postgres/commit/e59fcbd712c777eb2987d7c9ad542a7e817954ec CI link https://github.com/citusdata/citus/actions/runs/11844794788 ```difft SELECT "Constraint", "Definition" FROM table_checks WHERE relid='public.check_example_365068'::regclass; Constraint | Definition -------------------------------------+----------------------------------- - check_example_other_col_check | CHECK (other_col >= 100) - check_example_other_other_col_check | CHECK (abs(other_other_col) >= 100) + check_example_other_col_check | CHECK other_col >= 100 + check_example_other_other_col_check | CHECK abs(other_other_col) >= 100 ``` Co-authored-by: Mehmet YILMAZ --- src/test/regress/bin/normalize.sed | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/test/regress/bin/normalize.sed b/src/test/regress/bin/normalize.sed index 1cbd0b404..19ac512c5 100644 --- a/src/test/regress/bin/normalize.sed +++ b/src/test/regress/bin/normalize.sed @@ -319,3 +319,8 @@ s/COPY DEFAULT only available using COPY FROM/COPY DEFAULT cannot be used with C s/COPY delimiter must not appear in the DEFAULT specification/COPY delimiter character must not appear in the DEFAULT specification/ #endif /* PG_VERSION_NUM < PG_VERSION_17 */ + +# PG 17 Removes outer parentheses from CHECK constraints +# we add them back for pg15,pg16 compatibility +# e.g. change CHECK other_col >= 100 to CHECK (other_col >= 100) +s/\| CHECK ([a-zA-Z])(.*)/| CHECK \(\1\2\)/g