Hair-Trigger

I spent most of my morning chasing a sneaky little bug. Basically, once upon a time one of our tables contained a column (to protect the innocent, let's say it was called Meaningless_Data). Several months ago, my team removed the column from the DB schema as well as all references to it in the code.

I grabbed the changes and continued on my merry way... until today, which apparently is the first time I've tried to use a function that touches that particular table. I kept getting an error:

Type: Database
Message: Error Executing Database Query.
Detail: Invalid column name 'Meaningless_Data'.

So it's looking for the column and not finding it. Not surprising, since we deliberately deleted it a long time ago. I triple-checked the code, but couldn't find a single reference to Meaningless_Data in any SQL statement (or anywhere else in the codebase, for that matter).

I drove myself batty for way too long before copying the query straight from CFCATCH.SQL and manually running it against my local DB. Same error. Okay, it's not a Coldfusion issue...

Then I ran it against the DB on our development server. Worked like a charm. Getting warmer...

I generated SQL scripts for the table on each machine and diffed them, and the culprit was revealed. A trigger was pointing to the missing column, and was firing every time I touched the table. The other developer had updated the triggers on his local DB and the dev server, but when I grabbed the schema and code updates, I didn't think to look there.

File under lessons learned.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
BlogCFC was created by Raymond Camden. This blog is running version 5.9.002. Contact Blog Owner