当前使用版本(必填,否则不予处理)
3.5.1
该问题是如何引起的?(确定最新版也有问题再提!!!)
有许多 PostgreSQL 运算符包含问号。要防止 SQL 语句中的此类问号被解释为占位符, 会用到 双问号转义。 导致分页插件优化语句无法解析
重现步骤(如果有就写完整)
1.使用PostgreSQL数据库 表结构
CREATE TABLE "public"."auth_user" (
"id" int8 NOT NULL,
"dept_id" jsonb,
CONSTRAINT "auth_user_pkey" PRIMARY KEY ("id")
)
在程序中编写 sql
SELECT * FROM auth_user WHERE dept_id ??| array['1', '2']
执行报警告无法优化SQL
报错信息
2022-05-16 17:35:26.982 WARN 80171 --- [nio-9000-exec-3] c.b.m.e.p.i.PaginationInnerInterceptor : optimize this sql to a count sql has exception, sql:"SELECT id, dept_id FROM auth_user WHERE auth_user.dept_id ??| ARRAY['1', '2']", exception:
net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "?" "?"
at line 1, column 376.
Was expecting one of:
"&"
"::"
";"
"<<"
">>"
"COLLATE"
"CONNECT"
"EMIT"
"GROUP"
"HAVING"
"START"
"["
"^"
"|"
<EOF>
Comment From: miemieYaho
net.sf.jsqlparser.parser.ParseException