[MDEV-10007] ERROR 1242 (21000): Subquery returns more than 1 row Created: 2016-04-28  Updated: 2016-05-18  Resolved: 2016-05-18

Status: Closed
Project: MariaDB Server
Component/s: Data Manipulation - Subquery
Affects Version/s: 10.1.13
Fix Version/s: N/A

Type: Bug Priority: Blocker
Reporter: Tristan AURIOL Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: need_feedback
Environment:

debian 8.3 / VMware 6.0



 Description   

I have a big problem with my application.
My application execute this request :

INSERT INTO `mydb`.`service_request` (  `id_z`,  `id_app`,  `request_time`,  `priority` )
(  SELECT sc.`id_z`,         sc.`id_app`,         NOW(),         0 
   FROM `mydb`.`service_connection` sc 
   JOIN `mydb`.`service` s ON ( s.`id_service` = sc.`id_service` ) 
   WHERE 1=1   
   AND sc.`id_app` = _utf8'afr'   
   AND s.`status` = 'available'   
   AND (  sc.`last_synchronized_time` < SUBDATE( NOW(), INTERVAL 600 SECOND )  OR sc.`last_synchronized_time` IS NULL )   
   AND sc.`nb_errors` < 2  
   AND sc.`id_z` NOT IN (
             SELECT sr.`id_z`
             FROM `mydb`.`service_request` sr
             WHERE sr.`id_app` = _utf8'afr'
             AND sr.`status` IN ( 'waiting thu', 'waiting sez', 'in progress' )
           )
 ) ;

This request works well into MySQL 5.6.25-1~dotdeb+7.1 but when I run into 10.1.13-MariaDB-1~jessie-log I have this error:
ERROR 1242 (21000): Subquery returns more than 1 row



 Comments   
Comment by Elena Stepanova [ 2016-04-28 ]

Would you be able to provide the schema/data dump? You could upload it to ftp.askmonty.org/private, this way only MariaDB developers will have access to it.

If you cannot do that, please paste the output of

SHOW CREATE TABLE mydb.service_request;
SHOW INDEX IN mydb.service_request;
SHOW CREATE TABLE mydb.service_connection;
SHOW INDEX IN mydb.service_connection;
SHOW CREATE TABLE mydb.service;
SHOW INDEX IN mydb.service;
EXPLAIN INSERT .... <the full problematic query>;

Thanks.

Comment by Tristan AURIOL [ 2016-05-18 ]

Hello,
Sorry for the delay.
The application does not work because we had a problem with Triger.
You can close the ticket.

Generated at Thu Feb 08 07:38:58 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.