To build on Debian:

apt-get install uuid-dev libuuid1
cd /usr/src
apt-get source postgresql-8.1
apt-src import postgresql-8.1 \
  --location postgresql-8.1-8.1.11/ --version 8.1.11
apt-src build postgresql-8.1

Change back to the pguuid directory

make
cp pguuid.so /usr/lib/postgresql/8.1/lib
cd sql
sudo su postgres psql -U postgres _database_ <pguuid.sql

If all this worked,  you should have a new type "uuid"
that you can also index.  There are 3 ways to generate a 
probably-unique ID:

newid_time() ... creates a DCE time-based ID
newid_random() ... creates a random ID (using /dev/urandom)
newid() ... probably the same as newid_random()

You can also convert UUIDs to/from text, or create the "nil"
UUID with newid_nil().

Two functions return non-NULL only for time-based UIDs:

uuid_timestamp();
uuid_macaddr();
 
It should be fine to store UUIDs generated elsewhere (for example,
in Java, or GUIDs from Windows) in this column.

