-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update parser/deparser weirdness with "function" (postgres context, but expected everywhere) #94
Comments
Can you determine if this Is this a limitation of JSQLParser? From your description, I'm guessing, regrettably, it isn't. |
Hello - I think JSQLParser may be may be parsing correctly, however, Yada Parser may recognize now() as a function and perhaps JSQLParser is providing the function.getParameterList() as a null instead of an empty list. but here is a new case: I get the same nullpointer exception with: insert into person(user521, fullname, email) alternative form below, gets the same exception: insert into person(user521, fullname, email) |
Well - what do you know. .. ! Now I have the 2nd query in the JP batch that fails when it has been working fine all along. So in fact, the failure is on the 3rd query -- which must be: UPDATE STUDY_PERSON_ROLE The unreliability of the parser combined the opacity of this kind of error probably made me lost 3 days in the last 3 weeks -- I bet this version of the query will work like a charm: UPDATE STUDY_PERSON_ROLE Bingo - it parse alright. now, after finagling for 5 hours on this, I forgot the retired_uid in my payload. |
The below simple request fails its Parsing and can never be execute:
update shipment_request set is_retired=1, retired_ts = now(), retired_uid = ?v WHERE reqid = ?n and is_retired=0
It fails with a NullPointerException, on 8.6.1 it is at :
"at com.novartis.opensource.yada.Parser.visit(Parser.java:275)", "at net.sf.jsqlparser.statement.update.Update.accept(Update.java:60)", "at com.novartis.opensource.yada.Parser.deparse(Parser.java:467)", "at com.novartis.opensource.yada.Parser.parseDeparse(Parser.java:393)",
The reason seems to be that the function now() has no parameter. The Parser.java code expects an list of parameters, but somewhat the empty list is coming as Null (a little before line 275?)
Please check for Nulls.
This query works with:
update shipment_request set is_retired=1, retired_uid = ?v WHERE reqid = ?n and is_retired=0
but that is not really valid.
An even better version of the query is:
and since the parser seems to be less precise on the parsing of the case statement, it suddenly works again.
lol though.
The text was updated successfully, but these errors were encountered: