Re: copy from csv and postgresql 10's new identity column type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: john snow <ofbizfanster(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: copy from csv and postgresql 10's new identity column type
Date: 2017-12-14 03:14:36
Message-ID: 29836.1513221276@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

john snow <ofbizfanster(at)gmail(dot)com> writes:
> we're porting old dbf's to postgresql 10. currently, we have a dbf that did
> not have a defined primary key. in the postgresql 10 table, we want to
> define a technical primary key using postgresql 10's identity column.

> when we export the dbf data to a csv, the csv does not have data for the
> new primary key column, so the COPY FROM command fails and we get the error
> message saying null is not a valid value for the primary key column.

This sounds like a bug that was fixed last week:

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=ee5b595493e1609903d55709853f5276ba85c81d

You could apply that patch locally, or avoid IDENTITY until 10.2 is out.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message john snow 2017-12-14 20:14:50 r there downsides to explicitly naming a pk column xxxx_pk
Previous Message James Keener 2017-12-14 02:44:18 Re: copy from csv and postgresql 10's new identity column type