Skip site navigation (1) Skip section navigation (2)

Re: Setting sequence ids after importing data

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: Hari Patel <hariwise(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Setting sequence ids after importing data
Date: 2006-05-09 01:13:38
Message-ID: 445FECC2.1070700@mail.nih.gov (view raw or flat)
Thread:
Lists: pgsql-novice
Hari Patel wrote:
> Hi:
> 
> I am importing data from sqlite db into postgres. The tables have an id 
> column that is obtained from a sequence.
> 
> To preserve the foreign key relationships, I need to preserve the ids 
> while importing into postgres.
> 
> The problem is that after import, the sequences don't get incremented 
> which leads to unique constraint violation errors further down.
> How do I fix this ?

See here in the documentation:

http://www.postgresql.org/docs/8.1/static/functions-sequence.html

SEan

In response to

Responses

pgsql-novice by date

Next:From: Hari PatelDate: 2006-05-09 01:59:07
Subject: Re: Setting sequence ids after importing data
Previous:From: Hari PatelDate: 2006-05-09 00:43:08
Subject: Setting sequence ids after importing data

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group