ray
ray

Reputation: 4250

uuid-ossp module for PostgreSQL 8.2 to generate UUID

I am trying to generate UUID in PostgreSQL 8.2. From the documentation I found uuid-ossp module can generate UUID but it supports only PostgreSQL 9+. Is there any way to use this uuid-ossp module in PostgreSQL 8.2 or generate UUID in PostgreSQL 8.2 by using query?

Upvotes: 0

Views: 714

Answers (2)

Peter Eisentraut
Peter Eisentraut

Reputation: 36709

You could write a function PL/Perl or PL/Python that generates UUIDs using one of their modules.

Upvotes: 1

Basil Bourque
Basil Bourque

Reputation: 338181

You may be confused about the packaging of that plugin for Postgres. Postgres 9.1 introduced a new packaging scheme called Extension. The idea is that the creator of a plugin does more work with regard to packaging so that the user of the plugin might do less work with regard to installation. The Create Extension command (a mis-nomer to my mind) installs a plugin into your Postgres cluster.

Previous to Postgres 9.1, you can install the UUID plugin, but doing so is not quite so simple. You must locate the "uuid-ossp" plugin appropriate to your version of Postgres. The plugin may well have been bundled with your Postgres cluster but not yet installed (activated). Within that plugin package find the SQL script used for installation. You then execute that script in your Postgres cluster.

For details, see my posting to the Postgres mailing list and my blog post on the old way to install and the new way to install the UUID plugin.

I cannot find the 8.2 doc, but did find the 8.3 doc for the uuid-ossp plugin. I do not know if 8.2 had a version of the uuid-ossp plugin, but I suppose so.


Postgres 8.2 reached end-of-life two years (2011-12). I strongly suggest planning an upgrade.

As Craig Ringer commented, you should be doing only the most basic maintenance to a Postgres 8.2 cluster. Asking about UUID support suggests some major changes. For such changes you really should first complete an upgrade to a more recent Postgres.

Upvotes: 3

Related Questions