possible bug with sequences

From: Victor Sudakov <vas(at)mpeks(dot)no-spam-here(dot)tomsk(dot)su>
To: pgsql-admin(at)postgresql(dot)org
Subject: possible bug with sequences
Date: 2004-03-29 05:07:16
Message-ID: c48au4$b0a$1@mpeks.tomsk.su
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)fidonet http://vas.tomsk.ru/

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Peter Galbavy 2004-03-29 07:10:41 Re: License for PostgreSQL for commercial purpose
Previous Message Tom Lane 2004-03-29 00:44:01 Re: md5 is invalid?