JSqlParser icon indicating copy to clipboard operation
JSqlParser copied to clipboard

PGSQL CCJSqlParserUtil.parse can't parse ||

Open cjran704 opened this issue 3 years ago • 1 comments

Describe the bug PGSQL CCJSqlParserUtil.parse can't parse ||

To Reproduce Steps to reproduce the behavior:

  1. select id,name from test where name like '%'||?||'%'
  2. JSqlParser 4.3
  3. net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "||" <OP_CONCAT>

Expected behavior A clear and concise description of what you expected to happen.

System

  • Postgresql 11.8
  • jdk 1.8
  • JSqlParser 4.3

cjran704 avatar Feb 07 '22 10:02 cjran704

?| is a JSON operator in JSqlParser. The parser cannot split ?|| to ? ||. So you will be able to parse the expression if you insert whitespaces:

select id,name from test where name like '%' || ? || '%'

wumpz avatar Feb 18 '22 21:02 wumpz

Closed, since no further question has been asked.

manticore-projects avatar Nov 12 '22 06:11 manticore-projects