summaryrefslogtreecommitdiff
path: root/tests/backends
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2023-09-22 06:01:11 +0200
committerGitHub <noreply@github.com>2023-09-22 06:01:11 +0200
commit779cd28acb1f7eb06f629c0ea4ded99b5ebb670a (patch)
treebbb25f0c59749eb0d1688bd65f595ee8a0e0d0c0 /tests/backends
parent78b5c9075348aa12da2e024f6ece29d1d652dfdd (diff)
Fixed #34840 -- Avoided casting string base fields on PostgreSQL.
Thanks Alex Vandiver for the report. Regression in 09ffc5c1212d4ced58b708cbbf3dfbfb77b782ca.
Diffstat (limited to 'tests/backends')
-rw-r--r--tests/backends/postgresql/tests.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/backends/postgresql/tests.py b/tests/backends/postgresql/tests.py
index 31aac022c8..a045195991 100644
--- a/tests/backends/postgresql/tests.py
+++ b/tests/backends/postgresql/tests.py
@@ -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