| From: | cn <cn(at)mail(dot)sinyih(dot)com(dot)tw> |
|---|---|
| To: | pgsql-docs(at)postgresql(dot)org |
| Subject: | "Usage" Section In "Create Sequence" |
| Date: | 2000-11-02 00:42:21 |
| Message-ID: | 3A00B86D.85A83CC4@mail.sinyih.com.tw |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-docs |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2000-11-02 17:32:35 | Documentation build things |
| Previous Message | Peter Eisentraut | 2000-10-30 16:25:31 | Re: question regarding grant privilege |