DROP_SEQUENCE(7pg16)
π 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 π
CREATE SEQUENCE(CREATE_SEQUENCE(7))ALTER SEQUENCE(ALTER_SEQUENCE(7))
mwah π β this page is from PostgreSQL 16.15, dated 2026, and it's the DROP SEQUENCE(7) page. periodt π
π
π¦ where this page comes from
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-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