DROP_CAST(7pg14)

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

πŸ’… DROP CAST πŸ’…

okay so bestie, this is the DROP CAST page from the PostgreSQL 14.24 Documentation β€” yes the (7) means it lives in the SQL command section of the manual, iykyk. Grab a lil snack, we're learning how to yeet a cast πŸŽ€


✨ NAME ✨

DROP_CAST β€” remove a cast. that's it, that's the whole vibe. deleting a cast. gone. buh-bye πŸ‘‹

✨ SYNOPSIS ✨

DROP CAST [ IF EXISTS ] (source_type AS target_type) [ CASCADE | RESTRICT ]

look at her. iconic syntax. every bracket is optional-ish, so read carefully πŸ¦‹

✨ DESCRIPTION ✨

DROP CAST removes a previously defined cast. literally just takes a cast that already exists and un-exists it πŸ’€

🫢 important privilege check, no cap: to be able to drop a cast, you must own the source or the target data type. These are the same privileges that are required to create a cast. so like β€” you can't just wander in and delete someone else's cast, be so fr.

✨ PARAMETERS ✨

  • IF EXISTS β€” Do not throw an error if the cast does not exist. A notice is issued in this case. so instead of a whole dramatic error moment, you just get a lil notice. very chill, very demure 😌
  • source_type β€” The name of the source data type of the cast. the "from" side of the situationship πŸ“
  • target_type β€” The name of the target data type of the cast. the "to" side πŸ’œ
  • CASCADE, RESTRICT β€” These key words do not have any effect, since there are no dependencies on casts. yeah they're just... there. decorative. they show up, they do nothing, they leave. honestly relatable πŸ™ˆ

✨ EXAMPLES ✨

say you wanna drop the cast from type text to type int. you'd do:

DROP CAST (text AS int);

and that's it. slay. the cast is gone πŸ”₯

✨ COMPATIBILITY ✨

The DROP CAST command conforms to the SQL standard. we're standard-compliant AND cute, main character energy fr fr πŸ‘‘

✨ SEE ALSO ✨

  • CREATE CAST (see CREATE_CAST(7)) β€” the origin story, the birthplace, the "how did we get here" 🌈

k bye bestie, go forth and drop casts responsibly πŸ’–βœ¨

this has been DROP CAST(7) β€” PostgreSQL 14.24, dated 2026 πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from