Re: Copying data from a tab delimited file into a table

From: James David Smith <james(dot)david(dot)smith(at)gmail(dot)com>
To: Carol Walter <carol(dot)walter(at)sbcglobal(dot)net>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Copying data from a tab delimited file into a table
Date: 2014-02-11 17:16:22
Message-ID: CAMu32ADaW9UUduR-SATAM141E9za9uyZKePecMYPk9qnurT_1Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 11 February 2014 17:13, Carol Walter <carol(dot)walter(at)sbcglobal(dot)net> wrote:
> I'm trying to copy the data from a tab delimited file into a postgres table. The table has a primary key that's designated as a serial data type. When I try to do the copy, it "blows up" unless I put a integer number in the field where the primary key will be. That defeats the purpose of designating this field as serial. When I put data into that field the copy works but an insert statement fails because it says there is a duplicate key. How can I get the data from this file into my table and still have the key field designated with a "serial data type"?
>
> Thanks,
> Carol
>

Sorry, should have sent the below to the whole list:

Hi Carol,

Why not import the data first, and then add the serial column
afterwards? That's what I'd do.

James

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Carol Walter 2014-02-11 19:21:47 Re: Copying data from a tab delimited file into a table
Previous Message Carol Walter 2014-02-11 17:13:53 Copying data from a tab delimited file into a table