This issue occurs regardless of the publish_via_partition_root=true
Description: PostgreSQL allows partitions to have a different column ordinal_position than their parent table. PostgreSQL itself handles this correctly internally. However, when using logical replication (e.g., pgoutput), some replication clients assume partitions share the same column order as the parent. This can lead to incorrect value-to-column mapping and runtime errors on the subscriber side.
Does it reproduce on the most recent release? Yes, PostgreSQL 18
Steps to Reproduce (PostgreSQL logical replication):
Create a table that will become a partition (columns ordered ip_state before http_code):
Diagnostic Query (compare parent vs partition column order):
WITH parent AS ( SELECT ordinal_position, column_name, data_type FROM information_schema.columns WHERE table_schema ='payment'AND table_name ='payment_orders_test'
),
part AS ( SELECT ordinal_position, column_name, data_type FROM information_schema.columns WHERE table_schema ='payment'AND table_name ='payment_orders_partition_test'
)
SELECT p.ordinal_position AS parent_pos, p.column_name AS parent_col, p.data_type AS parent_type, c.ordinal_position AS part_pos, c.column_name AS part_col, c.data_type AS part_type
FROM parent p
FULLJOIN part c ON p.ordinal_position = c.ordinal_position
WHERECOALESCE(p.column_name,'') <>COALESCE(c.column_name,'')
ORDERBY parent_pos;