Skip to content

Commit

Permalink
colliculocale daticulocale renamed to colllocale datlocale, fix some …
Browse files Browse the repository at this point in the history
…tests

Fix pg15 pg16 multi_mx_create_table multi_schema_support

Relevant PG commit:
postgres/postgres@f696c0c
f696c0cd5f299f1b51e214efc55a22a782cc175d

(cherry picked from commit 17a2ed0)
  • Loading branch information
naisila committed Nov 18, 2024
1 parent f4c3bad commit 513a304
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 26 deletions.
9 changes: 8 additions & 1 deletion src/test/regress/expected/multi_mx_create_table.out
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ SET search_path TO public;
SHOW server_version \gset
SELECT substring(:'server_version', '\d+')::int >= 16 AS server_version_ge_16
\gset
\if :server_version_ge_16
SELECT substring(:'server_version', '\d+')::int >= 17 AS server_version_ge_17
\gset
\if :server_version_ge_17
-- PG17 renamed colliculocale to colllocale
-- Relevant PG commit:
-- https://github.com/postgres/postgres/commit/f696c0cd5f299f1b51e214efc55a22a782cc175d
SELECT quote_ident((SELECT CASE WHEN datlocprovider='i' THEN datlocale ELSE datcollate END FROM pg_database WHERE datname = current_database())) as current_locale \gset
\elif :server_version_ge_16
-- In PG16, read-only server settings lc_collate and lc_ctype are removed
-- Relevant PG commit: b0f6c437160db640d4ea3e49398ebc3ba39d1982
SELECT quote_ident((SELECT CASE WHEN datlocprovider='i' THEN daticulocale ELSE datcollate END FROM pg_database WHERE datname = current_database())) as current_locale \gset
Expand Down
9 changes: 8 additions & 1 deletion src/test/regress/expected/multi_schema_support.out
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,14 @@ SET search_path TO public;
SHOW server_version \gset
SELECT substring(:'server_version', '\d+')::int >= 16 AS server_version_ge_16
\gset
\if :server_version_ge_16
SELECT substring(:'server_version', '\d+')::int >= 17 AS server_version_ge_17
\gset
\if :server_version_ge_17
-- PG17 renamed colliculocale to colllocale
-- Relevant PG commit:
-- https://github.com/postgres/postgres/commit/f696c0cd5f299f1b51e214efc55a22a782cc175d
SELECT quote_ident((SELECT CASE WHEN datlocprovider='i' THEN datlocale ELSE datcollate END FROM pg_database WHERE datname = current_database())) as current_locale \gset
\elif :server_version_ge_16
-- In PG16, read-only server settings lc_collate and lc_ctype are removed
-- Relevant PG commit: b0f6c437160db640d4ea3e49398ebc3ba39d1982
SELECT quote_ident((SELECT CASE WHEN datlocprovider='i' THEN daticulocale ELSE datcollate END FROM pg_database WHERE datname = current_database())) as current_locale \gset
Expand Down
33 changes: 27 additions & 6 deletions src/test/regress/expected/pg15.out
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,32 @@ SELECT result FROM run_command_on_all_nodes('

(3 rows)

SELECT result FROM run_command_on_all_nodes('
SELECT colliculocale FROM pg_collation WHERE collname = ''german_phonebook_test'';
');
-- PG17 renamed colliculocale to colllocale
-- Relevant PG commit:
-- https://github.com/postgres/postgres/commit/f696c0cd5f299f1b51e214efc55a22a782cc175d
SHOW server_version \gset
SELECT substring(:'server_version', '\d+')::int >= 17 AS server_version_ge_17
\gset
\if :server_version_ge_17
SELECT '$$' ||
'SELECT colllocale FROM pg_collation WHERE collname = ''german_phonebook_test'';'
|| '$$'
AS worker_query_1 \gset
SELECT '$$' ||
'SELECT colllocale FROM pg_collation WHERE collname = ''default_provider'';'
|| '$$'
AS worker_query_2 \gset
\else
SELECT '$$' ||
'SELECT colliculocale FROM pg_collation WHERE collname = ''german_phonebook_test'';'
|| '$$'
AS worker_query_1 \gset
SELECT '$$' ||
'SELECT colliculocale FROM pg_collation WHERE collname = ''default_provider'';'
|| '$$'
AS worker_query_2 \gset
\endif
SELECT result FROM run_command_on_all_nodes(:worker_query_1);
result
---------------------------------------------------------------------
de-u-co-phonebk
Expand Down Expand Up @@ -83,9 +106,7 @@ SELECT result FROM run_command_on_all_nodes('
POSIX
(3 rows)

SELECT result FROM run_command_on_all_nodes('
SELECT colliculocale FROM pg_collation WHERE collname = ''default_provider'';
');
SELECT result FROM run_command_on_all_nodes(:worker_query_2);
result
---------------------------------------------------------------------

Expand Down
16 changes: 8 additions & 8 deletions src/test/regress/expected/pg16.out
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,14 @@ SELECT create_distributed_table('test_collation_rules', 'a');
(1 row)

INSERT INTO test_collation_rules VALUES ('Abernathy'), ('apple'), ('bird'), ('Boston'), ('Graham'), ('green');
SELECT collname, collprovider, colliculocale, collicurules
SELECT collname, collprovider, collicurules
FROM pg_collation
WHERE collname like '%_rule%'
ORDER BY 1;
collname | collprovider | colliculocale | collicurules
collname | collprovider | collicurules
---------------------------------------------------------------------
default_rule | i | und |
special_rule | i | und | &a < g
default_rule | i |
special_rule | i | &a < g
(2 rows)

SELECT * FROM test_collation_rules ORDER BY a COLLATE default_rule;
Expand All @@ -364,14 +364,14 @@ SELECT * FROM test_collation_rules ORDER BY a COLLATE special_rule;

\c - - - :worker_1_port
SET search_path TO pg16;
SELECT collname, collprovider, colliculocale, collicurules
SELECT collname, collprovider, collicurules
FROM pg_collation
WHERE collname like '%_rule%'
ORDER BY 1;
collname | collprovider | colliculocale | collicurules
collname | collprovider | collicurules
---------------------------------------------------------------------
default_rule | i | und |
special_rule | i | und | &a < g
default_rule | i |
special_rule | i | &a < g
(2 rows)

SELECT * FROM test_collation_rules ORDER BY a COLLATE default_rule;
Expand Down
9 changes: 8 additions & 1 deletion src/test/regress/sql/multi_mx_create_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,15 @@ SET search_path TO public;
SHOW server_version \gset
SELECT substring(:'server_version', '\d+')::int >= 16 AS server_version_ge_16
\gset
SELECT substring(:'server_version', '\d+')::int >= 17 AS server_version_ge_17
\gset

\if :server_version_ge_16
\if :server_version_ge_17
-- PG17 renamed colliculocale to colllocale
-- Relevant PG commit:
-- https://github.com/postgres/postgres/commit/f696c0cd5f299f1b51e214efc55a22a782cc175d
SELECT quote_ident((SELECT CASE WHEN datlocprovider='i' THEN datlocale ELSE datcollate END FROM pg_database WHERE datname = current_database())) as current_locale \gset
\elif :server_version_ge_16
-- In PG16, read-only server settings lc_collate and lc_ctype are removed
-- Relevant PG commit: b0f6c437160db640d4ea3e49398ebc3ba39d1982
SELECT quote_ident((SELECT CASE WHEN datlocprovider='i' THEN daticulocale ELSE datcollate END FROM pg_database WHERE datname = current_database())) as current_locale \gset
Expand Down
9 changes: 8 additions & 1 deletion src/test/regress/sql/multi_schema_support.sql
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,15 @@ SET search_path TO public;
SHOW server_version \gset
SELECT substring(:'server_version', '\d+')::int >= 16 AS server_version_ge_16
\gset
SELECT substring(:'server_version', '\d+')::int >= 17 AS server_version_ge_17
\gset

\if :server_version_ge_16
\if :server_version_ge_17
-- PG17 renamed colliculocale to colllocale
-- Relevant PG commit:
-- https://github.com/postgres/postgres/commit/f696c0cd5f299f1b51e214efc55a22a782cc175d
SELECT quote_ident((SELECT CASE WHEN datlocprovider='i' THEN datlocale ELSE datcollate END FROM pg_database WHERE datname = current_database())) as current_locale \gset
\elif :server_version_ge_16
-- In PG16, read-only server settings lc_collate and lc_ctype are removed
-- Relevant PG commit: b0f6c437160db640d4ea3e49398ebc3ba39d1982
SELECT quote_ident((SELECT CASE WHEN datlocprovider='i' THEN daticulocale ELSE datcollate END FROM pg_database WHERE datname = current_database())) as current_locale \gset
Expand Down
37 changes: 31 additions & 6 deletions src/test/regress/sql/pg15.sql
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,36 @@ SELECT result FROM run_command_on_all_nodes('
SELECT result FROM run_command_on_all_nodes('
SELECT collctype FROM pg_collation WHERE collname = ''german_phonebook_test'';
');
SELECT result FROM run_command_on_all_nodes('
SELECT colliculocale FROM pg_collation WHERE collname = ''german_phonebook_test'';
');

-- PG17 renamed colliculocale to colllocale
-- Relevant PG commit:
-- https://github.com/postgres/postgres/commit/f696c0cd5f299f1b51e214efc55a22a782cc175d

SHOW server_version \gset
SELECT substring(:'server_version', '\d+')::int >= 17 AS server_version_ge_17
\gset

\if :server_version_ge_17
SELECT '$$' ||
'SELECT colllocale FROM pg_collation WHERE collname = ''german_phonebook_test'';'
|| '$$'
AS worker_query_1 \gset
SELECT '$$' ||
'SELECT colllocale FROM pg_collation WHERE collname = ''default_provider'';'
|| '$$'
AS worker_query_2 \gset
\else
SELECT '$$' ||
'SELECT colliculocale FROM pg_collation WHERE collname = ''german_phonebook_test'';'
|| '$$'
AS worker_query_1 \gset
SELECT '$$' ||
'SELECT colliculocale FROM pg_collation WHERE collname = ''default_provider'';'
|| '$$'
AS worker_query_2 \gset
\endif

SELECT result FROM run_command_on_all_nodes(:worker_query_1);

-- with non-icu provider, colliculocale will be null, collcollate and collctype will be set
CREATE COLLATION default_provider (provider = libc, lc_collate = "POSIX", lc_ctype = "POSIX");
Expand All @@ -54,9 +81,7 @@ SELECT result FROM run_command_on_all_nodes('
SELECT result FROM run_command_on_all_nodes('
SELECT collctype FROM pg_collation WHERE collname = ''default_provider'';
');
SELECT result FROM run_command_on_all_nodes('
SELECT colliculocale FROM pg_collation WHERE collname = ''default_provider'';
');
SELECT result FROM run_command_on_all_nodes(:worker_query_2);

--
-- In PG15, Renaming triggers on partitioned tables had two problems
Expand Down
4 changes: 2 additions & 2 deletions src/test/regress/sql/pg16.sql
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ CREATE TABLE test_collation_rules (a text);
SELECT create_distributed_table('test_collation_rules', 'a');
INSERT INTO test_collation_rules VALUES ('Abernathy'), ('apple'), ('bird'), ('Boston'), ('Graham'), ('green');

SELECT collname, collprovider, colliculocale, collicurules
SELECT collname, collprovider, collicurules
FROM pg_collation
WHERE collname like '%_rule%'
ORDER BY 1;
Expand All @@ -170,7 +170,7 @@ SELECT * FROM test_collation_rules ORDER BY a COLLATE special_rule;
\c - - - :worker_1_port
SET search_path TO pg16;

SELECT collname, collprovider, colliculocale, collicurules
SELECT collname, collprovider, collicurules
FROM pg_collation
WHERE collname like '%_rule%'
ORDER BY 1;
Expand Down

0 comments on commit 513a304

Please sign in to comment.