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/