Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7755177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:30:11+00:00 2026-06-01T12:30:11+00:00

I would like to drop the sequence used in table and the table itself

  • 0

I would like to drop the sequence used in table and the table itself in one statement using CASCADE, but I’m getting NOTICE and table is not dropped. For example:

CREATE SEQUENCE seq1;
CREATE TABLE t1 (f1 INT NOT NULL DEFAULT nextval('seq1'));

And then when I do:

DROP SEQUENCE seq1 CASCADE;

I get following message, and the table is not dropped:

NOTICE:  drop cascades to default for table t1 column f1

I’m definitely doing something wrong but these are my very first steps in PostgreSQL.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T12:30:12+00:00Added an answer on June 1, 2026 at 12:30 pm

    The table is never a depending object of an associated sequence and is never dropped by:

    DROP SEQUENCE ... CASCADE;
    

    Only a column DEFAULT drawing from the sequence "depends" on the sequence and is set to NULL if the sequence is deleted with CASCADE.

    It’s the other way round: if the sequence is owned by a table column it is dropped with:

    DROP TABLE f1 CASCADE;
    

    For a sequence to be owned by a table column you can either use the serial type, or ALTER an existing sequence:

    ALTER SEQUENCE seq1 OWNED BY t1.f1;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Rather than create, and then drop a table in sqlite3, I would like to
I'm using Jqueryui connected sortable lists and I would like to drop elements only
I would like to replace drop down list (that has on change event that
I would like to drag and drop my data file onto a Python script
I would like to be able to drop to the python REPL from the
I would like to display two values in an drop down view of my
I would like to change the color when a item of the spinner drop
I would like to use WebKit's box-shadow css property for a little drop-down. The
I am creating an app where i would like to use both the drop
How would I drag and drop something into a static control? It looks like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.