Michele Grisafi
Michele Grisafi

Reputation: 169

Column in field list is ambiguous when using INSERT INTO with field not even there

I can't believe I'm writing such a question but it is driving me mad. I'm getting the "Error Code: 1052. Column 'id' in field list is ambiguous" message on a query that has nothing to do with such an error!

Here's the table:

CREATE TABLE `test_micro_manufacturing` (
`id_ciccio` smallint unsigned NOT NULL AUTO_INCREMENT,
`supplementation_id` tinyint unsigned NOT NULL DEFAULT '1',
`manufacturing_id` smallint unsigned NOT NULL,
`name` varchar(255) NOT NULL,
 PRIMARY KEY (`id_ciccio`)
) ENGINE=InnoDB;

and here is the query

INSERT INTO `cantieri`.`test_micro_manufacturing` 
              (`id_ciccio`,`supplementation_id`,`manufacturing_id`,`name`) 
        VALUES(1,1,1,"ciao");

Please, help me make sense of how is it possible to get an error on a field that does not even exist on the table, especially when doing an INSERT INTO! Thank you for any help, I appreciate it. EDIT: Here's the sequence to reproduce the error:

CREATE DATABASE test_db;
use test_db;
CREATE TABLE ...
INSERT INTO ....

So the error is executed on a new database, with no triggers present.

Upvotes: 0

Views: 101

Answers (1)

Michele Grisafi
Michele Grisafi

Reputation: 169

As the comments suggested, the issue was in a trigger defined on another database.

Upvotes: 1

Related Questions