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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Zetterberg <richard(dot)zetterberg(at)googlemail(dot)com>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Changing a varchar(7) domain into text directly in pg_type
Date: 2025-05-28 14:21:01
Message-ID: 1452427.1748442061@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Richard Zetterberg <richard(dot)zetterberg(at)googlemail(dot)com> 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Zetterberg 2025-05-30 07:17:02 Re: Changing a varchar(7) domain into text directly in pg_type
Previous Message Ron Johnson 2025-05-28 14:13:54 Re: Changing a varchar(7) domain into text directly in pg_type