Skip to content

Commit

Permalink
multi_name_lengths
Browse files Browse the repository at this point in the history
remove citus-tools

normalization added

normlize update

update

update

update

update

.

update

.

revert some files

update

update
  • Loading branch information
m7hm7t authored and m3hm3t committed Nov 28, 2024
1 parent 6611e3c commit 17f932b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
13 changes: 13 additions & 0 deletions src/test/regress/bin/normalize.sed
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,16 @@ 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 - Remove outer parentheses from CHECK constraints, making sure we only match lines with CHECK (...) and not other constructs.
# Remove outer parentheses from CHECK constraints for date_col_* columns.
s/\|[[:space:]]*CHECK[[:space:]]*\((date_col_[a-zA-Z0-9_]+[[:space:]]*[>=<]+[[:space:]].*)\)/| CHECK \1/g

# Remove outer parentheses from CHECK constraints for int_col_* columns.
s/\|[[:space:]]*CHECK[[:space:]]*\((int_col_[a-zA-Z0-9_]+[[:space:]]*[>=<]+[[:space:]].*)\)/| CHECK \1/g

# Remove outer parentheses from CHECK constraints for other_col columns.
s/\|[[:space:]]*CHECK[[:space:]]*\((other_col[[:space:]]*[>=<]+[[:space:]].*)\)/| CHECK \1/g

# Remove outer parentheses from CHECK constraints involving a function call, such as abs() or others.
s/\|[[:space:]]*CHECK[[:space:]]*\((abs\([a-zA-Z0-9_]+\)[[:space:]]*[>=<]+[[:space:]].*)\)/| CHECK \1/g
4 changes: 2 additions & 2 deletions src/test/regress/expected/multi_create_table_constraints.out
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,8 @@ SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
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)

\c - - :master_host :master_port
Expand Down
6 changes: 3 additions & 3 deletions src/test/regress/expected/multi_name_lengths.out
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ ALTER TABLE name_lengths ADD CONSTRAINT nl_checky_123456789012345678901234567890
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)

\c - - :master_host :master_port
Expand Down Expand Up @@ -253,7 +253,7 @@ CREATE TABLE sneaky_name_lengths (
SELECT "Constraint", "Definition" FROM table_checks WHERE relid='public.sneaky_name_lengths'::regclass ORDER BY 1 DESC, 2 DESC;
Constraint | Definition
---------------------------------------------------------------------
checky_12345678901234567890123456789012345678901234567890 | CHECK (int_col_123456789012345678901234567890123456789012345678901234 > 100)
checky_12345678901234567890123456789012345678901234567890 | CHECK int_col_123456789012345678901234567890123456789012345678901234 > 100
(1 row)

SELECT create_distributed_table('sneaky_name_lengths', 'int_col_123456789012345678901234567890123456789012345678901234', 'hash');
Expand Down Expand Up @@ -283,7 +283,7 @@ LIMIT 1 \gset
SELECT "Constraint", "Definition" FROM table_checks WHERE relid= :sneaky_shard_oid ORDER BY 1 DESC, 2 DESC;
Constraint | Definition
---------------------------------------------------------------------
checky_12345678901234567890123456789012345678901234567890 | CHECK (int_col_123456789012345678901234567890123456789012345678901234 > 100)
checky_12345678901234567890123456789012345678901234567890 | CHECK int_col_123456789012345678901234567890123456789012345678901234 > 100
(1 row)

\c - - :master_host :master_port
Expand Down

0 comments on commit 17f932b

Please sign in to comment.