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:
niftynei 2022-07-19 14:35:26 +09:30 committed by Rusty Russell
parent 75c89f0b8e
commit 967c56859f
1 changed files with 1 additions and 1 deletions

View File

@ -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()