You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importalasqlfrom"alasql";constsql=`SELECT title, LENGTH(title) AS length FROM ?`.trim()constast=alasql.parse(sql);console.log(ast.toString())// Will output:// SELECT title, LENGTH(title) AS length AS length FROM $0 AS default
For my own rushing needs, here's how I temporarily hacked around it :)
functionfixDoubleAliases(sql: string): string{// Necessary because of https://github.com/agershun/alasql/issues/1426constdupes=newSet<string>();for(constmatchofsql.match(/\sAS \w+/g)||[]){if(dupes.has(match)){sql=sql.replace(match,"");}dupes.add(match);}returnsql;}
Steps to reproduce:
Note the double
AS length
Demo here:
https://codesandbox.io/s/sleepy-poincare-5t0jd?file=/src/App.tsx
The text was updated successfully, but these errors were encountered: