Skip to content

sql/pg_catalog: Fix padding on pg_catalog dropped column attname #120855

@Jeremyyang920

Description

@Jeremyyang920

Describe the problem

There is a discrepancy between PG and CRDB in the attname atrribute for dropped columns. In the CRDB implementation now we use %8d to create the padding but that results in 1 . too few as PG always has 8. https://github.com/postgres/postgres/blob/57184c3b5d89763c882a15adfcdb00990a09d382/src/backend/catalog/heap.c#L1708

To Reproduce

Set up a PG and CRDB instance and create the same table definition. Drop a column and query pg_attributes for the dropped column attname.

SELECT attname, atttypid, attnotnull, collname FROM pg_attribute LEFT OUTER JOIN pg_collation ON (pg_collation.oid = pg_attribute.attcollation) WHERE attrelid = <table_oid> AND attnum > 0 ORDER BY attnum;

Expected behavior
Both the PG and CRDB query should return the same attname.

Jira issue: CRDB-36904

Metadata

Metadata

Assignees

Labels

C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions