Bugs I ran into this week

(1) My compiler was not checking that stored procedures ( which are not meant to return a value ) did not in fact return a value. I happened to notice while looking at the code, so I fixed that ( it would mean a value was left lying around on the interpreter stack that should not be there ). Then I was surprised to find that one of my websites wasn't working... turned out I actually had superfluous "RETURNS string" in several places it should not have been.

(2) Testing unusually small page sizes I ran into a bug in my code which is meant to divide the records for a page into two. It needed to put at least one record into each half, but there was a gap in the logic which meant it could end up with all the records in one half.

I was slightly surprised to find latent bugs in code that had apparently been working ok for several years. How often does this happen to you? Did you find any bugs this week?

1 Like

These bugs often surface when a new feature is added, when the system is used in an unexpected way, or during refactoring, as in your case with the stored procedures.

1 Like

Yes, the first one was a case of that, I changed the language syntax to only have functions (rather than a different keyword for functions that do not return a value), but in the re-factoring process forgot to add the required check (which wasn't needed up to that point ). Then I didn't notice the omission for about 2 years.