Archive for the 'Techy' Category

Dodgy Hax

Friday, September 28th, 2007

I recently upgraded to WP 2.3, and an old hack I’d done came back to bite me in the arse. What I had was: $link_cats = $wpdb->get_results(” SELECT Distinct C.cat_id, C.cat_name FROM $wpdb->link2cat As L2C JOIN $wpdb->categories As C On C.cat_id = L2C.category_id WHERE C.cat_id <> (category id was here) “); But link2cat has been [...]

Surrogate versus Natural Primary Keys

Friday, August 10th, 2007

Warning: Random SQL related musings I broadly agree with this article on primary keys in database design – in effect saying that autoincrement/serial/identity columns are a Bad Thing. There are some cases where I don’t think there is any realistic option though, and some cases where an artificial primary key is more pleasant. Firstly, the [...]