Allow EXPLAIN WITH... - closes #583

pull/589/head
Simon Willison 2019-10-06 10:23:58 -07:00
rodzic a314b76186
commit fffd69ec03
2 zmienionych plików z 6 dodań i 0 usunięć

Wyświetl plik

@ -167,6 +167,8 @@ allowed_sql_res = [
re.compile(r"^explain select\b"),
re.compile(r"^explain query plan select\b"),
re.compile(r"^with\b"),
re.compile(r"^explain with\b"),
re.compile(r"^explain query plan with\b"),
]
disallawed_sql_res = [(re.compile("pragma"), "Statement may not contain PRAGMA")]

Wyświetl plik

@ -151,8 +151,12 @@ def test_validate_sql_select_bad(bad_sql):
"select count(*) from airports",
"select foo from bar",
"select 1 + 1",
"explain select 1 + 1",
"explain query plan select 1 + 1",
"SELECT\nblah FROM foo",
"WITH RECURSIVE cnt(x) AS (SELECT 1 UNION ALL SELECT x+1 FROM cnt LIMIT 10) SELECT x FROM cnt;",
"explain WITH RECURSIVE cnt(x) AS (SELECT 1 UNION ALL SELECT x+1 FROM cnt LIMIT 10) SELECT x FROM cnt;",
"explain query plan WITH RECURSIVE cnt(x) AS (SELECT 1 UNION ALL SELECT x+1 FROM cnt LIMIT 10) SELECT x FROM cnt;",
],
)
def test_validate_sql_select_good(good_sql):