mirror of
https://github.com/django/django.git
synced 2025-09-15 06:55:32 +00:00
Fixed #34840 -- Avoided casting string base fields on PostgreSQL.
Thanks Alex Vandiver for the report.
Regression in 09ffc5c121
.
This commit is contained in:
parent
78b5c90753
commit
779cd28acb
6 changed files with 78 additions and 12 deletions
|
@ -369,6 +369,20 @@ class Tests(TestCase):
|
|||
with self.subTest(lookup=lookup):
|
||||
self.assertIn("::text", do.lookup_cast(lookup))
|
||||
|
||||
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