While playing with Drupal, I got some problem with the forum. The listing show’s that there’s one topic in the category but when I clicked it, the topic is not exist. I thought it was permission problem but after playing with the permission settings, it’s still the same. Then I decide to look directly into the database. With some sql command, I quickly found that the topic is really not exist in the node table but it still referenced from the forum table (which implement many-to-many relationship with the node table). This thing should not happened if foreign key constraint were implemented but a quick look on all the tables show’s that Drupal do not use any foreign key constraint in their schema. I can’t see the argument why they don’t leverage such a good feature provided by PostgreSQL. Anyway, I’m going to patch the schema to add foreign key constraint so that I’ll not wasting my time debugging why certain record is still referenced by some tables even though they were not exists anymore.
