JSqlParser icon indicating copy to clipboard operation
JSqlParser copied to clipboard

[BUG]with as (update xxxx) can't be parsed

Open coach00 opened this issue 1 year ago • 2 comments

Failing SQL Feature:

"with as (update xxx)" can't be parsed

the error is

Caused by: java.util.concurrent.ExecutionException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "update" "UPDATE" at line 2, column 9.
Was expecting:
"WITH"

SQL Example:

with s as (
    update t_analyze_pt_detail
    set top         = ?,
        updator     = ?,
        update_time = ?
    where ticket_number = ?
      and removed = false)
    insert
    into t_analyze_pt_detail
    (id,
     ticket_number,
     creator,
     create_time,
     removed,
     top)
    select ?,
           ?,
           ?,
           ?,
           false,
           ? where not exists(
    select 1 from t_analyze_pt_detail
    where ticket_number = ? and removed = false)

the "?" is not important, i have tried with params and got the same bug

Software Information:

  • JSqlParser version:4.7
  • Database:pgsql

coach00 avatar Dec 14 '23 07:12 coach00

Duplicate #1550

manticore-projects avatar Dec 14 '23 16:12 manticore-projects

Duplicate #1550

thanks! Is there any progress on this problem now?

coach00 avatar Dec 15 '23 03:12 coach00