Ok, here it is (just the SQL, postgres only). As I said before, this is far from being complete and not very nice. But you can play with it (just add stuff to the TEST section).
As you'll notice I'm a little bit out of practice with SQL and I have zero experience with Postgres / plpgsql. So don't blame me for that.
NOTE: All database objects are prefixed cat_ or cat__, so it may destroy whatever you have if you're using a non empty database.
http://www.thebernd.de/thebernd/categories-create.sql
http://www.thebernd.de/thebernd/categories-drop.sql
Next thing Timo and I want to do is to add some geospatial stuff.
I'll add more comments later.
Thanks for any comments and references (geospatial, etc.)!