Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql/pg_catalog: fix attname for dropped columns #120861

Merged
merged 1 commit into from Mar 26, 2024

Conversation

Jeremyyang920
Copy link
Collaborator

@Jeremyyang920 Jeremyyang920 commented Mar 21, 2024

Previously, the attname columns for dropped columns was padded used a %8d string format. This led to incorrect behavior as it meant a total of 8 '.' characters inclusive of the column ordinal as compared to the PG code base which always pads with 8 '.'. This affected migration tooling since it attempts to verify column names using the returned attname and led to mismatching column reports.

This commit fixes the issue by explicitly setting the padding to 8 '.' to match the PG implementation.

Fixes: #120855

Release note (bug fix): attname for dropped columns is now properly padded with 8 '.' to match PG.

@Jeremyyang920 Jeremyyang920 requested a review from a team as a code owner March 21, 2024 21:35
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Previously, the attname columns for dropped columns was padded
used a %8d string format. This led to incorrect behavior as it meant
a total of 8 '.' characters inclusive of the column ordinal as compared to
the PG code base which always pads with 8 '.'. This affected migration tooling
since it attempts to verify column names using the returned attname and led to
mismatching column reports.

This commit fixes the issue by explicitly setting the padding to 8 '.' to match
the PG implementation.

Fixes: cockroachdb#120855

Release note (bug fix): attname for dropped columns is now properly padded
with 8 '.' to match PG.
Copy link
Collaborator

@fqazi fqazi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, find! :lgtm:

Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @Jeremyyang920)

@Jeremyyang920
Copy link
Collaborator Author

@rafiss I haven't tagged any backports since not sure how important this would be and can let you make the call on that.

@rafiss
Copy link
Collaborator

rafiss commented Mar 26, 2024

I don't see a need to backport, unless you see it blocking some tool that needs this. I'll merge as-is. thanks for the fix!

bors r+

@craig craig bot merged commit 7247185 into cockroachdb:master Mar 26, 2024
21 of 22 checks passed
@Jeremyyang920 Jeremyyang920 deleted the jyang/fix_pg_attr_padding branch March 26, 2024 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sql/pg_catalog: Fix padding on pg_catalog dropped column attname
4 participants