3

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

Community
  • 1
  • 1
ken macharia
  • 71
  • 1
  • 1
  • 7

2 Answers2

4

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.

ken macharia
  • 71
  • 1
  • 1
  • 7
0

Are you using mysql ? If you are using mysql then there could be a difference in back tick ( `someValue ` ) . Keep considering this point and see if it helps . If you are using other DB then please let me know . It seems some invisible characters has been introduced there . May be you have copied it from somewhere . Please let me know DB details and paste full code.

Manish Kumar
  • 595
  • 2
  • 15
  • Why it has been down voted ? Do you know what does it means ? – Manish Kumar Nov 03 '16 at 15:31
  • Probably because this shouldn't be an answer but a comment. If anything, I don't think your answer has anything to do with OP's problem. (I'm not the one who downvoted though) – Jens Nov 03 '16 at 15:42
  • Backticks have nothing to do with this issue. Try to replicate and see for yourself. I didn't downvote, but you did provide a wrong answer. – Mjh Nov 03 '16 at 16:05
  • sometimes if we copy code from somewhere then we get some other character at place of quote or back tick . I used the word COULD not MUST. – Manish Kumar Nov 03 '16 at 16:47
  • There is a difference between (“`”) and ("`") – Manish Kumar Nov 03 '16 at 16:49
  • I did not have much reputation to comment there , so i have thought to give an answer so that he will get a way which may be true .. – Manish Kumar Nov 03 '16 at 16:52
  • @ManishSoni someone (not me) probably downvoted you because you were not keen in reading the question. One, I don't have backticks in the insert query I provided. Two, my question starts with "MySQL Error..." so there was no reason to ask if I am using mysql – ken macharia Nov 04 '16 at 13:38