SQL is wonderful. It's so powerful in such a DWIMMY way. It's probably my favourite language after Perl (no, you're not allowed to disagree with this
However sometimes it's just a little *too* powerful.
For two days now I've been trying to debug why my trigger was deadlocking. It all seemed sensible. But it was doing nasties with selecting from the same table that the trigger was acting on, so I assumed I was causing deadlocks. I cleared out all that code, but alas, that didn't help things!
Then I discovered it:
-- part of my trigger code
UPDATE foo SET foodoo = newfoodoo;
Yes, I forgot the WHERE clause. So I was successfully updating about 2 million rows for every other row being updated/inserted. Needless to say this made my query a little slow.
This has yet again taught me to not assume that the database is broken. My first thought (after removing what could possibly cause a deadlock) was "The database is broken! I found a bug!" . Of course it wasn't, it was doing exactly what I asked it to. Grrrr
On a plus note, postgresql rocks. Aside from one annoying bug (temp tables are useless because plpgsql pre-compiles the table's internal id, thus rendering the fact that the table is temporary completely pointless), it's probably the best database I've ever used (and I've used all the serious ones - Oracle, Sybase, MS SQL Server, DB2, MySQL, SQLite, SAPDB, Firebird, Watcom/SybaseASA).
 Often seen in perl land as "The regexp engine is broken! I found a bug!".