Catch errors when trying to EXPLAIN an invalid query. Fixes #3257

This commit is contained in:
Murtuza Zabuawala 2018-04-12 10:50:57 +01:00 committed by Dave Page
parent 79edf40141
commit c08adb5567
7 changed files with 46 additions and 54 deletions

View File

@ -9,6 +9,7 @@ for it.
.. toctree:: .. toctree::
release_notes_3_1
release_notes_3_0 release_notes_3_0
release_notes_2_1 release_notes_2_1
release_notes_2_0 release_notes_2_0

View File

@ -0,0 +1,17 @@
***********
Version 3.1
***********
Release date: 2018-??-??
This release contains a number of features and fixes reported since the release of pgAdmin4 3.0
Features
********
Bug fixes
*********
| `Bug #3257 <https://redmine.postgresql.org/issues/3257>`_ - Catch errors when trying to EXPLAIN an invalid query

View File

@ -1,23 +1,15 @@
EXPLAIN ( EXPLAIN ({% if format -%}
{% if format %}
FORMAT {{ format.upper() }}, FORMAT {{ format.upper() }},
{% endif %} {%- endif %}{% if analyze is defined -%}
{% if analyze is defined %}
ANALYZE {{ analyze }}, ANALYZE {{ analyze }},
{% endif %} {%- endif %}{% if verbose is defined -%}
{% if verbose is defined %}
VERBOSE {{ verbose }}, VERBOSE {{ verbose }},
{% endif %} {%- endif %}{% if costs is defined -%}
{% if costs is defined %}
COSTS {{ costs }}, COSTS {{ costs }},
{% endif %} {%- endif %}{% if timing is defined -%}
{% if timing is defined %}
TIMING {{ timing }}, TIMING {{ timing }},
{% endif %} {%- endif %}{% if summary is defined -%}
{% if summary is defined %}
SUMMARY {{ summary }}, SUMMARY {{ summary }},
{% endif %} {%- endif %}{% if buffers is defined -%}
{% if buffers is defined %}
BUFFERS {{ buffers }} BUFFERS {{ buffers }}
{% endif %} {%- endif %}) {{ sql }}
) {{ sql }}

View File

@ -1,20 +1,13 @@
EXPLAIN ( EXPLAIN ({% if format -%}
{% if format %}
FORMAT {{ format.upper() }}, FORMAT {{ format.upper() }},
{% endif %} {%- endif %}{% if analyze is defined -%}
{% if analyze is defined %}
ANALYZE {{ analyze }}, ANALYZE {{ analyze }},
{% endif %} {%- endif %}{% if verbose is defined -%}
{% if verbose is defined %}
VERBOSE {{ verbose }}, VERBOSE {{ verbose }},
{% endif %} {%- endif %}{% if costs is defined -%}
{% if costs is defined %}
COSTS {{ costs }}, COSTS {{ costs }},
{% endif %} {%- endif %}{% if timing is defined -%}
{% if timing is defined %}
TIMING {{ timing }}, TIMING {{ timing }},
{% endif %} {%- endif %}{% if buffers is defined -%}
{% if buffers is defined %}
BUFFERS {{ buffers }} BUFFERS {{ buffers }}
{% endif %} {%- endif %}) {{ sql }}
) {{ sql }}

View File

@ -1,17 +1,10 @@
EXPLAIN ( EXPLAIN ({% if format -%}
{% if format %}
FORMAT {{ format.upper() }}, FORMAT {{ format.upper() }},
{% endif %} {%- endif %}{% if analyze is defined -%}
{% if analyze is defined %} ANALYZE {{ analyze }},{%- endif %}{% if verbose is defined -%}
ANALYZE {{ analyze }},
{% endif %}
{% if verbose is defined %}
VERBOSE {{ verbose }}, VERBOSE {{ verbose }},
{% endif %} {%- endif %}{% if costs is defined -%}
{% if costs is defined %}
COSTS {{ costs }}, COSTS {{ costs }},
{% endif %} {%- endif %}{% if buffers is defined -%}
{% if buffers is defined %}
BUFFERS {{ buffers }} BUFFERS {{ buffers }}
{% endif %} {%- endif %}) {{ sql }}
) {{ sql }}

View File

@ -1,5 +1 @@
EXPLAIN EXPLAIN {% if analyze %}ANALYZE {% endif %}{{ sql }}
{% if analyze %}
ANALYZE
{% endif %}
{{ sql }}

View File

@ -35,8 +35,8 @@ class TestExplainPlanTemplates(BaseTestGenerator):
), ),
sql_statement='SELECT * FROM places', sql_statement='SELECT * FROM places',
expected_return_value='EXPLAIN ' expected_return_value='EXPLAIN '
'( FORMAT XML, ANALYZE True, ' '(FORMAT XML,ANALYZE True,'
'VERBOSE True, COSTS False, ' 'VERBOSE True,COSTS False,'
'BUFFERS True) SELECT * FROM places' 'BUFFERS True) SELECT * FROM places'
) )
), ),
@ -54,7 +54,7 @@ class TestExplainPlanTemplates(BaseTestGenerator):
), ),
sql_statement='SELECT * FROM places', sql_statement='SELECT * FROM places',
expected_return_value='EXPLAIN ' expected_return_value='EXPLAIN '
'( FORMAT JSON, BUFFERS True) ' '(FORMAT JSON,BUFFERS True) '
'SELECT * FROM places' 'SELECT * FROM places'
) )
), ),
@ -73,7 +73,7 @@ class TestExplainPlanTemplates(BaseTestGenerator):
), ),
sql_statement='SELECT * FROM places', sql_statement='SELECT * FROM places',
expected_return_value='EXPLAIN ' expected_return_value='EXPLAIN '
'( FORMAT JSON, TIMING False, ' '(FORMAT JSON,TIMING False,'
'BUFFERS True) SELECT * FROM places' 'BUFFERS True) SELECT * FROM places'
) )
), ),
@ -93,8 +93,8 @@ class TestExplainPlanTemplates(BaseTestGenerator):
), ),
sql_statement='SELECT * FROM places', sql_statement='SELECT * FROM places',
expected_return_value='EXPLAIN ' expected_return_value='EXPLAIN '
'( FORMAT YAML, TIMING False, ' '(FORMAT YAML,TIMING False,'
'SUMMARY True, BUFFERS True) ' 'SUMMARY True,BUFFERS True) '
'SELECT * FROM places' 'SELECT * FROM places'
) )
), ),