can't drop sequence even though table is gone

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

can't drop sequence even though table is gone

zorchon
I'm using PG 8.0.3 on Mac OS X 10.4.1.

I've dropped some tables that had associated sequences, but I am unable
to drop the sequences.  I haven't noticed any errors or crashes.  It
will be easy to rebuild the whole database.  I'm just reporting this
because it seemed unusual.

=> \ds
                    List of relations
 Schema |             Name             |   Type   | Owner
--------+------------------------------+----------+-------
public | seq_SML_sources_id           | sequence | fable
public | seq_SML_symbols_id           | sequence | fable
public | seq_TaggedEntities_id        | sequence | fable


=> drop sequence seq_SML_sources_id;
ERROR:  sequence "seq_sml_sources_id" does not exist


=> select * from pg_class where relname = 'seq_SML_sources_id';
      relname       | relnamespace | reltype  | relowner | relam |
relfilenode | reltablespace | relpages | reltuples | reltoastrelid |
reltoastidxid | relhasindex | relisshared | relkind | relnatts |
relchecks | reltriggers | relukeys | relfkeys | relrefs | relhasoids |
relhaspkey | relhasrules | relhassubclass | relacl
--------------------+--------------+----------+----------+-------+-------------+---------------+----------+-----------+---------------+---------------+-------------+-------------+---------+----------+-----------+-------------+----------+----------+---------+------------+------------+-------------+----------------+--------
 seq_SML_sources_id |         2200 | 12237018 |      100 |     0 |    
12237017 |             0 |        1 |         1 |             0
|             0 | f           | f           | S       |        9
|         0 |           0 |        0 |        0 |       0 | f          |
f          | f           | f              |


Thanks,
Kevin Murphy


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

               http://archives.postgresql.org
Reply | Threaded
Open this post in threaded view
|

Re: can't drop sequence even though table is gone

Douglas McNaught
Kevin Murphy <[hidden email]> writes:

>  Schema |             Name             |   Type   | Owner
> --------+------------------------------+----------+-------
> public | seq_SML_sources_id           | sequence | fable
> public | seq_SML_symbols_id           | sequence | fable
> public | seq_TaggedEntities_id        | sequence | fable
>
>
> => drop sequence seq_SML_sources_id;
> ERROR:  sequence "seq_sml_sources_id" does not exist

Your sequence name is mixed case, so you need to double quote it to
avoid case folding:

drop sequence "seq_SML_sources_id";

-Doug

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [hidden email] so that your
       message can get through to the mailing list cleanly
Reply | Threaded
Open this post in threaded view
|

Re: can't drop sequence even though table is gone

Scott Marlowe
In reply to this post by zorchon
On Wed, 2005-07-06 at 15:54, Kevin Murphy wrote:

> I'm using PG 8.0.3 on Mac OS X 10.4.1.
>
> I've dropped some tables that had associated sequences, but I am unable
> to drop the sequences.  I haven't noticed any errors or crashes.  It
> will be easy to rebuild the whole database.  I'm just reporting this
> because it seemed unusual.
>
> => \ds
>                     List of relations
>  Schema |             Name             |   Type   | Owner
> --------+------------------------------+----------+-------
> public | seq_SML_sources_id           | sequence | fable
> public | seq_SML_symbols_id           | sequence | fable
> public | seq_TaggedEntities_id        | sequence | fable
>
>
> => drop sequence seq_SML_sources_id;
> ERROR:  sequence "seq_sml_sources_id" does not exist


Notice the error message says seq_sml_sources_id doesn't exist.  And it
doesn't.  The sequence is named seq_SML_sources_id.  You need to quote
it to delete it, since postgresql folds case (to lower case) with
unquoted identifiers.

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [hidden email] so that your
       message can get through to the mailing list cleanly