possible bug with sequences - Mailing list pgsql-admin

From Victor Sudakov
Subject possible bug with sequences
Date
Msg-id c48au4$b0a$1@mpeks.tomsk.su
Whole thread Raw
Responses Re: possible bug with sequences
List pgsql-admin
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/

pgsql-admin by date:

Previous
From: "Anjan Dave"
Date:
Subject: Re: Use 7.4.1's pg_dump in 7.2.4?
Next
From: "Fernando B"
Date:
Subject: Using windows authentication to connect to postgress