DROP_SEQUENCE(7)

โœจ DROP SEQUENCE โœจ

okay bestie, welcome to the DROP SEQUENCE page of the PostgreSQL 18.6 docs (manual section 7, for the record) ๐Ÿ’– this is the one where we say bye-bye to a sequence, and honestly? it's giving spring cleaning ๐Ÿงนโœจ


๐ŸŒธ NAME ๐ŸŒธ

DROP_SEQUENCE โ€” remove a sequence ๐Ÿ’…


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

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

๐ŸŽ€ DESCRIPTION ๐ŸŽ€

So DROP SEQUENCE removes sequence number generators. that's the whole vibe. but listen โ€” not just anyone can do it: a sequence can only be dropped by its owner or a superuser. no random walk-ups, no cap ๐Ÿซถ


๐Ÿ’– PARAMETERS ๐Ÿ’–

  • IF EXISTS โ€” don't throw an error if the sequence literally does not exist. instead a notice gets issued in that case. so chill of it ๐Ÿ™ˆ
  • name โ€” the name of a sequence (and yes, it can be schema-qualified if you're feeling fancy ๐ŸŽ€).
  • CASCADE โ€” automatically drops objects that depend on the sequence, and in turn all the objects that depend on those objects (peep Section 5.15 for the lore). it's the domino effect, it's giving chain reaction ๐Ÿ’€
  • RESTRICT โ€” refuse to drop the sequence if any objects depend on it. this is the default, so it's the chill safe one ๐Ÿงš

๐ŸŒˆ EXAMPLES ๐ŸŒˆ

wanna remove the sequence serial? say less:

DROP SEQUENCE serial;

and that's it, she's gone, main character exit ๐Ÿ‘‘


โญ COMPATIBILITY โญ

DROP SEQUENCE conforms to the SQL standard ๐Ÿซถ except โ€” plot twist โ€” the standard only allows one sequence to be dropped per command. and also, apart from the IF EXISTS option, which is a PostgreSQL extension. so we're a little extra, as always ๐Ÿ’…


๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘


okay that's the whole page bestie, go forth and drop responsibly ๐ŸŒธโœจ this was PostgreSQL 18.6, dated 2026, and it's DROP SEQUENCE(7) โ€” periodt ๐Ÿ’–๐Ÿฆ‹๐ŸŽ€