DROP_SEQUENCE(7pg17)

πŸ“¦ version 17.11, in opensuse-leap 16.0

πŸ’… DROP SEQUENCE πŸ’…

okay so bestie, this is the DROP SEQUENCE(7) page from the PostgreSQL 17.11 documentation, and we're gonna get you through it together 🫢


🌸 NAME 🌸

DROP_SEQUENCE β€” remove a sequence ✨


πŸŽ€ SYNOPSIS πŸŽ€

DROP SEQUENCE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]

like, that's the whole vibe. copy it exactly, don't get creative πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

So DROP SEQUENCE removes sequence number generators. that's it, that's the job πŸ’€

but here's the important bit β€” a sequence can only be dropped by its owner or a superuser. so if you're not the owner and you're not a superuser, no cap, it's not happening πŸ™ˆ


✨ PARAMETERS ✨

  • IF EXISTS β€” do not throw an error if the sequence does not exist. instead a notice is issued in this case. so like, it just goes "hey btw, wasn't there" and moves on, very chill of it 🌈
  • name β€” the name of a sequence, and it can be schema-qualified if you want to be specific about it (optional queen behavior πŸ‘‘).
  • CASCADE β€” automatically drop objects that depend on the sequence, and in turn all objects that depend on those objects (see Section 5.15). it's giving chain reaction, it's giving domino effect πŸ”₯
  • RESTRICT β€” refuse to drop the sequence if any objects depend on it. this is the default, so like, if you don't say anything, this is what you get. no surprises, very demure πŸ’…

πŸ’– EXAMPLES πŸ’–

okay so to remove the sequence serial, you literally just:

DROP SEQUENCE serial;

that's it. icon behavior. ate and left no crumbs πŸ“


🧚 COMPATIBILITY 🧚

DROP SEQUENCE conforms to the SQL standard, with two lil exceptions bestie:

  1. the standard only allows one sequence to be dropped per command (we let you do more, we're generous like that πŸ’œ)
  2. apart from the IF EXISTS option, which is a PostgreSQL extension ✨

⭐ SEE ALSO ⭐


lowkey that's the whole page. go forth and drop sequences responsibly, bestie πŸ¦‹πŸ’…

mwah πŸ’‹ β€” this has been PostgreSQL 17.11, dated 2026, DROP SEQUENCE(7). periodt.

πŸ“¦ where this page comes from