Skip to content

Fixed #36947 -- Avoided column alteration for db_comment-only changes. - #21331

Closed
imcatta wants to merge 1 commit into
django:mainfrom
imcatta:ticket_36974
Closed

imcatta wants to merge 1 commit into
django:mainfrom
imcatta:ticket_36974

Conversation

@imcatta

@imcatta imcatta commented May 20, 2026

Copy link
Copy Markdown

Trac ticket number

ticket-36947

Branch description

This branch introduces support for standalone COMMENT ON COLUMN statements on PostgreSQL and Oracle when only a column comment changes. This avoids unnecessary ALTER COLUMN operations, reducing lock severity (SHARE UPDATE EXCLUSIVE instead of ACCESS EXCLUSIVE) and preventing migration failures involving GeneratedFields or columns backed by database views, while preserving the existing fallback behavior for other backends.

AI Assistance Disclosure (REQUIRED)

  • No AI tools were used in preparing this PR.
  • If AI tools were used, I have disclosed which ones, and fully reviewed and verified their output.

Used GPT-5.5 for initial test structure and code review. All code was reviewed, tested, and verified manually.

Checklist

  • This PR follows the contribution guidelines.
  • This PR does not disclose a security vulnerability (see vulnerability reporting).
  • This PR targets the main branch.
  • The commit message is written in past tense, mentions the ticket number, and ends with a period (see guidelines).
  • I have not requested, and will not request, an automated AI review for this PR.
  • I have checked the "Has patch" ticket flag in the Trac system.
  • I have added or updated relevant tests.
  • I have added or updated relevant docs, including release notes if applicable.
  • I have attached screenshots in both light and dark modes for any UI changes.

Changing only a column comment did not require altering the column type or collation on backends that support standalone COMMENT ON COLUMN statements. Using the standalone comment statement avoided unnecessary ALTER COLUMN SQL on PostgreSQL and Oracle while preserving the existing fallback for other backends.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hello! Thank you for your contribution 💪

As it's your first contribution be sure to check out the patch review checklist.

If you're fixing a ticket from Trac make sure to set the "Has patch" flag and include a link to this PR in the ticket!

If you have any design or process questions then you can ask in the Django forum.

Welcome aboard ⛵️!

@tim-mccurrach tim-mccurrach left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@imcatta Thanks for the contribution :)

From a cursory read, this looks like it is logically very similar to the change made by this existing PR. Is there a reason we need a new PR to replace it? The other one just needs a review, so it'd be better to review that one rather than open a brand new PR.

@imcatta

imcatta commented May 20, 2026

Copy link
Copy Markdown
Author

@tim-mccurrach I completely missed the other PR, thanks for pointing it out 🙏
We can close this one and continue with the review there instead.

@imcatta imcatta closed this May 20, 2026
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.

2 participants