Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B1762475E2E for ; Wed, 18 Sep 2002 19:07:17 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 25F09475DC8 for ; Wed, 18 Sep 2002 19:07:17 -0400 (EDT) Received: from [66.219.92.2] (HELO chocolate-mousse) by davinci.ethosmedia.com (CommuniGate Pro SMTP 3.5.9) with ESMTP id 1652894; Wed, 18 Sep 2002 16:07:18 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: jrbeckstrom@voyager.net, pgsql-php@postgresql.org Subject: Re: Use of Serial type Date: Wed, 18 Sep 2002 16:08:14 -0700 X-Mailer: KMail [version 1.4] References: <3D88C991.54BF238E@voyager.net> In-Reply-To: <3D88C991.54BF238E@voyager.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200209181608.14039.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/33 X-Sequence-Number: 1488 Jim, > Using php, I create a table with a SERIAL field. In the same > script, the last thing I do is a COPY ... FROM ... USING DELIMITERS...to > load data I have outputted from another system into a text delimited > file. I didn't get the autoincrementing of the serial field to work, so > I modified my output-from-another-system program to "manually" set the > serial field value. That worked. However, it does not seem to have > done a default SETVAL. Do I do a "manual" SETVAL of 1 greater than the > highest value from the input text file, or am I missing something in the > create and copy process? That sounds fine. However, I would bundle everything in a transaction to b= e=20 safe. Otherwise, you risk having a user access the table without the seria= l=20 value correctly set. --=20 -Josh Berkus Aglio Database Solutions San Francisco