Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PG17 compatibility: Fix Test Failure in multi_name_lengths multi_create_table_constraints #7726

Draft
wants to merge 14 commits into
base: naisila/pg17_support
Choose a base branch
from

Conversation

m3hm3t
Copy link
Contributor

@m3hm3t m3hm3t commented Nov 11, 2024

Relevant PG commit:
e59fcbd712c777eb2987d7c9ad542a7e817954ec

 \c - - :public_worker_1_host :worker_1_port
 SELECT "Constraint", "Definition" FROM table_checks WHERE relid='public.name_lengths_225002'::regclass ORDER BY 1 DESC, 2 DESC;
                            Constraint                            |                                       Definition                                        
 -----------------------------------------------------------------+-----------------------------------------------------------------------------------------
- nl_checky_1234567890123456789012345678901234567_b16df46d_225002 | CHECK (date_col_12345678901234567890123456789012345678901234567890 >= '01-01-2014'::date)
+ nl_checky_1234567890123456789012345678901234567_b16df46d_225002 | CHECK date_col_12345678901234567890123456789012345678901234567890 >= '01-01-2014'::date
 (1 row)

diff -dU10 -w /__w/citus/citus/src/test/regress/expected/multi_create_table_constraints.out /__w/citus/citus/src/test/regress/results/multi_create_table_constraints.out
--- /__w/citus/citus/src/test/regress/expected/multi_create_table_constraints.out.modified	2024-11-05 09:50:21.744669730 +0000
+++ /__w/citus/citus/src/test/regress/results/multi_create_table_constraints.out.modified	2024-11-05 09:50:21.756669718 +0000
@@ -402,22 +402,22 @@
 SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
     relid = 'check_example_partition_col_key_365068'::regclass;
     Column     |  Type   |  Definition   
 ---------------+---------+---------------
  partition_col | integer | partition_col
 (1 row)
 
 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
 

@m3hm3t m3hm3t self-assigned this Nov 11, 2024
Copy link

codecov bot commented Nov 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 34.05%. Comparing base (b29c332) to head (7e63f00).

❗ There is a different number of reports uploaded between BASE (b29c332) and HEAD (7e63f00). Click for more details.

