From 71693c94d52612a5e88128575ff308ee4a923c00 Mon Sep 17 00:00:00 2001 From: Federico Caselli Date: Wed, 22 Feb 2023 21:57:19 +0100 Subject: ExcludeConstraint literal_compile ExcludeConstraint correctly uses literal compile when compiling expression ddl. Fixes: #9349 Change-Id: I11a994ac46556a972afc696a2baad7ddbdd3de97 --- lib/sqlalchemy/dialects/postgresql/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/dialects/postgresql/base.py') diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index 255c72042..3ba103802 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -2350,8 +2350,9 @@ class PGDDLCompiler(compiler.DDLCompiler): constraint ) elements = [] + kw["include_table"] = False + kw["literal_binds"] = True for expr, name, op in constraint._render_exprs: - kw["include_table"] = False exclude_element = self.sql_compiler.process(expr, **kw) + ( (" " + constraint.ops[expr.key]) if hasattr(expr, "key") and expr.key in constraint.ops -- cgit v1.2.1