pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: cn <cn@mail.sinyih.com.tw>
To: pgsql-docs@postgresql.org
Subject: "Usage" Section In "Create Sequence"
Date: Thu, 02 Nov 2000 08:42:21 +0800
Message-ID: <3A00B86D.85A83CC4@mail.sinyih.com.tw> (raw)

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



Message-ID: <3A00B86D.85A83CC4@mail.sinyih.com.tw>
Permalink:  ../3A00B86D.85A83CC4@mail.sinyih.com.tw/
Also on:    postgresql.org/message-id/3A00B86D.85A83CC4@mail.sinyih.com.tw

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: cn@mail.sinyih.com.tw
  Subject: Re: "Usage" Section In "Create Sequence"
  In-Reply-To: <3A00B86D.85A83CC4@mail.sinyih.com.tw>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox