Replacing uuid-ossp with uuid-freebsd

From: Piotr Gasidło <quaker(at)barbara(dot)eu(dot)org>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Replacing uuid-ossp with uuid-freebsd
Date: 2015-05-25 14:17:32
Message-ID: CAF8akQuz-p4X3q4F1bYnzx7XH4CX6PTnxO16AsVoEi9BAzmzCA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I've moved from Linux to FreeBSD. I've used uuid-ossp. Now I need to
aply patch to make it work under FreeBSD. This is rather dirty hack.
So I need to replace it once and for all with uuid-freebsd module. But
because in my database I use uuid type and uuid_* functions is not
easy:

test_uuid=# \d test
Table "public.test"
Column | Type | Modifiers
--------+------+-------------------------------------
id | uuid | not null default uuid_generate_v4()

test_uuid=# drop extension "uuid-ossp";
ERROR: cannot drop extension uuid-ossp because other objects depend on it
DETAIL: default for table test column id depends on function uuid_generate_v4()
HINT: Use DROP ... CASCADE to drop the dependent objects too.

test_uuid=# create extension "uuid-freebsd";
ERROR: function "uuid_nil" already exists with same argument types
test_uuid=#

I can do this:

test_uuid=# CREATE OR REPLACE FUNCTION uuid_generate_v4()
RETURNS uuid
AS '/usr/local/lib/postgresql/uuid-freebsd.so', 'uuid_generate_v4'
VOLATILE STRICT LANGUAGE C;
CREATE FUNCTION

But THIS is now dirty hack - extension uuid-ossp is still there
(according to \dx) and I use functions from other, unregistered
extension.

I think, that I need do some low level hacking on pg_catalog. Any
hints how to do it cleanly (eq. replace functions, drop uuid-ossp and
add uuid-freebsd).

--
Piotr Gasidło

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2015-05-25 14:28:46 Re: Replacing uuid-ossp with uuid-freebsd
Previous Message Adrian Klaver 2015-05-25 13:53:26 Re: Reg: BULK COLLECT