Rewrite time_partitions join clause to avoid smallint[] operator

pull/4725/head
Marco Slot 2021-02-18 11:51:30 +01:00
parent b0aeb41d4e
commit 972a8bc0b7
2 changed files with 4 additions and 2 deletions

View File

@ -5,12 +5,13 @@ FROM (
FROM pg_class c
JOIN pg_inherits i ON (c.oid = inhrelid)
JOIN pg_partitioned_table p ON (inhparent = partrelid)
JOIN pg_attribute a ON (partrelid = attrelid AND ARRAY[attnum] <@ string_to_array(partattrs::text, ' ')::int2[])
JOIN pg_attribute a ON (partrelid = attrelid)
JOIN pg_type t ON (atttypid = t.oid)
JOIN pg_namespace tn ON (t.typnamespace = tn.oid)
LEFT JOIN pg_am am ON (c.relam = am.oid),
pg_catalog.time_partition_range(c.oid)
WHERE c.relpartbound IS NOT NULL AND p.partstrat = 'r' AND p.partnatts = 1
AND a.attnum = ANY(partattrs::int2[])
) partitions
ORDER BY partrelid::text, lower_bound;

View File

@ -5,12 +5,13 @@ FROM (
FROM pg_class c
JOIN pg_inherits i ON (c.oid = inhrelid)
JOIN pg_partitioned_table p ON (inhparent = partrelid)
JOIN pg_attribute a ON (partrelid = attrelid AND ARRAY[attnum] <@ string_to_array(partattrs::text, ' ')::int2[])
JOIN pg_attribute a ON (partrelid = attrelid)
JOIN pg_type t ON (atttypid = t.oid)
JOIN pg_namespace tn ON (t.typnamespace = tn.oid)
LEFT JOIN pg_am am ON (c.relam = am.oid),
pg_catalog.time_partition_range(c.oid)
WHERE c.relpartbound IS NOT NULL AND p.partstrat = 'r' AND p.partnatts = 1
AND a.attnum = ANY(partattrs::int2[])
) partitions
ORDER BY partrelid::text, lower_bound;