summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/schema.py
diff options
context:
space:
mode:
authorlufafajoshua <77637648+lufafajoshua@users.noreply.github.com>2024-12-09 15:37:05 +0300
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-12-17 11:27:25 +0100
commit27375ad50ea3306844aab8122de13e9b3e0d1189 (patch)
tree669b05e97a3967a611af0449ad1a1c8c7abe045f /django/db/backends/postgresql/schema.py
parent0d9872fc9a70ef6966930c68c68febea7eb60ede (diff)
Fixed #35969 -- Disallowed specifying a USING clause for altered generated field.
PostgreSQL versions 16.5 and above no longer permit the use of a USING clause when changing the type of a generated column.
Diffstat (limited to 'django/db/backends/postgresql/schema.py')
-rw-r--r--django/db/backends/postgresql/schema.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/django/db/backends/postgresql/schema.py b/django/db/backends/postgresql/schema.py
index 75bf331472..964009988c 100644
--- a/django/db/backends/postgresql/schema.py
+++ b/django/db/backends/postgresql/schema.py
@@ -120,6 +120,8 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
return None
def _using_sql(self, new_field, old_field):
+ if new_field.generated:
+ return ""
using_sql = " USING %(column)s::%(type)s"
new_internal_type = new_field.get_internal_type()
old_internal_type = old_field.get_internal_type()