06 2008

Menu

Diary
OldIRC
URLs
misc
techie
writing

More content will be added to fill this space at some point in the future.

Welcome

Another redesign. This time with BlogPower™. Not sure what will happen about content. Probably will get content until I get bored, then wither.

It seems that I haven't been updating my website as often as I should. There's a lot of information that I want to share with people, but I haven't come up with a simple way of getting it all across.

In the mean time, there is a menu to the left there <--

The reason most people have web pages I do not know, however I do like to be able to find out about people by looking at their web pages. I am less interested to find out about their gerbil though. It is like Internet spying, but spying on what they want you to know. So that people can find a little about me I have written these pages.

My PGP/GPG key is available as this file

There is a more blog-style diary here

Recent Changes

Ordered updates in SQL

Why doesn't the update command in SQL support an "order by" clause?

Logically you'd think "That'll be because the order doesn't matter" - SQL is all mathematical set operations. Unfortunately it does.

Think of the case (that you shouldn't do), of altering the primary key of a table:

  update my_table set id = id + 1;

Think of this as being like Hilbert's Hotel - if there were no collisions before running it (and nothing added to it whilst the update runs) then there should be no collisions afterwards.

Unfortunately you do get an error indicating a violation of the primary key uniqueness constraint. Obviously it sets the id of the row which used to have id=1 to be id=2 then checks for the constraint at this point there is already a row with id=2 (that we're intending to make id=3). If we updated them in order from the highest id first, then there wouldn't be any problem as we would free up a "room" before trying to put anyone else in it.

Last updated: 12:06, 25 Jun 2008 Link..