Always validate your input…

Once again I have been reminded to always validate all input. In our database, we store records generated from machines. We have a timeline that lets you view records and reports, that show time summaries.

This morning the testers found some reports which do not show some data that is shown in the timeline. The former data comes from an aggregate table build via table cursors, while the latter comes from the base tables.

Much hunting later, we found the “missing” datawas actually encapsulated in the time span of other data. This should never happen. So when the aggregate table is built (I expect only sometimes) the small event is over written by the larger. So when viewed in the zoomed in timeline you see the small event, but it is not in the report covering the same time.

If we had validation, one of the two entries would have not been loaded into the table, and we would have a error message in a log.

So as long as the logs are reviewed (they are reviewed aren’t they?) - the issue would have been found easier.

As to why we have overlapping data, that’s another mystery, but still I should have been checking the input….