Re: Unique UUID value - PostgreSQL 9.2 - Mailing list pgsql-general

From John R Pierce
Subject Re: Unique UUID value - PostgreSQL 9.2
Date
Msg-id 56E76D5F.7090000@hogranch.com
Whole thread Raw
In response to Re: Unique UUID value - PostgreSQL 9.2  ("drum.lucas@gmail.com" <drum.lucas@gmail.com>)
List pgsql-general
On 3/14/2016 6:41 PM, drum.lucas@gmail.com wrote:
So I'm doing:

CREATE EXTENSION "uuid-ossp";

INSERT INTO junk.wm_260_billables2 (account_id, code, info) SELECT account_id, code || '_' || nextval('uuid_generate_v4()')::text, info FROM junk.wm_260_billables1;

Getting the error:

ERROR:  relation "uuid_generate_v4()" does not exist


But the extension is working:

select uuid_generate_v4() as one;
                 one                  
--------------------------------------
 59ad418e-53fa-4725-aadb-8f779c1a12b2
(1 row)

select * from pg_available_extensions;
uuid-ossp              | 1.0             | 1.0               | generate universally unique identifiers (UUIDs) 

Do you know what might I being doing wrong?

nextval() takes a sequence name.   not a function like uuid_generate_v4().

if you insist on using UUID (very slow to generate, very bulky), then try...

    INSERT INTO junk.wm_260_billables2 (account_id, code, info) SELECT account_id, code || '_' || uuid_generate_v4(), info FROM junk.wm_260_billables1;


-- 
john r pierce, recycling bits in santa cruz

pgsql-general by date:

Previous
From: "drum.lucas@gmail.com"
Date:
Subject: Re: Unique UUID value - PostgreSQL 9.2
Next
From: "David G. Johnston"
Date:
Subject: Re: Unique UUID value - PostgreSQL 9.2