JSqlParser icon indicating copy to clipboard operation
JSqlParser copied to clipboard

support for (date({fn timestampadd(SQL_TSI_YEAR, 2, date("travel_date"))}))

Open karth06 opened this issue 4 years ago • 4 comments

Hi Want to know, do we have support for expressions like (date({fn timestampadd(SQL_TSI_YEAR, 2, date("travel_date"))})) i want to extract column name from the given expression i.e travel_date whenever i parse this expression SQL_TSI_PARSER is also getting considered as column name

karth06 avatar Mar 24 '21 06:03 karth06

SQL_TSI_PARSER? Do you mean SQL_TSI_YEAR? However, JSqlParser does parse this indeed as a column name. How should the parser differ between column names and names of internals?

wumpz avatar Apr 10 '21 21:04 wumpz

I suppose parser can tell differences between the keyword and col by the function timestampadd?

zzt93 avatar Nov 17 '21 12:11 zzt93

Hi! I have the same problem,JSqlParser parses the first argument in functions TIMESTAMPADD, TIMESTAMPDIFF as a column

GilmutdinovRuslan avatar Aug 29 '22 08:08 GilmutdinovRuslan

Since TIMESTAMPADD are in a sense of JSqlParser only identifier names. Therefore it results in a Column object. As I said, the parser is only a parser and has no connection to any DBMS to differ between those things.

You have to do a postparsing and correct those things according to the DBMS you are using.

However, not all DBMS know TIMESTAMPADD.

wumpz avatar Sep 03 '22 19:09 wumpz