pgjdbc / r2dbc-postgresql

Postgresql R2DBC Driver

Home Page:https://r2dbc.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use "not in" ?

q1208c opened this issue · comments

commented

I am new to java and springboot, just copy a sample code from Internet.
when I try update a table with a List , the exception like bellow.
I think it must my fault, I try search, but not found any usable answer.

13:05:35.860 [reactor-tcp-epoll-1] ERROR reactor.core.publisher.Operators(324) - Operator called default onErrorDropped
reactor.core.Exceptions$ErrorCallbackNotImplemented: org.springframework.r2dbc.BadSqlGrammarException: executeMany; bad SQL grammar [UPDATE t_migu_vhost_list SET c_deleted = true WHERE c_migu_id = $1       AND c_dom_uuid NOT IN(  )]; nested exception is io.r2dbc.postgresql.ExceptionFactory$PostgresqlBadGrammarException: [42601] syntax error at or near ")"
Caused by: org.springframework.r2dbc.BadSqlGrammarException: executeMany; bad SQL grammar [UPDATE t_migu_vhost_list SET c_deleted = true WHERE c_migu_id = $1       AND c_dom_uuid NOT IN(  )]; nested exception is io.r2dbc.postgresql.ExceptionFactory$PostgresqlBadGrammarException: [42601] syntax error at or near ")"

Is there is a right syntax for me?

any suggestion is appreciate.

sorry for my pool English. -_-!

commented

when I remove the (), the exception was bellow.

13:50:04.115 [reactor-tcp-epoll-1] ERROR reactor.core.publisher.Operators(324) - Operator called default onErrorDropped
reactor.core.Exceptions$ErrorCallbackNotImplemented: org.springframework.r2dbc.BadSqlGrammarException: executeMany; bad SQL grammar [UPDATE t_migu_vhost_list SET c_deleted = false WHERE c_migu_id = $1       AND c_dom_uuid IN $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12 ]; nested exception is io.r2dbc.postgresql.ExceptionFactory$PostgresqlBadGrammarException: [42601] syntax error at or near "$2"
Caused by: org.springframework.r2dbc.BadSqlGrammarException: executeMany; bad SQL grammar [UPDATE t_migu_vhost_list SET c_deleted = false WHERE c_migu_id = $1       AND c_dom_uuid IN $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12 ]; nested exception is io.r2dbc.postgresql.ExceptionFactory$PostgresqlBadGrammarException: [42601] syntax error at or near "$2"
commented

Sorry ! My fault!
This list may empty, so ,the exception throw out.
I add the !isEmpty first ,all is OK.