Auto DROP SEQUENCE?

Started by Daryl Beattieover 23 years ago5 messagesgeneral
Jump to latest
#1Daryl Beattie
dbeattie@insystems.com

Hi PostgreSQL people,

I was wondering; I have noticed that sequences are not dropped
automatically if they are used by a table. That's okay; I bet somebody has a
good reason why this is so. However, when sequences are created implicitly
by somebody using the SERIAL data type, does it not make sense to drop that
sequence when the table is dropped?
I'm just throwing the question out. :)

Thanks,

Daryl.

#2frbn
frbn@efbs-seafrigo.fr
In reply to: Daryl Beattie (#1)
Re: Auto DROP SEQUENCE?

Daryl Beattie a écrit:

Hi PostgreSQL people,

I was wondering; I have noticed that sequences are not dropped
automatically if they are used by a table. That's okay; I bet somebody has a
good reason why this is so. However, when sequences are created implicitly
by somebody using the SERIAL data type, does it not make sense to drop that
sequence when the table is dropped?
I'm just throwing the question out. :)

a sequence can be used by more than one table.

I presume it's the reason why seq are not dropped.

#3Daryl Beattie
dbeattie@insystems.com
In reply to: frbn (#2)
Re: Auto DROP SEQUENCE?

Please see below:

-----Original Message-----
From: frbn [mailto:frbn@efbs-seafrigo.fr]
Sent: Thursday, July 25, 2002 9:27 AM
To: Daryl Beattie
Cc: 'pgsql-general@postgresql.org'
Subject: Re: [GENERAL] Auto DROP SEQUENCE?

Daryl Beattie a écrit:

Hi PostgreSQL people,

I was wondering; I have noticed that sequences are not dropped
automatically if they are used by a table. That's okay; I

bet somebody has a

good reason why this is so. However, when sequences are

created implicitly

by somebody using the SERIAL data type, does it not make

sense to drop that

sequence when the table is dropped?
I'm just throwing the question out. :)

a sequence can be used by more than one table.

I presume it's the reason why seq are not dropped.

Yes, it can.

But a sequnce that is automatically generated using the SERIAL data type
*should not* be used by more than one table. The SERIAL type abstracts the
sequence away from the SQL user so that the user might not even really know
that SERIAL is implemented using a sequence. The fact that a SERIAL is a
sequence is an implementation detail, right? And as such, perhaps those
sequences should be dropped with the table.

If my reasoning is incorrect, please correct me.

Sincerely,

Daryl.

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Daryl Beattie (#1)
Re: Auto DROP SEQUENCE?

Daryl Beattie <dbeattie@insystems.com> writes:

I was wondering; I have noticed that sequences are not dropped
automatically if they are used by a table. That's okay; I bet somebody has a
good reason why this is so. However, when sequences are created implicitly
by somebody using the SERIAL data type, does it not make sense to drop that
sequence when the table is dropped?

Try it in CVS tip ;-)

regards, tom lane

#5Andrew Sullivan
andrew@libertyrms.info
In reply to: Daryl Beattie (#3)
Re: Auto DROP SEQUENCE?

On Thu, Jul 25, 2002 at 11:05:31AM -0400, Daryl Beattie wrote:

sequence is an implementation detail, right? And as such, perhaps those
sequences should be dropped with the table.

Check the archives, but I think that someone is fixing 7.3 to drop
sequences with the associated table.

A

-- 
----
Andrew Sullivan                               87 Mowat Avenue 
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M6K 3E3
                                         +1 416 646 3304 x110