Skip navigation links

MySQL Forums :: Perl :: Unknown column 'subtest_id' in 'NEW'


Advanced Search

Unknown column 'subtest_id' in 'NEW'
Posted by: Prashant Tekriwal ()
Date: September 04, 2013 06:22AM

Hi,

I have the following trigger in my mysql database:

-------------------------------------------------------------

CREATE TRIGGER set_subtest_id BEFORE INSERT ON subtest
FOR EACH ROW
BEGIN
UPDATE seq SET id = id + 1;
SET new.subtest_id = (SELECT id FROM seq); <-- Failure is happening here
SET new.time_begin = UNIX_TIMESTAMP(NOW());
IF new.visible_id = -1 AND new.hidden_results = 1 THEN
SET new.visible_id = new.subtest_id;
ELSEIF new.visible_id = -1 THEN
SET new.visible_id = (SELECT visible_id FROM subtest WHERE subtest_id = new.subtest_parent_id);
END IF;
INSERT INTO contains VALUES (new.subtest_id, new.subtest_id);
END; |

-----------------------------------------------------------------------

This above trigger has been working fine for over a year and now suddenly I have started seeing intermittent issue with this trigger.

I assume the error is happening at the point I have marked above ( <-- ).

I sometimes see the following error in my logs:

DBD::mysql::db do failed: Unknown column 'subtest_id' in 'NEW'

This issue is not easily reproducible and I have seen this error only several times till now.

The same set of code is working fine sometimes and sometimes it fails with above error.

I am using Mysql Server 5.6.

Can anybody help me finding out what is the issue?

Let me know if any other information is needed.

Thanks

Options: ReplyQuote


Subject Written By Posted
Unknown column 'subtest_id' in 'NEW' Prashant Tekriwal 09/04/2013 06:22AM
Re: Unknown column 'subtest_id' in 'NEW' Peter Brawley 09/04/2013 10:12AM
Re: Unknown column 'subtest_id' in 'NEW' Rick James 09/06/2013 08:31AM
Re: Unknown column 'subtest_id' in 'NEW' Prashant Tekriwal 09/10/2013 07:27AM
Re: Unknown column 'subtest_id' in 'NEW' Rick James 09/12/2013 09:37PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.