JacobZheng0927 opened a new issue, #13033: URL: https://github.com/apache/seatunnel/issues/13033
### What happened `BufferReducedBatchStatementExecutor.prepareStatements` eagerly prepares both upsert and DELETE statements. A JDBC writer doing only INSERT/UPDATE therefore fails on databases that check DELETE privileges during statement preparation, even though it never needs DELETE. The same issue occurs if a buffered DELETE is overwritten by a later INSERT for the same key before the batch executes. ### Reproduction On MySQL 8.0.43, create a target table with a primary key and grant a writer user SELECT, INSERT, UPDATE but no DELETE. Configure its JDBC connection with `useServerPrepStmts=true&emulateUnsupportedPstmts=false` and enable generated primary-key upserts. Writer initialization fails while preparing DELETE. Direct preparation by the restricted user reports MySQL error 1142. Checked against current `dev` (`cec3276740d9`). ### Expected behavior Only prepare DELETE when a retained DELETE is actually about to execute. Upsert-only and reduced-away-delete batches should succeed with their existing privileges; a real DELETE must still fail if permission is absent. Preparing a new connection must reset the lazy statement lifecycle, including cleanup of delegates. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
