Ingres and Drupal

I've been spending some time working on a port of Drupal 4.7 to use an Ingres2006 database. It's been interesting, but it has highlighted several shortcomings of Ingres and the php driver for Ingres (from PECL).

The most glaring absence is that of automatically incrementing columns. Yes, I'm aware of sequences, but one can't assign an expression as the default. It's also not possible to use rules (triggers) and procedures to update the column with a value from the sequence. One can create an after insert rule, but if the column is part of the Primary Key (and cannot be NULL) this approach isn't possible. The Drupal uses an id value as the primary key for many tables.

Now Drupal, in the code, says that it doesn't use the auto incrementing feature for compatibility reasons. During the port, I immediately ran across a function (inserts into the watchdog table) that uses auto incrementing feature. When I reported this on the Drupal bug tracking site - the response was that it was as designed for performance reasons. So much for compatibility.

BLOBs and CLOBs have also been an issue. In Ingres, one can only assign a string literal of 2000 characters to in SQL. So, for the port, I've increased the page size of the cache table to 64k and use varchar(32000) for the data. I've also used the gzcompress function in PHP to make the cache data small enough to fit in the column.

The Ingres PHP Driver from PECL is also a little quirky. Not only do the functions not follow the same parameter order as, say, MySQL, but at least one (ingres_error) was responsible for a segmentation fault in Apache.

The port, for right now, is broken. I'm still resolving issues. There's actually something to see now - Drupal on Ingres