Skip to content

fix(autogen): compare identity and computed defaults when compare_server_default is false - #1878

Closed
Fire162 wants to merge 1 commit into
sqlalchemy:mainfrom
Fire162:fix/identity-computed-compare-server-default
Closed

Fire162 wants to merge 1 commit into
sqlalchemy:mainfrom
Fire162:fix/identity-computed-compare-server-default

Conversation

@Fire162

@Fire162 Fire162 commented Oct 14, 2026

Copy link
Copy Markdown

Fixes #1877

Summary of Changes

When comparator plugins were reorganized, _user_compare_server_default() was registered with DispatchPriority.FIRST. If compare_server_default=False (or was omitted, taking the default value False), _user_compare_server_default() immediately returned PriorityDispatchResult.STOP.

Because STOP halts the entire comparator dispatch chain, later comparators (_compare_computed_default() and _compare_identity_default()) were never invoked, preventing autogenerate from detecting changes to Identity columns and emitting warnings for modified Computed columns.

This PR:

  • Updates _user_compare_server_default() to return PriorityDispatchResult.CONTINUE when _user_compare_server_default is not a callable.
  • Moves the check if migration_context._user_compare_server_default is False: return PriorityDispatchResult.STOP into _dialect_impl_compare_server_default(), so that plain server default comparisons are skipped while allowing computed and identity comparators to run.
  • Adds regression unit tests in tests/test_autogen_diffs.py, tests/test_oracle.py, and alembic/testing/suite/test_autogen_identity.py.
  • Adds an unreleased changelog note under docs/build/unreleased/1877.rst.

…ver_default is false

Fix regression from the comparator plugin reorganization where
compare_metadata skipped evaluating identity and computed defaults when
compare_server_default was unset or False. Moving the early STOP check to the
dialect implementation ensures plain server defaults are skipped while
preserving identity and computed defaults comparison.

Fixes: sqlalchemy#1877
@sqla-tester

Copy link
Copy Markdown
Collaborator

Hi, and thanks for the pull request!

This project accepts pull requests only for issues that a maintainer has already marked with the open for pull requests label. That way we can settle on an approach before anyone spends time writing code.

This pull request references issue #1877, which hasn't been marked open for pull requests, so the change isn't authorized yet and I'm closing it automatically. Once a maintainer adds the label to #1877, reopen this pull request and it will stay open. If #1877 needs more detail before that can happen, a complete runnable example is usually the missing piece, and adding one to the issue is the fastest way to get there.

This is automatic and procedural. It isn't a judgment on your change, and nothing you've written here is lost.

Thanks for your interest in the project!

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.

Identity and Computed comparison skipped when compare_server_default is not set, as of 1.18.0

2 participants