Skip to content

Commit

Permalink
Use ORDER BY logicalrelid::regclass::text to compare names, not OIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
naisila committed Apr 5, 2023
1 parent 94d64a3 commit a5067a5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
18 changes: 9 additions & 9 deletions src/test/regress/expected/multi_metadata_sync.out
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ SELECT * FROM pg_dist_node ORDER BY nodeid;
5 | 1 | localhost | 8889 | default | f | t | secondary | second-cluster | f | t
(4 rows)

SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid;
SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid::regclass:text;
logicalrelid | partmethod | partkey | colocationid | repmodel | autoconverted
---------------------------------------------------------------------
mx_testing_schema.mx_test_table | h | {VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnosyn 1 :varattnosyn 1 :location -1} | 2 | s | f
Expand Down Expand Up @@ -635,7 +635,7 @@ SELECT * FROM pg_dist_node ORDER BY nodeid;
5 | 1 | localhost | 8889 | default | f | t | secondary | second-cluster | f | t
(4 rows)

SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid;
SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid::regclass:text;
logicalrelid | partmethod | partkey | colocationid | repmodel | autoconverted
---------------------------------------------------------------------
mx_testing_schema.mx_test_table | h | {VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnosyn 1 :varattnosyn 1 :location -1} | 2 | s | f
Expand Down Expand Up @@ -872,7 +872,7 @@ WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid;
logicalrelid::regclass:text;
logicalrelid | repmodel
---------------------------------------------------------------------
mx_test_schema_1.mx_table_1 | s
Expand All @@ -888,7 +888,7 @@ WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid, shardid;
logicalrelid::regclass:text, shardid;
logicalrelid | shardid | nodename | nodeport
---------------------------------------------------------------------
mx_test_schema_1.mx_table_1 | 1310020 | localhost | 57637
Expand Down Expand Up @@ -923,7 +923,7 @@ WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid;
logicalrelid::regclass:text;
logicalrelid | repmodel
---------------------------------------------------------------------
mx_test_schema_1.mx_table_1 | s
Expand All @@ -939,7 +939,7 @@ WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid, shardid;
logicalrelid::regclass:text, shardid;
logicalrelid | shardid | nodename | nodeport
---------------------------------------------------------------------
mx_test_schema_1.mx_table_1 | 1310020 | localhost | 57637
Expand Down Expand Up @@ -1083,7 +1083,7 @@ FROM
WHERE
logicalrelid = 'mx_colocation_test_1'::regclass
OR logicalrelid = 'mx_colocation_test_2'::regclass
ORDER BY logicalrelid;
ORDER BY logicalrelid::regclass:text;
logicalrelid | colocationid
---------------------------------------------------------------------
mx_colocation_test_1 | 10000
Expand All @@ -1105,7 +1105,7 @@ WHERE
logicalrelid = 'mx_colocation_test_1'::regclass
OR logicalrelid = 'mx_colocation_test_2'::regclass
ORDER BY
logicalrelid;
logicalrelid::regclass:text;
logicalrelid | colocationid
---------------------------------------------------------------------
mx_colocation_test_1 | 10001
Expand All @@ -1121,7 +1121,7 @@ WHERE
logicalrelid = 'mx_colocation_test_1'::regclass
OR logicalrelid = 'mx_colocation_test_2'::regclass
ORDER BY
logicalrelid;
logicalrelid::regclass:text;
logicalrelid | colocationid
---------------------------------------------------------------------
mx_colocation_test_1 | 10001
Expand Down
18 changes: 9 additions & 9 deletions src/test/regress/expected/multi_metadata_sync_0.out
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ SELECT * FROM pg_dist_node ORDER BY nodeid;
5 | 1 | localhost | 8889 | default | f | t | secondary | second-cluster | f | t
(4 rows)

SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid;
SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid::regclass:text;
logicalrelid | partmethod | partkey | colocationid | repmodel | autoconverted
---------------------------------------------------------------------
mx_testing_schema.mx_test_table | h | {VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnosyn 1 :varattnosyn 1 :location -1} | 2 | s | f
Expand Down Expand Up @@ -635,7 +635,7 @@ SELECT * FROM pg_dist_node ORDER BY nodeid;
5 | 1 | localhost | 8889 | default | f | t | secondary | second-cluster | f | t
(4 rows)

SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid;
SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid::regclass:text;
logicalrelid | partmethod | partkey | colocationid | repmodel | autoconverted
---------------------------------------------------------------------
mx_testing_schema.mx_test_table | h | {VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnosyn 1 :varattnosyn 1 :location -1} | 2 | s | f
Expand Down Expand Up @@ -872,7 +872,7 @@ WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid;
logicalrelid::regclass:text;
logicalrelid | repmodel
---------------------------------------------------------------------
mx_test_schema_1.mx_table_1 | s
Expand All @@ -888,7 +888,7 @@ WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid, shardid;
logicalrelid::regclass:text, shardid;
logicalrelid | shardid | nodename | nodeport
---------------------------------------------------------------------
mx_test_schema_1.mx_table_1 | 1310020 | localhost | 57637
Expand Down Expand Up @@ -923,7 +923,7 @@ WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid;
logicalrelid::regclass:text;
logicalrelid | repmodel
---------------------------------------------------------------------
mx_test_schema_1.mx_table_1 | s
Expand All @@ -939,7 +939,7 @@ WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid, shardid;
logicalrelid::regclass:text, shardid;
logicalrelid | shardid | nodename | nodeport
---------------------------------------------------------------------
mx_test_schema_1.mx_table_1 | 1310020 | localhost | 57637
Expand Down Expand Up @@ -1083,7 +1083,7 @@ FROM
WHERE
logicalrelid = 'mx_colocation_test_1'::regclass
OR logicalrelid = 'mx_colocation_test_2'::regclass
ORDER BY logicalrelid;
ORDER BY logicalrelid::regclass:text;
logicalrelid | colocationid
---------------------------------------------------------------------
mx_colocation_test_1 | 10000
Expand All @@ -1105,7 +1105,7 @@ WHERE
logicalrelid = 'mx_colocation_test_1'::regclass
OR logicalrelid = 'mx_colocation_test_2'::regclass
ORDER BY
logicalrelid;
logicalrelid::regclass:text;
logicalrelid | colocationid
---------------------------------------------------------------------
mx_colocation_test_1 | 10001
Expand All @@ -1121,7 +1121,7 @@ WHERE
logicalrelid = 'mx_colocation_test_1'::regclass
OR logicalrelid = 'mx_colocation_test_2'::regclass
ORDER BY
logicalrelid;
logicalrelid::regclass:text;
logicalrelid | colocationid
---------------------------------------------------------------------
mx_colocation_test_1 | 10001
Expand Down
18 changes: 9 additions & 9 deletions src/test/regress/sql/multi_metadata_sync.sql
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ SELECT nodeid, hasmetadata FROM pg_dist_node WHERE nodename='localhost' AND node
\c - - - :worker_1_port
SELECT * FROM pg_dist_local_group;
SELECT * FROM pg_dist_node ORDER BY nodeid;
SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid;
SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid::regclass:text;
SELECT * FROM pg_dist_shard WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY shardid;
SELECT * FROM pg_dist_shard_placement WHERE shardid IN (SELECT shardid FROM pg_dist_shard WHERE logicalrelid::text LIKE 'mx_testing_schema%') ORDER BY shardid, nodename, nodeport;
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_testing_schema.mx_test_table'::regclass;
Expand Down Expand Up @@ -161,7 +161,7 @@ SELECT 1 FROM citus_activate_node('localhost', :worker_1_port);
\c - - - :worker_1_port
SELECT * FROM pg_dist_local_group;
SELECT * FROM pg_dist_node ORDER BY nodeid;
SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid;
SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid::regclass:text;
SELECT * FROM pg_dist_shard WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY shardid;
SELECT * FROM pg_dist_shard_placement WHERE shardid IN (SELECT shardid FROM pg_dist_shard WHERE logicalrelid::text LIKE 'mx_testing_schema%') ORDER BY shardid, nodename, nodeport;
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_testing_schema.mx_test_table'::regclass;
Expand Down Expand Up @@ -252,7 +252,7 @@ WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid;
logicalrelid::regclass:text;

-- See the shards and placements of the mx tables
SELECT
Expand All @@ -263,7 +263,7 @@ WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid, shardid;
logicalrelid::regclass:text, shardid;

-- Check that metadata of MX tables exist on the metadata worker
\c - - - :worker_1_port
Expand All @@ -280,7 +280,7 @@ WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid;
logicalrelid::regclass:text;

-- Check that shard and placement data are created
SELECT
Expand All @@ -291,7 +291,7 @@ WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid, shardid;
logicalrelid::regclass:text, shardid;

-- Check that metadata of MX tables don't exist on the non-metadata worker
\c - - - :worker_2_port
Expand Down Expand Up @@ -383,7 +383,7 @@ FROM
WHERE
logicalrelid = 'mx_colocation_test_1'::regclass
OR logicalrelid = 'mx_colocation_test_2'::regclass
ORDER BY logicalrelid;
ORDER BY logicalrelid::regclass:text;

-- Update colocation and see the changes on the master and the worker
SELECT update_distributed_table_colocation('mx_colocation_test_1', colocate_with => 'mx_colocation_test_2');
Expand All @@ -395,7 +395,7 @@ WHERE
logicalrelid = 'mx_colocation_test_1'::regclass
OR logicalrelid = 'mx_colocation_test_2'::regclass
ORDER BY
logicalrelid;
logicalrelid::regclass:text;
\c - - - :worker_1_port
SELECT
logicalrelid, colocationid
Expand All @@ -405,7 +405,7 @@ WHERE
logicalrelid = 'mx_colocation_test_1'::regclass
OR logicalrelid = 'mx_colocation_test_2'::regclass
ORDER BY
logicalrelid;
logicalrelid::regclass:text;

\c - - - :master_port

Expand Down

0 comments on commit a5067a5

Please sign in to comment.