Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1erQKd-0000HB-Kg for pgsql-jdbc@arkaria.postgresql.org; Thu, 01 Mar 2018 15:41:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1erQKY-0006GZ-36 for pgsql-jdbc@arkaria.postgresql.org; Thu, 01 Mar 2018 15:41:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eqmem-0007ZK-Jm for pgsql-jdbc@lists.postgresql.org; Tue, 27 Feb 2018 21:19:28 +0000 Received: from n3.nabble.com ([162.255.23.22]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eqmei-0004dV-JC for pgsql-jdbc@postgresql.org; Tue, 27 Feb 2018 21:19:27 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id F1F20B68FD48 for ; Tue, 27 Feb 2018 14:19:21 -0700 (MST) Date: Tue, 27 Feb 2018 14:19:21 -0700 (MST) From: Chris Dole To: pgsql-jdbc@postgresql.org Message-ID: <1519766361988-0.post@n3.nabble.com> Subject: MyBatis Batch Update Leads to PSQLException "Too many update results were returned" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I have a fairly simple implementation of a batch update via the MyBatis functionality. Postgres version (via RDS on Amazon Web Services): 9.6.6 JDBC driver version: 9.4 The error manifests as follows: DataIntegrityViolationException Root cause: BatchUpdateException getNextException: PSQLException - Too many update results were returned. Has anyone else run into this? I have searched far and wide for an explanation (including here) but have not found an answer yet. I assume this error is coming up from the JDBC driver? The curious thing is that the update seems to work (as in database side-effects) but it still throws an exception afterward. Here is a fragment of the MyBatis mapper XML file for the update. The failure can happen for as few as two or three updates, and it can succeed with hundreds. UPDATE public.vid_event_timing SET mark_delete = 1 WHERE visitor_id=#{item.vid} AND timed_node_id=#{item.timedNodeId} AND conditional_node_id= #{item.conditionalNodeId} The MyBatis/Spring configuration includes this session factory bean, set to ExecutorType.BATCH by default. @Bean public SqlSessionTemplate getSqlSessionTemplate() { SqlSessionFactory sessionFactory = null; try { sessionFactory = getMktPersistDesignSqlSessionFactoryBean().getObject(); sessionFactory.getConfiguration().setDefaultExecutorType(ExecutorType.BATCH); } catch (Exception e) { String message = PersistLogUtil.error(logger, "Failed to create SqlSessionTemplate"); throw new RuntimeException(message, e); } SqlSessionTemplate template = new SqlSessionTemplate(sessionFactory); return template; } Thanks for any help. -- Sent from: http://www.postgresql-archive.org/PostgreSQL-jdbc-f2168246.html