Re: Unique UUID value - PostgreSQL 9.2

From: James Keener <jim(at)jimkeener(dot)com>
To: "drum(dot)lucas(at)gmail(dot)com" <drum(dot)lucas(at)gmail(dot)com>,"David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Unique UUID value - PostgreSQL 9.2
Date: 2016-03-14 21:46:03
Message-ID: A264412E-48AA-4474-94B1-D01D80B16F77@jimkeener.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is a uuid a valid value in the application making use of the data? Why can't you add the column to table b and then import, or use create the uuid in the import select clause? I'm also having trouble understanding the problem and why you've discounted the options you've not even told us you've considered.

On March 14, 2016 5:37:00 PM EDT, "drum(dot)lucas(at)gmail(dot)com" <drum(dot)lucas(at)gmail(dot)com> wrote:
>On 15 March 2016 at 10:29, David G. Johnston
><david(dot)g(dot)johnston(at)gmail(dot)com>
>wrote:
>
>> On Mon, Mar 14, 2016 at 2:13 PM, drum(dot)lucas(at)gmail(dot)com <
>> drum(dot)lucas(at)gmail(dot)com> wrote:
>>
>>> Hi all,
>>>
>>>
>> favorite
>>>
><http://dba.stackexchange.com/questions/132226/unique-values-uuid-generation-postgresql-9-2#>
>>>
>>> I've got 2 tables:
>>>
>>> Temp-Table
>>> Table-A
>>>
>>> Need to copy all the data from *Temp-Table* to *Table-A*. But there
>is a
>>> Constraint that does not allow me to have duplicated items.
>>>
>>> So I need to create a Unique value.
>>>
>>> *Example:*
>>>
>>> Column Code | Column Info |
>>> code_67493675936 info_2016
>>>
>>> *Question:*
>>>
>>> How can I do that using PostgreSQL 9.2?
>>>
>>
>> You might want to try to restate the problem and question. I'm
>having a
>> hard time trying to figure out what you want.
>>
>> Reading your subject line I'll point you to:
>>
>> http://www.postgresql.org/docs/9.2/interactive/datatype-uuid.html
>>
>> specifically the extension that is mentioned.
>>
>> ​Usually people figure out ways to accomplish their goals without
>using
>> UUID though.
>>
>> David J.
>> ​
>>
>>
>I want to import data from table A to table B, but when doing it the
>column
>"code" on table B has to have some unique random data.
>
>I could use UUID like:
>insert into "TB" ("Id", "Title") values (uuid_generate_v4(), '111');
>
>but I'm doing:
>INSERT INTO tableb (SELECT * FROM TABLEA)
>
>So, how to use UUID using the SELECT above?

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message drum.lucas@gmail.com 2016-03-14 21:56:15 Re: Unique UUID value - PostgreSQL 9.2
Previous Message David G. Johnston 2016-03-14 21:44:19 Re: Unique UUID value - PostgreSQL 9.2