mirror of
https://github.com/apache/superset.git
synced 2026-06-08 17:19:20 +00:00
fix: prevent anonymous code in Postgres (#34412)
This commit is contained in:
@@ -654,6 +654,16 @@ class SQLStatement(BaseSQLStatement[exp.Expression]):
|
||||
if isinstance(self._parsed, exp.Command) and self._parsed.name == "ALTER":
|
||||
return True # pragma: no cover
|
||||
|
||||
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