Re: [SQL] Newbie dbadmin out of his league

From: "Ross J(dot) Reedstrom" <reedstrm(at)wallace(dot)ece(dot)rice(dot)edu>
To: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] Newbie dbadmin out of his league
Date: 1999-08-27 22:11:40
Message-ID: 19990827171140.A15338@wallace.ece.rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, Aug 27, 1999 at 05:19:18PM -0400, Tom Lane wrote:
> Tim Pizey <tim(at)paneris(dot)co(dot)uk> writes:
> > 2. How do I use COPY?
>
>
> Just create the sequence with the right starting value (one past last
> ID being loaded). You can do that before or after the COPY, doesn't
> matter.

What I always do with sequences that are autocreated for serial types
(and so have a start value of 1), after the COPY puts all my data in place:

select setval('tablename_field_seq',max(field)) from tablename;

Ross

--
Ross J. Reedstrom, Ph.D., <reedstrm(at)rice(dot)edu>
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St., Houston, TX 77005

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Frank Joerdens 1999-08-28 13:35:07 datetime query issue
Previous Message Michael Richards 1999-08-27 22:10:19 indexes using datetime