diff options
| author | Tim Graham <timograham@gmail.com> | 2025-12-03 18:06:53 -0500 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2025-12-04 11:37:22 -0500 |
| commit | 17d644c8e257c2ea5cc738fb7a9c47989e29bf09 (patch) | |
| tree | 8cd96b4668e5334dc11a056b3c293e8e8579df45 /django/db/models/sql | |
| parent | 26b0e2bb92caf2d16cabe455792350f20d6f42ca (diff) | |
Added DatabaseFeatures.prohibits_dollar_signs_in_column_aliases.
This is also applicable on CockroachDB.
Diffstat (limited to 'django/db/models/sql')
| -rw-r--r-- | django/db/models/sql/compiler.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index 20f06ad168..9068d87a89 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -553,6 +553,14 @@ class SQLCompiler: for table names. This avoids problems with some SQL dialects that treat quoted strings specially (e.g. PostgreSQL). """ + if ( + self.connection.features.prohibits_dollar_signs_in_column_aliases + and "$" in name + ): + raise ValueError( + "Dollar signs are not permitted in column aliases on " + f"{self.connection.display_name}." + ) if name in self.quote_cache: return self.quote_cache[name] if ( |
