Search Postgresql Archives

Re: Unique UUID value - PostgreSQL 9.2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/14/2016 6:41 PM, drum.lucas@xxxxxxxxx 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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux