Subject: Re: Changing a varchar(7) domain into text directly in pg_type

From: Tom Lane <[email-masked]>
Date: Wed, 28 May 2025 10:21:01 -0400

Richard Zetterberg <[email-masked]> writes:
> In my head, this change would be instant and postgres would carry on like
> nothing happened and that the domain always had the type `text`. Is this a
> fools errand? Or could it actually make sense in this situation?

Yeah, I think you can probably get away with this (especially since
you've already tested the effects in a throwaway database, IIUC).

The main thing people tend to forget when doing this sort of manual
catalog surgery is updating pg_depend and/or pg_shdepend.  But here
there's nothing to do.  Since both varchar and text are undroppable
built-in types, we don't bother to make dependencies on them.  And
you're not changing the domain's schema or owner, so its other
dependencies don't need to change.

			regards, tom lane

---

From: Richard Zetterberg <[email-masked]>
Date: Fri, 30 May 2025 09:17:02 +0200

Ron, thanks for the feedback and for teaching me a new word (bog-standard).

Tom, thanks for the feedback and extra info about pg_depend. I've tested
simple queries on all of the tables and it seems to be fine. Hopefully
nothing will turn up when we start running the more advanced queries.
Either way, it will be easy to revert to previous backup, since the
database is only used for analysis on static data.