DROP_SEQUENCE(7pg16)

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

πŸ’– DROP SEQUENCE β€” the pg16 manual page πŸ’–

okay so bestie, welcome to the DROP SEQUENCE page from the PostgreSQL 16.15 Documentation β€” yes, the pg16 one. We're gonna yeet sequence number generators, but make it make sense πŸ’….


✨ NAME ✨

DROP_SEQUENCE β€” remove a sequence. That's the whole vibe. A sequence is getting removed, periodt πŸŽ€.

πŸ¦‹ SYNOPSIS πŸ¦‹

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

🌸 DESCRIPTION 🌸

DROP SEQUENCE removes sequence number generators β€” like, actually removes them, not just gives them a time-out 😭.

A sequence can only be dropped by its owner or a superuser. No random bestie off the street can just drop it. Respect the hierarchy πŸ‘‘.

πŸŽ€ PARAMETERS πŸŽ€

  • IF EXISTS β€” do not throw an error if the sequence does not exist. A notice is issued in this case. So it's giving "no drama, just a little heads-up" πŸ’Œ.
  • name β€” the name (optionally schema-qualified) of a sequence. Yes, schema-qualified is allowed, slay 🫢.
  • CASCADE β€” automatically drop objects that depend on the sequence, and in turn all objects that depend on those objects (see Section 5.14). It's giving chain reaction energy πŸ”₯.
  • RESTRICT β€” refuse to drop the sequence if any objects depend on it. This is the default. Very "nope, not until you deal with your dependencies" πŸ’€.

πŸ“ EXAMPLES πŸ“

To remove the sequence serial:

DROP SEQUENCE serial;

Short, iconic, done 😌.

🌈 COMPATIBILITY 🌈

DROP SEQUENCE conforms to the SQL standard, except that the standard only allows one sequence to be dropped per command, and apart from the IF EXISTS option, which is a PostgreSQL extension. So yes, mostly standard behavior, with a lil PostgreSQL flair ✨.

πŸ’œ SEE ALSO πŸ’œ


mwah πŸ’‹ β€” this page is from PostgreSQL 16.15, dated 2026, and it's the DROP SEQUENCE(7) page. periodt πŸ’…πŸŽ€

πŸ“¦ where this page comes from