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 ๐
CREATE SEQUENCE(CREATE_SEQUENCE(7))ALTER SEQUENCE(ALTER_SEQUENCE(7))
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 ๐๐ฆ๐
๐ฆ where this page comes from
- alpine 3.23: postgresql18-doc 18.6-r0 ยท PostgreSQL
- alpine 3.24: postgresql18-doc 18.6-r0 ยท PostgreSQL
- arch rolling: postgresql 18.6-4 ยท PostgreSQL
- fedora 43: postgresql 18.6-1.fc43 ยท PostgreSQL
- fedora 43: postgresql 18.6-1.fc43 ยท PostgreSQL
- fedora 44: postgresql 18.6-1.fc44 ยท PostgreSQL
- fedora 44: postgresql 18.6-1.fc44 ยท PostgreSQL
- nixos 26.05: postgresql 18.6
- ubuntu resolute: postgresql-client-18 18.6-0ubuntu0.26.04.1 ยท PostgreSQL
- ubuntu stonking: postgresql-client-18 18.6-3build2 ยท PostgreSQL
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms