citus
citus copied to clipboard
Improve run_command_on_shards to handle composite data
In the implementation, (EvaluateSingleQueryResult) the result of the query is formatted into a string. If the type of the query result is a composite type it puts expected a single row in query result into the text string.
CREATE EXTENSION IF NOT EXISTS pgstattuple;
CREATE EXTENSION IF NOT EXISTS pg_visibility;
---WORKS
SELECT * FROM run_command_on_shards('testcitus', $cmd$ SELECT pgstattuple('%s'); $cmd$);
shardid | success | result
---------+---------+------------------------------------------------
102729 | t | (16384,294,11466,69.98,15,585,3.57,2664,16.26)
102730 | t | (16384,310,12090,73.79,17,663,4.05,1872,11.43)
102731 | t | (16384,296,11544,70.46,13,507,3.09,2648,16.16)
(3 rows)
--- DOES NOT WORK
SELECT * FROM run_command_on_shards('testcitus', $cmd$ SELECT pg_visibility_map('%s'); $cmd$);
shardid | success | result
---------+---------+---------------------------------------
102589 | f | expected a single row in query result
102590 | f | expected a single row in query result
102591 | f | expected a single row in query result