The "uuid-ossp" library enables you to generate UUID values server-side in 
Postgres.
http://www.postgresql.org/docs/current/static/uuid-ossp.html

The technique to install this library changed as of Postgres 9.1, because of 
the new Extension feature. Installing and uninstalling are now easier. I have 
an overview on my blog, but I'm posting the brief steps here for posterity.

To see what extensions are already installed in your Postgres, run this SQL:
  select * from pg_extension;

To see if the "uuid-ossp" extension is available, run this SQL:
  select * from pg_available_extensions;

To install/load the extension, run this SQL:
  CREATE EXTENSION "uuid-ossp";

I found the quote marks to be required despite the doc being contrary.

Doc on loading extensions:
http://www.postgresql.org/docs/current/static/sql-createextension.html

My blog post on this topic:
http://crafted-software.blogspot.com/2011/10/extensions-in-postgres.html

To install this library in versions of Postgres before 9.1:
http://crafted-software.blogspot.com/2011/10/using-uuid-library-in-postgres.html

--Basil Bourque

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to