compiler.py 614 B

123456789101112131415161718192021222324
  1. from django.db.models.sql.compiler import ( # isort:skip
  2. SQLAggregateCompiler,
  3. SQLCompiler as BaseSQLCompiler,
  4. SQLDeleteCompiler,
  5. SQLInsertCompiler,
  6. SQLUpdateCompiler,
  7. )
  8. __all__ = [
  9. "SQLAggregateCompiler",
  10. "SQLCompiler",
  11. "SQLDeleteCompiler",
  12. "SQLInsertCompiler",
  13. "SQLUpdateCompiler",
  14. ]
  15. class SQLCompiler(BaseSQLCompiler):
  16. def quote_name_unless_alias(self, name):
  17. if "$" in name:
  18. raise ValueError(
  19. "Dollar signs are not permitted in column aliases on PostgreSQL."
  20. )
  21. return super().quote_name_unless_alias(name)