public inbox for [email protected]  
help / color / mirror / Atom feed
From: jian he <[email protected]>
To: Tom Lane <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Subject: Re: ERROR: failed to find conversion function from unknown to text
Date: Thu, 29 Jan 2026 11:53:39 +0800
Message-ID: <CACJufxGEpQiMUOFcw5G67sNqgdyXxB7h-mpA_6neqNRf4qov=g@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CACJufxHu0sXO8791FDcNXp2bFnE89jyuGkJbLCQkhgWq6XuNLg@mail.gmail.com>
	<[email protected]>

On Thu, Jan 29, 2026 at 9:24 AM Tom Lane <[email protected]> wrote:
>
> Is there a good reason why that shouldn't be an error?

at that time, i want
select cast('a'::text as unknown);

behave the same as

select cast('a' as unknown);

To make it an error, meaning it's not possible to coerce to the unknown type.
We can do it in the function find_coercion_pathway, just
after the ``if (sourceTypeId == targetTypeId)`` check:

    if (targetTypeId == UNKNOWNOID)
        return COERCION_PATH_NONE;

it's also doable in the function can_coerce_type,
right after the ``if (inputTypeId == UNKNOWNOID)``:

        if (targetTypeId == UNKNOWNOID)
            return false;



--
jian
https://www.enterprisedb.com/






view thread (4+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: ERROR: failed to find conversion function from unknown to text
  In-Reply-To: <CACJufxGEpQiMUOFcw5G67sNqgdyXxB7h-mpA_6neqNRf4qov=g@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox