test-suite-sql-eval icon indicating copy to clipboard operation
test-suite-sql-eval copied to clipboard

Support Aliases without 'AS'

Open niryarden opened this issue 1 year ago • 0 comments

As can be seen in this link, both cases:

SELECT * FROM Table AS t
SELECT * FROM Table t

are valid in many SQL versions, yet the second query isn't supported, as can be seen in the code, in the file process_sql.py:

def scan_alias(toks):
    """Scan the index of 'as' and build the map for all alias"""
    as_idxs = [idx for idx, tok in enumerate(toks) if tok == 'as']
    alias = {}
    for idx in as_idxs:
        alias[toks[idx+1]] = toks[idx-1]
    return alias

niryarden avatar Sep 27 '23 12:09 niryarden