mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
sql: use last " as " to find name token for column
We were using the first ' as ', which causes problems for the following types of lines CAST(SUM(of.debit) AS BIGINT) as debit
This commit is contained in:
@@ -110,7 +110,7 @@ def colname_htable(query):
|
||||
for colnum, colname in enumerate(colnames):
|
||||
colname = colname.strip()
|
||||
# SELECT xxx AS yyy -> Y
|
||||
as_clause = colname.upper().find(" AS ")
|
||||
as_clause = colname.upper().rfind(" AS ")
|
||||
if as_clause != -1:
|
||||
colname = colname[as_clause + 4:].strip()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user