Question

Can somebody explain to me this... :) (using MySQL 5.6.13)

UPDATE offer SET cosid=1 WHERE id=40;
Query OK, 1 row affected (0.07 sec)
Rows matched: 1  Changed: 1  Warnings: 0

UPDATE offer SET cosid=4 WHERE id=40;
ERROR 1242 (21000): Subquery returns more than 1 row

UPDATE offer SET cosid=5 WHERE id=40;
Query OK, 1 row affected (0.04 sec)
Rows matched: 1  Changed: 1  Warnings: 0

Every valid index is accepted except of four :(

This is offer table:

CREATE TABLE offer (
  id               bigint(20) NOT NULL AUTO_INCREMENT, 
  authorid         bigint(20) NOT NULL, 
  offered_designid bigint(20) NOT NULL, 
  cdid             bigint(20), 
  cosid            bigint(20) NOT NULL, 
  PRIMARY KEY (id), 
  UNIQUE INDEX (id)) ENGINE=InnoDB;

Any suggestion what might be wrong?

EDITED: This is current cos table:

SELECT * FROM cos;
+----+-------------+
| id | offer_state |
+----+-------------+
|  1 | active      |
|  5 | cancelled   |
|  3 | inactive    |
|  4 | realized    |
|  2 | waiting     |
+----+-------------+

5 rows in set (0.00 sec)

Was it helpful?

Solution

As ypercube has stated in the comments, and you have confirmed, triggers are the culprit here!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top