summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmjith Ramanujam <amjith@newrelic.com>2014-12-24 01:52:11 -0800
committerAmjith Ramanujam <amjith@newrelic.com>2014-12-24 01:52:11 -0800
commitd629c2d035058679b69b4422cc977c545db6a737 (patch)
tree9b19e1b347d1079c3f35e5352ee3e0c15896cae3
parent7df2f4a946e8357bb78fa40888eb07b34a4957a6 (diff)
Fix the failing parseutils test.
-rw-r--r--pgcli/packages/parseutils.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/pgcli/packages/parseutils.py b/pgcli/packages/parseutils.py
index 3209e3f2..bc9c6e47 100644
--- a/pgcli/packages/parseutils.py
+++ b/pgcli/packages/parseutils.py
@@ -81,6 +81,8 @@ def extract_from_part(parsed):
elif item.ttype is Keyword and item.value.upper() in ('FROM', 'INTO',
'UPDATE', 'TABLE', ):
tbl_prefix_seen = True
+ # 'SELECT a, FROM abc' will detect FROM as part of the column list.
+ # So this check here is necessary.
elif isinstance(item, IdentifierList):
for identifier in item.get_identifiers():
if identifier.ttype is Keyword and identifier.value.upper() == 'FROM':
@@ -92,8 +94,10 @@ def extract_table_identifiers(token_stream):
if isinstance(item, IdentifierList):
for identifier in item.get_identifiers():
yield identifier.get_real_name()
- elif isinstance(item, Identifier) or isinstance(item, Function):
+ elif isinstance(item, Identifier):
yield item.get_real_name()
+ elif isinstance(item, Function):
+ yield item.get_name()
# It's a bug to check for Keyword here, but in the example
# above some tables names are identified as keywords...
elif item.ttype is Keyword: