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

From drum.lucas@gmail.com
Subject Re: Unique UUID value - PostgreSQL 9.2
Date
Msg-id CAE_gQfWTfT5xKn9NLFU=_Jy9PGkPB+7-+Gr-bkpv-x2nXky2og@mail.gmail.com
Whole thread Raw
In response to Re: Unique UUID value - PostgreSQL 9.2  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: Unique UUID value - PostgreSQL 9.2  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: Unique UUID value - PostgreSQL 9.2  (James Keener <jim@jimkeener.com>)
List pgsql-general


On 15 March 2016 at 10:29, David G. Johnston <david.g.johnston@gmail.com> wrote:
On Mon, Mar 14, 2016 at 2:13 PM, drum.lucas@gmail.com <drum.lucas@gmail.com> wrote:
Hi all,
 

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:


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?


pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Unique UUID value - PostgreSQL 9.2
Next
From: John R Pierce
Date:
Subject: Re: BDR