Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8390C475C85 for ; Wed, 18 Sep 2002 15:35:33 -0400 (EDT) Received: from marsha.pcisys.net (marsha.pcisys.net [216.229.32.146]) by postgresql.org (Postfix) with ESMTP id 214B94763AB for ; Wed, 18 Sep 2002 15:35:32 -0400 (EDT) Received: from [216.229.45.53] (moe.rbe45-53.cos.pcisys.net [216.229.45.53]) by marsha.pcisys.net (8.12.5/8.12.5) with ESMTP id g8IJZVVU023667 for ; Wed, 18 Sep 2002 13:35:31 -0600 (MDT) User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.0.4 Date: Wed, 18 Sep 2002 13:35:32 -0600 Subject: Re: Use of Serial type From: Keary Suska To: Postgres-PHP Message-ID: In-Reply-To: <3D88C991.54BF238E@voyager.net> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/31 X-Sequence-Number: 1486 on 9/18/02 12:44 PM, jrbeckstrom@voyager.net purportedly said: > 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? I am not certain about the behavior of COPY, but with an INSERT the serial trigger will not click if you are inserting a value into the serial field. Nor will it be updated. This behavior may have changed since I last experienced it, but that's my recollection. This may be the same for COPY. So you probably have to manually update the serial counter. Keary Suska Esoteritech, Inc. "Leveraging Open Source for a better Internet"