mirror of
https://github.com/django/django.git
synced 2025-08-15 16:20:37 +00:00
[5.0.x] Fixed #34840 -- Avoided casting string base fields on PostgreSQL.
Thanks Alex Vandiver for the report. Regression in09ffc5c121
. Backport of779cd28acb
from main.
This commit is contained in:
parent
fb5dd118e9
commit
2566f92544
6 changed files with 78 additions and 15 deletions
|
@ -376,6 +376,20 @@ class Tests(TestCase):
|
|||
"::citext", do.lookup_cast(lookup, internal_type=field_type)
|
||||
)
|
||||
|
||||
def test_lookup_cast_isnull_noop(self):
|
||||
from django.db.backends.postgresql.operations import DatabaseOperations
|
||||
|
||||
do = DatabaseOperations(connection=None)
|
||||
# Using __isnull lookup doesn't require casting.
|
||||
tests = [
|
||||
"CharField",
|
||||
"EmailField",
|
||||
"TextField",
|
||||
]
|
||||
for field_type in tests:
|
||||
with self.subTest(field_type=field_type):
|
||||
self.assertEqual(do.lookup_cast("isnull", field_type), "%s")
|
||||
|
||||
def test_correct_extraction_psycopg_version(self):
|
||||
from django.db.backends.postgresql.base import Database, psycopg_version
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue