On 05/25/2015 07:17 AM, Piotr Gasidło wrote:
> 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).
>
What version of Postgres?
So did you see the section at the bottom of this page?:
http://www.postgresql.org/docs/9.4/interactive/uuid-ossp.html
--
Adrian Klaver
adrian.klaver@aklaver.com