Re: Controlling the usage of a user-defined cast

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sami Imseih <samimseih(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Controlling the usage of a user-defined cast
Date: 2024-12-12 16:51:37
Message-ID: 659109.1734022297@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Sami Imseih <samimseih(at)gmail(dot)com> writes:
> When a user-defined CAST is created, it has the ability to break behavior of built-in
> casts that could be performed implicitly, i.e. without a cast defined in pg_cast.

The requirement for ownership of at least one type means that the
example you give could only be done by a superuser. I think there
could be an argument for requiring ownership of *both* types, but
perhaps that would break some useful cases.

> There is currently no way to prevent the usage of a user-defined cast. Should there be one?

I don't think so, and I don't see any reasonable way to do it.
You will get nowhere proposing a GUC that changes query semantics ---
we learned that that was a bad idea decades ago.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2024-12-12 16:54:21 Re: Document NULL
Previous Message Tom Lane 2024-12-12 16:45:01 Re: Allow subfield references without parentheses