X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 41E1AD1ECFB for ; Mon, 29 Mar 2004 05:20:18 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 98529-09 for ; Mon, 29 Mar 2004 01:20:16 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id CD642D1DC1C for ; Mon, 29 Mar 2004 01:20:10 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i2T5KFYn043041 for ; Mon, 29 Mar 2004 05:20:15 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i2T5FAII042301 for pgsql-admin@postgresql.org; Mon, 29 Mar 2004 05:15:10 GMT From: Victor Sudakov X-Newsgroups: comp.databases.postgresql.admin Subject: possible bug with sequences Date: Mon, 29 Mar 2004 05:07:16 +0000 (UTC) Organization: AO "Svyaztransneft", SibPTUS Lines: 34 Message-ID: X-Complaints-To: noc@sibptus.tomsk.ru X-PGP-Key: http://vas.tomsk.ru/vas.asc User-Agent: tin/1.5.16-20030125 ("Bubbles") (UNIX) (FreeBSD/4.9-RELEASE-p4 (i386)) To: pgsql-admin@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/65 X-Sequence-Number: 13038 Colleagues, What is the internal difference between an implicit sequence (created automatically by the "serial" data type) and an explicit sequence (created manually)? I think I have hit something that can qualify as a bug. How to reproduce: ============== cut here ============================= reports=# CREATE TABLE sometable (id serial, name text); NOTICE: CREATE TABLE will create implicit sequence "sometable_id_seq" for "serial" column "sometable.id" CREATE TABLE reports=# ALTER TABLE sometable RENAME TO othername; ALTER TABLE reports=# \d othername Table "admin.othername" Column | Type | Modifiers --------+---------+---------------------------------------------------------- id | integer | not null default nextval('admin.sometable_id_seq'::text) name | text | ============== cut here ============================= Voila! pg_restore will now return an error on trying to execute SELECT pg_catalog.setval('sometable_id_seq', 4, true); because this sequence has not been created either explicitly or implicitly! It is 100% reproducible on postgresql-7.4.1 -- Victor Sudakov, VAS4-RIPE, VAS47-RIPN 2:5005/149@fidonet http://vas.tomsk.ru/