Skip site navigation (1) Skip section navigation (2)

Bug in Dependencies Code in 7.3.x?

From: Tara Piorkowski <tara(at)vilaj(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Bug in Dependencies Code in 7.3.x?
Date: 2002-12-30 16:09:55
Message-ID: 3E106FD3.8010000@vilaj.com (view raw or flat)
Thread:
Lists: pgsql-hackers
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/>


Responses

pgsql-hackers by date

Next:From: Manfred KoizarDate: 2002-12-30 18:50:52
Subject: Re: MOVE strangeness
Previous:From: Dan LangilleDate: 2002-12-30 12:34:23
Subject: Re: why was libpq.so's version number bumped?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group