First of all, your source code is correct. You should keep in mind:
JSqlParser is a parser only . So if you do something like
select col1 from table1
The Column object created by the parser does not know its name. This will only be the case if you write it in full:
select table1.col1 from table1
Similar behavior occurs with aliases. JSqlParser does not extend alias definitions .
Why? If you look at this example, which is the correct SQL:
select col1 from table1, table2
it becomes clear that to calculate the table to which the column belongs, the database schema itself is needed.
wumpz
source share