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-14 23:05:04
Message-ID: CAKFQuwa26N2OnKEt_zsVoe0FEoq4n=jydGXNWQm25SAOzFyNBA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Mar 14, 2016 at 3:51 PM, drum(dot)lucas(at)gmail(dot)com <drum(dot)lucas(at)gmail(dot)com>
wrote:

> I just need to know how can I do all of this
>

​You may have missed my prior email.

You cannot COPY directly into the target table. You must copy to a staging
table. You then insert from the staging table to the target table, listing
every single column, and replacing those columns you want to change with
some kind of expression.

Basically:

INSERT INTO targettable (col1, col2, col3)
SELECT col1, col2 || '_' || nextval('sequence_name')::text, col3
FROM stagingtable;

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2016-03-14 23:05:50 Re: Unique UUID value - PostgreSQL 9.2
Previous Message drum.lucas@gmail.com 2016-03-14 22:51:04 Re: Unique UUID value - PostgreSQL 9.2