Using a bad Drupal date format results in excess database queries

See the issue someone else filed here. If you use a bad date format, Drupal just keeps on requesting that non-existent date format from the database. If you use a bad format 10 times, that adds 10 queries to the page.

I reviewed their patch and it looks OK. But, I opined:

One question is whether using a non-existent format should thrown an exception or not. Given the use of a fallback format, it seems like the idea is that a formatted date should be returned even if a bad format is used. So, this seems OK to me unless someone suggests logging a warning the first time a non-existent format is used.

Technology