﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
37535	Model._perform_unique_checks() uses the default connection's features instead of the routed database's	nehmtech		"`Model._perform_unique_checks()` decides whether to skip a lookup for an empty string using `connection.features.interprets_empty_strings_as_nulls`, where `connection` is the default database connection.

However, the uniqueness query that follows is routed through `DATABASE_ROUTERS` (via `model_class._default_manager.db`). When reads are routed to a database whose backend differs from the default one (for example Oracle alongside PostgreSQL), the empty-string check uses the wrong backend's behavior, so validation can skip or run the uniqueness query incorrectly.

There was already a `TODO: Handle multiple backends with different feature flags` at that spot. Other code, such as `UniqueConstraint.validate()` and related managers, already resolves `features` from the routed database alias.

Steps to reproduce: configure two databases with different values of `features.interprets_empty_strings_as_nulls`, add a router whose `db_for_read()` returns the non-default alias, and call `validate_unique()` on an instance with an empty string in a unique `CharField`. Whether the query runs depends on the default database rather than the routed one.

Patch: https://github.com/nehmtech/django/tree/unique-checks-routed-db-features"	Bug	new	Database layer (models, ORM)	dev	Normal		multi-db, validate_unique, router	nehmtech	Unreviewed	1	0	0	0	0	0
