I've found a situation that doesn't look correct to me in 7.3.1 (and presumably 7.3 as well). If I alter a column so that it no longer uses a sequence for default values and then try to drop the aforementioned sequence, the dependency checking code does not allow me to drop the sequence on the basis that it is still deing used. As I have removed the default setting, however, this should not be the case, as far as I can tell. The following illustrates my finding.

junk=> create table testing
junk-> (testing_id serial not null primary key);
NOTICE: CREATE TABLE will create implicit sequence 'testing_testing_id_seq' for SERIAL column 'testing.testing_id'
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'testing_pkey' for table 'testing'
CREATE TABLE
junk=> \d
List of relations
Schema | Name | Type | Owner
--------+------------------------+----------+--------
public | testing | table | tara
public | testing_testing_id_seq | sequence | tara
(2 rows)

junk=> \d testing
Table "public.testing"
Column | Type | Modifiers
------------+---------+-----------------------------------------------------------------
testing_id | integer | not null default nextval('public.testing_testing_id_seq'::text)
Indexes: testing_pkey primary key btree (testing_id)

junk=> alter table testing
junk-> alter column testing_id drop default;
ALTER TABLE
junk=> \d testing
Table "public.testing"
Column | Type | Modifiers
------------+---------+-----------
testing_id | integer | not null
Indexes: testing_pkey primary key btree (testing_id)

junk=> drop sequence testing_testing_id_seq;
ERROR: Cannot drop sequence testing_testing_id_seq because table testing column testing_id requires it
You may drop table testing column testing_id instead

--
Tara Piorkowski
System Administrator, vilaj.com, LLC
<http://www.vilaj.com/>


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to