Unix Technical Forum

BUG #2336: will not drop implicitly created sequence

This is a discussion on BUG #2336: will not drop implicitly created sequence within the pgsql Bugs forums, part of the PostgreSQL category; --> The following bug has been logged online: Bug reference: 2336 Logged by: Chris Mair Email address: chris@1006.org PostgreSQL version: ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Bugs

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 09:51 AM
Chris Mair
 
Posts: n/a
Default BUG #2336: will not drop implicitly created sequence


The following bug has been logged online:

Bug reference: 2336
Logged by: Chris Mair
Email address: chris@1006.org
PostgreSQL version: 8.1.3
Operating system: MacOS X 10.3.9
Description: will not drop implicitly created sequence
Details:

Ok, so this is probably not a bug at all - just slightly unexpected
behaviour.

This piece of SQL:
---------------------------------------------------
create table test2 (id serial, txt varchar);
-- (will create implicit sequence "test2_id_seq")
alter table test2 alter id set default 123;
drop sequence test2_id_seq;
---------------------------------------------------

would say:
---------------------------------------------------
ERROR: 2BP01: cannot drop sequence test2_id_seq because table test2 column
id requires it
HINT: You may drop table test2 column id instead.
LOCATION: recursiveDeletion, dependency.c:472
---------------------------------------------------

as if test2.id would still use the sequence.

Contrast this with the same thing done with an explicitly declared
sequence:
---------------------------------------------------
create sequence test1_id_seq;
create table test1 (id int not null default nextval('test1_id_seq'), txt
varchar);
alter table test1 alter id set default 123;
drop sequence test1_id_seq;
---------------------------------------------------

which will just work fine.

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 09:51 AM
Bruce Momjian
 
Posts: n/a
Default Re: BUG #2336: will not drop implicitly created sequence


TODO has:

* %Disallow changing default expression of a SERIAL column

so we know it is a bug.

---------------------------------------------------------------------------

Chris Mair wrote:
>
> The following bug has been logged online:
>
> Bug reference: 2336
> Logged by: Chris Mair
> Email address: chris@1006.org
> PostgreSQL version: 8.1.3
> Operating system: MacOS X 10.3.9
> Description: will not drop implicitly created sequence
> Details:
>
> Ok, so this is probably not a bug at all - just slightly unexpected
> behaviour.
>
> This piece of SQL:
> ---------------------------------------------------
> create table test2 (id serial, txt varchar);
> -- (will create implicit sequence "test2_id_seq")
> alter table test2 alter id set default 123;
> drop sequence test2_id_seq;
> ---------------------------------------------------
>
> would say:
> ---------------------------------------------------
> ERROR: 2BP01: cannot drop sequence test2_id_seq because table test2 column
> id requires it
> HINT: You may drop table test2 column id instead.
> LOCATION: recursiveDeletion, dependency.c:472
> ---------------------------------------------------
>
> as if test2.id would still use the sequence.
>
> Contrast this with the same thing done with an explicitly declared
> sequence:
> ---------------------------------------------------
> create sequence test1_id_seq;
> create table test1 (id int not null default nextval('test1_id_seq'), txt
> varchar);
> alter table test1 alter id set default 123;
> drop sequence test1_id_seq;
> ---------------------------------------------------
>
> which will just work fine.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org
>


--
Bruce Momjian http://candle.pha.pa.us
SRA OSS, Inc. http://www.sraoss.com

+ If your life is a hard drive, Christ can be your backup. +

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:46 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com