mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Allow 'explain query plan' with more whitespace, closes #1588
This commit is contained in:
parent
8c401ee0f0
commit
63537dd3de
2 changed files with 6 additions and 4 deletions
|
|
@ -162,11 +162,11 @@ class InvalidSql(Exception):
|
||||||
|
|
||||||
allowed_sql_res = [
|
allowed_sql_res = [
|
||||||
re.compile(r"^select\b"),
|
re.compile(r"^select\b"),
|
||||||
re.compile(r"^explain select\b"),
|
re.compile(r"^explain\s+select\b"),
|
||||||
re.compile(r"^explain query plan select\b"),
|
re.compile(r"^explain\s+query\s+plan\s+select\b"),
|
||||||
re.compile(r"^with\b"),
|
re.compile(r"^with\b"),
|
||||||
re.compile(r"^explain with\b"),
|
re.compile(r"^explain\s+with\b"),
|
||||||
re.compile(r"^explain query plan with\b"),
|
re.compile(r"^explain\s+query\s+plan\s+with\b"),
|
||||||
]
|
]
|
||||||
allowed_pragmas = (
|
allowed_pragmas = (
|
||||||
"database_list",
|
"database_list",
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,9 @@ def test_validate_sql_select_bad(bad_sql):
|
||||||
"select '# Hello there\n\n* This is a list\n* of items\n--\n[And a link](https://github.com/simonw/datasette-render-markdown).'\nas demo_markdown",
|
"select '# Hello there\n\n* This is a list\n* of items\n--\n[And a link](https://github.com/simonw/datasette-render-markdown).'\nas demo_markdown",
|
||||||
"select 1 + 1",
|
"select 1 + 1",
|
||||||
"explain select 1 + 1",
|
"explain select 1 + 1",
|
||||||
|
"explain\nselect 1 + 1",
|
||||||
"explain query plan select 1 + 1",
|
"explain query plan select 1 + 1",
|
||||||
|
"explain query plan\nselect 1 + 1",
|
||||||
"SELECT\nblah FROM foo",
|
"SELECT\nblah FROM foo",
|
||||||
"WITH RECURSIVE cnt(x) AS (SELECT 1 UNION ALL SELECT x+1 FROM cnt LIMIT 10) SELECT x FROM cnt;",
|
"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 WITH RECURSIVE cnt(x) AS (SELECT 1 UNION ALL SELECT x+1 FROM cnt LIMIT 10) SELECT x FROM cnt;",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue