How to drop sequence?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Igor Kryltsov

    How to drop sequence?

    Hi,

    I have table:


    # \d category;
    category_id | integer | not null default
    nextval('public .category_categ ory_id_seq'::te xt)
    category_name | character varying(100) | not null
    Indexes: category_pkey primary key btree (category_id)

    My goal is to remove sequence from category_id column and remove it after
    from DB.

    First I tried:

    DROP SEQUENCE category_catego ry_id_seq - fails saying that table category
    column category_id uses it

    Than I tried:

    ALTER TABLE category ALTER COLUMN category_id DROP DEFAULT;

    Now category_id column is shown as integer not null only but :

    DROP SEQUENCE category_catego ry_id_seq - fails saying that table category
    column category_id uses it again


    Any suggestions?

    Thank you,


    Igor


  • Ron St-Pierre

    #2
    Re: How to drop sequence?

    Igor Kryltsov wrote:
    [color=blue]
    >Hi,
    >
    >I have table:
    >
    >
    ># \d category;
    > category_id | integer | not null default
    >nextval('publi c.category_cate gory_id_seq'::t ext)
    > category_name | character varying(100) | not null
    >Indexes: category_pkey primary key btree (category_id)
    >
    >My goal is to remove sequence from category_id column and remove it after
    >from DB.
    >
    >First I tried:
    >
    >DROP SEQUENCE category_catego ry_id_seq - fails saying that table category
    >column category_id uses it
    >
    >Than I tried:
    >
    >ALTER TABLE category ALTER COLUMN category_id DROP DEFAULT;
    >
    >Now category_id column is shown as integer not null only but :
    >
    >DROP SEQUENCE category_catego ry_id_seq - fails saying that table category
    >column category_id uses it again
    >
    >
    >Any suggestions?
    >
    >Thank you,
    >
    >
    >Igor
    >
    >
    >
    >---------------------------(end of broadcast)---------------------------
    >TIP 5: Have you checked our extensive FAQ?
    >
    > http://www.postgresql.org/docs/faqs/FAQ.html
    >
    >[/color]
    Try

    DROP SEQUENCE category_catego ry_id_seq CASCADE;

    Ron



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

    Comment

    Working...