DROP_SEQUENCE(7pg17)
π 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:
- the standard only allows one sequence to be dropped per command (we let you do more, we're generous like that π)
- apart from the
IF EXISTSoption, which is a PostgreSQL extension β¨
β SEE ALSO β
CREATE SEQUENCE(CREATE_SEQUENCE(7))ALTER SEQUENCE(ALTER_SEQUENCE(7))
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
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms