summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--changelog.rst2
-rw-r--r--pgcli/main.py2
-rw-r--r--pgcli/pgexecute.py2
4 files changed, 7 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
index 034a1ea3..4bf482de 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -98,6 +98,7 @@ Contributors:
* Telmo "Trooper" (telmotrooper)
* Alexander Zawadzki
* Pablo A. Bianchi (pabloab)
+ * Sebastian Janko (sebojanko)
Creator:
--------
diff --git a/changelog.rst b/changelog.rst
index 467afe73..4947bd02 100644
--- a/changelog.rst
+++ b/changelog.rst
@@ -10,6 +10,7 @@ Bug fixes:
----------
* Error connecting to PostgreSQL 12beta1 (#1058). (Thanks: `Irina Truong`_)
+* Empty query caused error message (Thanks: `Sebastian Janko`_)
2.1.1
=====
@@ -993,3 +994,4 @@ Improvements:
.. _`VVelox`: https://github.com/VVelox
.. _`Telmo "Trooper"`: https://github.com/telmotrooper
.. _`Alexander Zawadzki`: https://github.com/zadacka
+.. _`Sebastian Janko`: https://github.com/sebojanko
diff --git a/pgcli/main.py b/pgcli/main.py
index fdbbc15c..27ca09b7 100644
--- a/pgcli/main.py
+++ b/pgcli/main.py
@@ -859,6 +859,8 @@ class PGCli(object):
text, self.pgspecial, exception_formatter, on_error_resume
)
+ is_special = None
+
for title, cur, headers, status, sql, success, is_special in res:
logger.debug("headers: %r", headers)
logger.debug("rows: %r", cur)
diff --git a/pgcli/pgexecute.py b/pgcli/pgexecute.py
index b3ebb5c0..9e6c4b7c 100644
--- a/pgcli/pgexecute.py
+++ b/pgcli/pgexecute.py
@@ -376,6 +376,8 @@ class PGExecute(object):
for sql in sqlparse.split(statement):
# Remove spaces, eol and semi-colons.
sql = sql.rstrip(";")
+ if not sql:
+ continue
try:
if pgspecial: