Re: Insert text to column using copy command

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Shmagi Kavtaradze <kavtaradze(dot)s(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Insert text to column using copy command
Date: 2015-11-08 16:35:37
Message-ID: 21198.1447000537@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Shmagi Kavtaradze <kavtaradze(dot)s(at)gmail(dot)com> writes:
> I want to import text to a specific column and for other columns to specify
> literals/constants myself, using same copy command.

COPY is not bright enough to do what you want. I'd suggest copying into
a temporary table that just receives the data literally as it appears in
the file, and then using INSERT ... SELECT ... to transform the data and
put it into the final table.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Convey 2015-11-10 18:41:35 Linux Users vs PostgreSQL Users
Previous Message Shmagi Kavtaradze 2015-11-08 16:18:09 Insert text to column using copy command