Re: Unique UUID value - PostgreSQL 9.2

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "drum(dot)lucas(at)gmail(dot)com" <drum(dot)lucas(at)gmail(dot)com>
Cc: Brent Wood <Brent(dot)Wood(at)niwa(dot)co(dot)nz>, James Keener <jim(at)jimkeener(dot)com>, Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Unique UUID value - PostgreSQL 9.2
Date: 2016-03-15 21:44:25
Message-ID: CAKFQuwZ-T+qU8nzenxNY34AJnETJYozAA0ELq4WX19tuYxA6vA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Mar 15, 2016 at 2:35 PM, drum(dot)lucas(at)gmail(dot)com <drum(dot)lucas(at)gmail(dot)com>
wrote:

>
>
> On 16 March 2016 at 10:30, David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
> wrote:
>
>> On Tue, Mar 15, 2016 at 2:01 PM, drum(dot)lucas(at)gmail(dot)com <
>> drum(dot)lucas(at)gmail(dot)com> wrote:
>>
>>>
>>>>>
>>>> Not reading the documentation for functions you've never heard of makes
>>>> the list.
>>>>
>>>> David J.
>>>>
>>>
>>> INSERT INTO junk.test1 (account_id, code, info)SELECT account_id, uuid_generate_v4(), infoFROM junk.test2;
>>>
>>> It works but I get data like:
>>>
>>> abc77f31-0ee6-44fd-b954-08a3a3aa7b28
>>> f307fb42-23e5-4742-ab8f-8ce5c0a8e852
>>>
>>> *Is it possible to do the same, but with TEXT on the beginning?*
>>>
>>> Example:
>>>
>>> test_32152563bdc4db11aa
>>>
>>> test_321525694417ad6b5f
>>>
>>>
>> ​Yes, it is possible. Did you even try?
>>
>> "test" in that example is called a string. There are bunch of functions
>> and operators that work with strings. They are documented here:
>>
>> http://www.postgresql.org/docs/9.4/static/functions-string.html
>>
>> You'll find the ones that "concatenate" - which basically is a fancy way
>> to say: "to combine" or "to join together" - to be quite useful when faced
>> with problems of this sort.
>>
>> David J.
>>
>>
> 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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message drum.lucas@gmail.com 2016-03-15 21:48:39 Re: Unique UUID value - PostgreSQL 9.2
Previous Message drum.lucas@gmail.com 2016-03-15 21:35:51 Re: Unique UUID value - PostgreSQL 9.2