Re: Use of Serial Datatype and Sequence Issue - Mailing list pgsql-general

From Doug McNaught
Subject Re: Use of Serial Datatype and Sequence Issue
Date
Msg-id m3hes9rthm.fsf@belphigor.mcnaught.org
Whole thread Raw
In response to Use of Serial Datatype and Sequence Issue  (Tom Innes <tinnes@inforamp.net>)
List pgsql-general
Tom Innes <tinnes@inforamp.net> writes:

> I am new to postgres and am in the process of creating a new database of
> several 100 tables.  Most of the tables have a serial datatype. When the
> table is created psql says it is creating an implicit sequence.  Yet
> when I drop the table and even when I drop the database the sequence is
> still there. When I try to re-create the table it fails beacuse the
> sequence already exists.  This same behaviour exists for indexes.  How
> can I get rid of any sequences or indexes that have been created.  I
> would prefer not to explicitly drop each one.  Ideally I would like to
> drop the table and have all related indexes, sequences dropped.

Hmmm, I see part of this bug in 7.1.2 as well.  The index goes away
when the table is dropped, but the sequence remains and causes an
error when I try to recreate the table.  But dropping the database
(with DROP DATABASE or with 'destroydb' from the shell) blows away
everything, including the sequence, as it should.

Haven't got 7.1.3 to try it on--what version are you using?

-Doug
--
Let us cross over the river, and rest under the shade of the trees.
   --T. J. Jackson, 1863

pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: request for advise
Next
From: Tom Lane
Date:
Subject: Re: Define update-rule on view