Received: from linux.sinyih.com.tw (mail.sinyih.com.tw [203.66.130.1]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eA20fcl11976 for ; Wed, 1 Nov 2000 19:41:39 -0500 (EST) (envelope-from cn@mail.sinyih.com.tw) Received: from mail.sinyih.com.tw (cn [203.66.130.25]) by linux.sinyih.com.tw (8.10.1/8.10.1) with ESMTP id eA28jhw00680 for ; Thu, 2 Nov 2000 16:45:47 +0800 Message-ID: <3A00B86D.85A83CC4@mail.sinyih.com.tw> Date: Thu, 02 Nov 2000 08:42:21 +0800 From: cn Organization: Sinyih Ceramic Co., Ltd X-Mailer: Mozilla 4.74 [en] (Win95; U) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-docs@postgresql.org Subject: "Usage" Section In "Create Sequence" Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200011/1 X-Sequence-Number: 4 Hi! Perhaps I misunderstood its logic - I think the following example illusated in man page "create_sequence" and "http://www.postgresql.org/devel-corner/docs/postgres/sql-createsequence.htm": CREATE FUNCTION distributors_id_max() RETURNS INT4 AS 'SELECT max(id) FROM distributors' LANGUAGE 'sql'; BEGIN; COPY distributors FROM 'input_file'; SELECT setval('serial', distributors_id_max()); END; is intended to be: CREATE FUNCTION distributors_id_max() RETURNS INT4 AS 'SELECT max(id)+1 FROM distributors' -- !NOTE HERE LANGUAGE 'sql'; BEGIN; COPY distributors FROM 'input_file'; SELECT setval('serial', distributors_id_max()); END; Regards, CN