HEAD has 158 uploads less than BASE
Flag BASE (b29c332) HEAD (7e63f00)
17_regress_check-pytest 2 0
15_regress_check-pytest 2 0
14_regress_check-pytest 2 0
16_regress_check-pytest 2 1
14_15_upgrade 2 0
14_regress_check-columnar-isolation 2 0
_upgrade 21 0
17_regress_check-follower-cluster 2 0
17_regress_check-columnar-isolation 2 0
14_regress_check-follower-cluster 2 0
14_16_upgrade 2 0
16_17_upgrade 2 1
15_regress_check-follower-cluster 2 0
15_regress_check-columnar-isolation 2 0
15_regress_check-query-generator 2 0
14_regress_check-query-generator 2 0
17_regress_check-query-generator 2 0
16_regress_check-query-generator 2 0
16_regress_check-enterprise-isolation-logicalrep-3 2 0
17_regress_check-enterprise-isolation-logicalrep-3 2 0
16_regress_check-enterprise-isolation-logicalrep-2 2 0
16_regress_check-enterprise-failure 2 0
17_regress_check-columnar 2 0
15_regress_check-split 2 0
17_regress_check-enterprise-isolation-logicalrep-2 2 0
14_regress_check-enterprise-failure 2 0
15_16_upgrade 2 0
17_regress_check-split 2 0
14_regress_check-enterprise-isolation-logicalrep-2 2 0
14_regress_check-enterprise-isolation-logicalrep-3 2 0
14_regress_check-split 2 0
15_17_upgrade 2 0
15_regress_check-columnar 2 0
15_regress_check-enterprise-isolation-logicalrep-3 2 0
15_regress_check-vanilla 1 0
14_regress_check-enterprise 2 0
14_regress_check-columnar 2 0
16_regress_check-columnar 2 0
17_regress_check-enterprise 2 0
15_regress_check-enterprise-isolation-logicalrep-2 2 0
15_regress_check-enterprise-failure 2 0
16_regress_check-vanilla 2 0
16_regress_check-enterprise 2 0
14_regress_check-multi-mx 1 0
14_regress_check-enterprise-isolation 2 0
15_regress_check-failure 1 0
15_regress_check-enterprise-isolation-logicalrep-1 2 0
17_regress_check-enterprise-isolation 2 0
17_cdc_installcheck 1 0
16_cdc_installcheck 1 0
17_regress_check-multi-mx 1 0
16_regress_check-operations 1 0
16_regress_check-follower-cluster 2 0
17_regress_check-operations 1 0
14_regress_check-operations 1 0
15_regress_check-operations 1 0
16_regress_check-columnar-isolation 2 0
14_regress_check-isolation 1 0
16_regress_check-isolation 1 0
17_regress_check-enterprise-failure 2 0
15_regress_check-multi 1 0
17_regress_check-multi 1 0
15_regress_check-isolation 1 0
16_regress_check-multi 1 0
14_regress_check-multi 1 0
15_cdc_installcheck 1 0
17_regress_check-isolation 1 0
16_regress_check-multi-1 1 0
15_regress_check-multi-1 1 0
17_regress_check-multi-1 1 0
16_regress_check-multi-mx 1 0
15_regress_check-enterprise-isolation 2 0
17_regress_check-enterprise-isolation-logicalrep-1 1 0
14_regress_check-vanilla 1 0
16_regress_check-split 2 0
17_regress_check-vanilla 2 0
16_regress_check-enterprise-isolation 2 0
17_regress_check-failure 2 0
14_regress_check-failure 2 0
16_regress_check-enterprise-isolation-logicalrep-1 1 0
14_regress_check-enterprise-isolation-logicalrep-1 2 0
15_regress_check-multi-mx 1 0
15_regress_check-enterprise 2 0
16_regress_check-failure 2 0
Additional details and impacted files
@@                    Coverage Diff                    @@
##           naisila/pg17_support    #7726       +/-   ##
=========================================================
- Coverage                 89.61%   34.05%   -55.57%     
=========================================================
  Files                       274      274               
  Lines                     59689    59352      -337     
  Branches                   7446     7387       -59     
=========================================================
- Hits                      53490    20211    -33279     
- Misses                     4069    36085    +32016     
- Partials                   2130     3056      +926     

@m3hm3t m3hm3t marked this pull request as ready for review November 11, 2024 20:53
@naisila naisila changed the title Fix Test Failure in multi_name_lengths in PG17 PG17 compatibility: Fix Test Failure in multi_name_lengths Nov 12, 2024
s/\|[[:space:]]*CHECK[[:space:]]*\((date_col_[a-zA-Z0-9_]+[[:space:]]*[>=<]+[[:space:]].*)\)/| CHECK \1/g

# Specifically remove outer parentheses from CHECK constraints for int_col_* columns, ensuring proper formatting.
s/\|[[:space:]]*CHECK[[:space:]]*\((int_col_[a-zA-Z0-9_]+[[:space:]]*[>=<]+[[:space:]].*)\)/| CHECK \1/g
Copy link
Member

@naisila naisila Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that these two normalization lines are specific to the column name, hence they don't take care of the following failure in multi_create_table_constraints:
https://github.com/citusdata/citus/actions/runs/11775359161/attempts/1#summary-32795798881

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
 (2 rows)

So we have date_col, int_col, other_col and abs(other_other_col)
I think we can rename these columns to make the normalization rules apply to them?

Example:
date_col_ to column_date
int_col_ to column_int
other_col to column_other
And then have two normalization lines: one for CHECK column_... and one for CHECK abs(...?
There might be a better way, just thoughts from the top of my head. But definitely in this PR we should fix both multi_create_table_constraints and multi_name_lengths tests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to combine the rules into a single, more comprehensive one, but it didn't work out. A more general rule could potentially work, but it carries the risk of affecting other tests as well.

@m3hm3t m3hm3t marked this pull request as draft November 14, 2024 10:00
@m3hm3t m3hm3t changed the title PG17 compatibility: Fix Test Failure in multi_name_lengths PG17 compatibility: Fix Test Failure in multi_name_lengths multi_create_table_constraints Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants