pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Victor Sudakov <vas@mpeks.no-spam-here.tomsk.su>
To: pgsql-admin@postgresql.org
Subject: possible bug with sequences
Date: Mon, 29 Mar 2004 05:07:16 +0000 (UTC)
Message-ID: <c48au4$b0a$1@mpeks.tomsk.su> (raw)

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/



view thread (2+ messages)  latest in thread

Message-ID: <c48au4$b0a$1@mpeks.tomsk.su>
Permalink:  ../c48au4$b0a$1@mpeks.tomsk.su/
Also on:    postgresql.org/message-id/c48au4$b0a$1@mpeks.tomsk.su

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: vas@mpeks.no-spam-here.tomsk.su
  Subject: Re: possible bug with sequences
  In-Reply-To: <c48au4$b0a$1@mpeks.tomsk.su>
  References: <c48au4$b0a$1@mpeks.tomsk.su>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox