File tree Expand file tree Collapse file tree
django/db/backends/postgresql
tests/backends/postgresql Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -151,6 +151,12 @@ def uses_server_side_binding(self):
151151 options = self .connection .settings_dict ["OPTIONS" ]
152152 return is_psycopg3 and options .get ("server_side_binding" ) is True
153153
154+ @cached_property
155+ def max_query_params (self ):
156+ if self .uses_server_side_binding :
157+ return 2 ** 16 - 1
158+ return None
159+
154160 @cached_property
155161 def prohibits_null_characters_in_text_exception (self ):
156162 if is_psycopg3 :
Original file line number Diff line number Diff line change 1+ import unittest
2+
3+ from django .db import connection
4+ from django .test import TestCase
5+
6+
7+ @unittest .skipUnless (connection .vendor == "postgresql" , "PostgreSQL tests" )
8+ class FeaturesTests (TestCase ):
9+ def test_max_query_params_respects_server_side_params (self ):
10+ if connection .features .uses_server_side_binding :
11+ limit = 2 ** 16 - 1
12+ else :
13+ limit = None
14+ self .assertEqual (connection .features .max_query_params , limit )
You can’t perform that action at this time.
0 commit comments