Problem removing Sequence in Postgresql 8.0.3

From: "That Fat Guy" <thatfatguy(at)fastmail(dot)fm>
To: pgsql-general(at)postgresql(dot)org
Subject: Problem removing Sequence in Postgresql 8.0.3
Date: 2008-10-19 02:07:36
Message-ID: 1224382056.18097.1280025971@webmail.messagingengine.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

I'm trying to remove a sequence from my production database (postgresql
8.0.3 running on RHEL4 PowerPC), but am getting an error that doesn't
make sense. When I run:

DROP SEQUENCE tbl_id_seq1 RESTRICT;

I get the following error:

ERROR: cannot drop sequence tbl_id_seq1 because table tbl column
id requires it
HINT: You may drop table tbl column id instead.

but I have updated the table to use the sequence tbl_id_seq.

mydb=# \d tbl
Table "public.tbl"
Column | Type | Modifiers
----------+----------------------+-------------------------------------------------
id | integer | not null default
nextval('tbl_id_seq'::text)
code | character(6) | not null
business | character varying | not null
h_indx | character varying(2) | not null
Indexes:
"tbl_pkey" PRIMARY KEY, btree (id)
"tbl_business_key" UNIQUE, btree (code)

And if I check the tables using this sequence, I get nothing:

mydb=# SELECT p.relname, a.adsrc FROM pg_class p JOIN pg_attrdef a
ON (p.relfilenode = a.adrelid) WHERE a.adsrc ~ 'tbl_id_seq1';
relname | adsrc
---------+-------
(0 rows)

Can anyone suggest how I might remove this sequence from my database (I
would like to avoid dropping and then recreating the table tbl)?

Thanks
Adam
--
That Fat Guy
thatfatguy(at)fastmail(dot)fm

--
http://www.fastmail.fm - IMAP accessible web-mail

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alain Roger 2008-10-19 14:03:47 cost variable into function
Previous Message Tom Lane 2008-10-19 01:05:54 Re: IS NULL seems to return false, even when parameter is NULL