Re: Unique UUID value - PostgreSQL 9.2

Поиск
Список
Период
Сортировка
От John R Pierce
Тема Re: Unique UUID value - PostgreSQL 9.2
Дата
Msg-id 56E76D5F.7090000@hogranch.com
обсуждение исходный текст
Ответ на Re: Unique UUID value - PostgreSQL 9.2  ("drum.lucas@gmail.com" <drum.lucas@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: "drum.lucas@gmail.com"
Дата:
Сообщение: Re: Unique UUID value - PostgreSQL 9.2
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Unique UUID value - PostgreSQL 9.2