mirror of https://github.com/dbcli/pgcli
Fix for #1193 list index out of range on sql comment.
This commit is contained in:
parent
0c24e8bda2
commit
106c6c7bf8
|
@ -13,6 +13,7 @@ Bug fixes:
|
|||
----------
|
||||
|
||||
* Minor typo fixes in `pgclirc`. (Thanks: `anthonydb`_)
|
||||
* Fix for list index out of range when executing commands from a file (#1193). (Thanks: `Irina Truong`_)
|
||||
|
||||
3.0.0
|
||||
=====
|
||||
|
|
|
@ -4,7 +4,7 @@ import sqlparse
|
|||
def query_starts_with(query, prefixes):
|
||||
"""Check if the query starts with any item from *prefixes*."""
|
||||
prefixes = [prefix.lower() for prefix in prefixes]
|
||||
formatted_sql = sqlparse.format(query.lower(), strip_comments=True)
|
||||
formatted_sql = sqlparse.format(query.lower(), strip_comments=True).strip()
|
||||
return bool(formatted_sql) and formatted_sql.split()[0] in prefixes
|
||||
|
||||
|
||||
|
|
|
@ -373,9 +373,9 @@ class PGExecute(object):
|
|||
for sql in sqlparse.split(statement):
|
||||
# Remove spaces, eol and semi-colons.
|
||||
sql = sql.rstrip(";")
|
||||
sql = sqlparse.format(sql, strip_comments=True).strip()
|
||||
if not sql:
|
||||
continue
|
||||
|
||||
try:
|
||||
if pgspecial:
|
||||
# \G is treated specially since we have to set the expanded output.
|
||||
|
|
Loading…
Reference in New Issue