Re: [GENERAL] Bug with sequence

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [GENERAL] Bug with sequence
Date: 2002-11-20 22:12:58
Message-ID: 1037830378.24840.40.camel@linda
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-sql

On Wed, 2002-11-20 at 21:35, Robert Treat wrote:
> On Wed, 2002-11-20 at 03:53, Oliver Elphick wrote:
> > On Mon, 2002-11-18 at 15:45, Thomas Aichinger wrote:
> > > Hi,
> > >
> > > I recently installed pg 7.2.3 on my linux box and discovered that
> > > there are some problems with datatype serial and sequence.
> > >
> > > 1.) If you create a table with a datatype serial, the corrsponding
> > > sequence will be created, but if you drop the table the sequence is
> > > not dropped.
> >
> > This is fixed in 7.3
> >
>
> out of curiosity, do you know the logic that implements this fix? I have
> a couple of tables that use the same sequence; I'm wondering if dropping
> one of the tables removes the sequence or if I have to drop all tables
> before the sequence is removed

I just tried it.

I created a sequence using SERIAL when I created a table. I used the
same sequence for another table by setting a column default to
nextval(sequence).

I deleted the first table. The sequence was deleted too, leaving the
default of the second table referring to a non-existent sequence.

Could this be a TODO item in 7.4, to add a dependency check when a
sequence is set as the default without being created at the same time?

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight, UK
http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"If my people, which are called by my name, shall
humble themselves, and pray, and seek my face, and
turn from their wicked ways; then will I hear from
heaven, and will forgive their sin, and will heal
their land." II Chronicles 7:14

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Brian Minton 2002-11-20 22:30:43 Re: select where expr in - result order?
Previous Message Neil Conway 2002-11-20 22:11:58 Re: Closing inactive connections OR user connections limits

Browse pgsql-hackers by date

  From Date Subject
Next Message Rod Taylor 2002-11-20 23:20:38 Re: [GENERAL] Bug with sequence
Previous Message Bruce Momjian 2002-11-20 22:02:02 Re: RC1?

Browse pgsql-sql by date

  From Date Subject
Next Message Michiel Lange 2002-11-20 22:14:16 Re: trying to learn plpqsql... so please forgive..
Previous Message Neil Conway 2002-11-20 22:11:58 Re: Closing inactive connections OR user connections limits