DROP_SEQUENCE(7pg15)

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

πŸŽ€ NAME πŸŽ€

okay so bestie, this is the DROP SEQUENCE(7) page β€” yep, the DROP_SEQUENCE(7pg15) one β€” and its whole personality is: DROP_SEQUENCE β€” remove a sequence. that's it. that's the name. periodt πŸ’…

✨ SYNOPSIS ✨

copy this exactly, no freestyling:

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

πŸ¦‹ DESCRIPTION πŸ¦‹

DROP SEQUENCE removes sequence number generators. the vibe is deletion, but with rules: a sequence can only be dropped by its owner or a superuser. no cap, those are the permissions. πŸ”₯

πŸ’– PARAMETERS πŸ’–

  • IF EXISTS β€” do not throw an error if the sequence does not exist. in that case, a notice is issued. so it's a notice, not an error β€” important distinction, bestie. ✨
  • name β€” the name of a sequence, and it can be optionally schema-qualified. yes, schema-qualified is allowed. πŸ’…
  • 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 domino effect. 🌈
  • RESTRICT β€” refuse to drop the sequence if any objects depend on it. This is the default. so yeah, default behavior is protective. πŸ’œ

πŸ”₯ EXAMPLES πŸ”₯

to remove the sequence serial, you literally run:

DROP SEQUENCE serial;

slay. ✨

🌈 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. that's the compatibility tea. πŸ“

πŸ‘‘ SEE ALSO πŸ‘‘


mwah πŸ’‹ β€” source/version + date check: PostgreSQL 15.19 Documentation, dated 2026. bye bestie, go be iconic with your sequences πŸ«ΆπŸ’…

πŸ“¦ where this page comes from