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

From David G. Johnston
Subject Re: Unique UUID value - PostgreSQL 9.2
Date
Msg-id CAKFQuwY1OJs8ySHZkgPiYdibrM6tN5iy8GSOjymW5ki7x4DnLA@mail.gmail.com
Whole thread Raw
In response to Re: Unique UUID value - PostgreSQL 9.2  ("drum.lucas@gmail.com" <drum.lucas@gmail.com>)
Responses Re: Unique UUID value - PostgreSQL 9.2  ("drum.lucas@gmail.com" <drum.lucas@gmail.com>)
List pgsql-general
On Tue, Mar 15, 2016 at 2:48 PM, drum.lucas@gmail.com <drum.lucas@gmail.com> wrote:



I wouldn't ask if I wouldn't have tested it!

Will have a look.

I didn't asked if you tested what you did post.  I asked if you tried anything else before asking to be fed the answer.  If you did it would be nice to include those other attempts.

David J.
 


It's already working:
INSERT INTO junk.wm_260_billables2 (account_id, code, info)
SELECT account_id, 'test_' || uuid_generate_v4(), info
FROM junk.wm_260_billables1;

BUT.. I'm getting a very long UUID - Would like some smaller
test_ea8bacbe-fa3c-4072-b511-643a56feb40e

SELECT ​'test_'​ || substring(uuid_generate_v4()::text, 1, 1);

Or use a sequence, or just compute "ROW_NUMBER() OVER ()" and tack that on.

David J.

pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: Unique UUID value - PostgreSQL 9.2
Next
From: Thomas Munro
Date:
Subject: Re: How to Qualifying or quantify risk of loss in asynchronous replication