MySQL Error Code: 1054 Unknown column 'field' in 'field list'

masha picture masha · Nov 3, 2016 · Viewed 13.9k times · Source

I keep getting

Error Code: 1054 Unknown column 'originalFieldName' in 'field list'

when trying to insert a new record to a table. This still happens even when I am not inserting any value to this problematic column 'originalFieldName'. Renaming the field and ensuring I don't have unprintable characters like suggested in solutions to this question does not help either.

I have since reduced my query to INSERT INTO incoming(receiptDate) VALUES(NOW()); and deleted some fields to remain with below table: table description but this error 1054 keeps popping up

Answer

masha picture masha · Nov 4, 2016

The error was caused by a trigger which was doing a comparison on 'originalFieldName'. I had forgotten to specify it as new.originalFieldName to refer to the newly inserted value in that field and thus MySQL reported it as unknown column.