ALTER_CONVERSION(7pg18)
โจ ALTER_CONVERSION โจ
okay bestie, so ALTER_CONVERSION is a PostgreSQL thing and it's literally the manual page for changing the definition of a conversion. that's the NAME section, we're done with it, moving on ๐
๐ธ SYNOPSIS ๐ธ
ALTER CONVERSION name RENAME TO new_name
ALTER CONVERSION name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER CONVERSION name SET SCHEMA new_schema
three whole moves. pick your fighter. ๐
๐ DESCRIPTION ๐
so like. ALTER CONVERSION changes the definition of a conversion. that's the whole vibe. โจ
now the important part, no cap โ you must own the conversion to use ALTER CONVERSION. if you wanna alter the owner, you have to be able to SET ROLE to the new owning role, <em>and</em> that role has to have CREATE privilege on the conversion's schema. (these restrictions are there to enforce that altering the owner doesn't do anything you couldn't do by dropping and recreating the conversion. like, the rules exist so you can't sneak around the system, periodt.) BUT โ and this is the plot twist ๐ซถ โ a superuser can alter ownership of any conversion anyway. main character energy, honestly.
๐ฆ PARAMETERS ๐ฆ
nameโ the name (optionally schema-qualified) of an existing conversion.new_nameโ the new name of the conversion. it's giving glow-up. ๐new_ownerโ the new owner of the conversion.new_schemaโ the new schema for the conversion.
๐ EXAMPLES ๐
okay so say you wanna rename the conversion iso_8859_1_to_utf8 to latin1_to_unicode. iconic rebrand. do this:
ALTER CONVERSION iso_8859_1_to_utf8 RENAME TO latin1_to_unicode;
and if you wanna change the owner of the conversion iso_8859_1_to_utf8 to joe? hand it over bestie:
ALTER CONVERSION iso_8859_1_to_utf8 OWNER TO joe;
๐ COMPATIBILITY ๐
ngl, there is no ALTER CONVERSION statement in the SQL standard. it's a PostgreSQL original. slay, i guess. ๐
๐ SEE ALSO ๐
CREATE CONVERSION(CREATE_CONVERSION(7))DROP CONVERSION(DROP_CONVERSION(7))
k that's the whole page bestie, go forth and alter those conversions ๐
this was PostgreSQL 18.6 docs, dated 2026. mwah. ๐ญ๐ซถ
๐ฆ where this page comes from
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms