JSqlParser icon indicating copy to clipboard operation
JSqlParser copied to clipboard

Can support "FOR UPDATE SKIP LOCKED"?

Open jimmy384 opened this issue 3 years ago • 1 comments
trafficstars

It seems not support "SKIP LOCKED". The following two SQL can execute normally in MySql8, but parse failed by JSqlParser.

SELECT * FROM t_user FOR UPDATE SKIP LOCKED;
SELECT * FROM t_user FOR UPDATE OF t_user SKIP LOCKED;
Caused by: java.util.concurrent.ExecutionException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "SKIP" "SKIP"
    at line 1, column 35.

Was expecting one of:

    ";"
    "NOWAIT"
    "OF"
    <EOF>

Can JSqlParser add support for "SKIP LOCKED"?

jimmy384 avatar Aug 04 '22 03:08 jimmy384

PostgreSQL also supports this (unfortunately, I don't have any SQL standard grammars > 2003 so I can't check when it was added. It did not exist in sql2003.

d2a-raudenaerde avatar Aug 05 '22 08:08 d2a-raudenaerde

Hi. I've implemented the support for SKIP LOCKED tokens through the PR above. Can anyone check it and let me know if everything is OK?

lucasdillmann avatar Oct 19 '22 21:10 lucasdillmann

Seems OK. I merged it. Use as a final commit something like fixes #issue then the issue will be closed automatically after merge.

wumpz avatar Oct 25 '22 23:10 wumpz

Hi @wumpz, thanks for the review, merge and the feedback on the commit message.

lucasdillmann avatar Oct 26 '22 14:10 lucasdillmann