mirror of
https://github.com/apache/superset.git
synced 2026-05-08 09:25:56 +00:00
fix: prevent anonymous code in Postgres (#34412)
(cherry picked from commit 6fc734da51)
This commit is contained in:
committed by
Michael S. Molina
parent
8c9489d72f
commit
d8b01c668f
@@ -382,6 +382,16 @@ class SQLStatement(BaseSQLStatement[exp.Expression]):
|
||||
if isinstance(node, exp.Command) and node.name == "ALTER":
|
||||
return True
|
||||
|
||||
if (
|
||||
self._dialect == Dialects.POSTGRES
|
||||
and isinstance(self._parsed, exp.Command)
|
||||
and self._parsed.name == "DO"
|
||||
):
|
||||
# anonymous blocks can be written in many different languages (the default
|
||||
# is PL/pgSQL), so parsing them it out of scope of this class; we just
|
||||
# assume the anonymous block is mutating
|
||||
return True
|
||||
|
||||
# Postgres runs DMLs prefixed by `EXPLAIN ANALYZE`, see
|
||||
# https://www.postgresql.org/docs/current/sql-explain.html
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user