fix 'ERROR: could not identify a comparison function for type unknown'

From: 下雨天 <chenzaini(at)qq(dot)com>
To: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: fix 'ERROR: could not identify a comparison function for type unknown'
Date: 2023-10-31 03:15:54
Message-ID: tencent_CED800ACF698679D7C9D257F6E051FF9BC09@qq.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, all:

when I execute simple sql,report ERROR:

postgres=# CREATE TABLE test_v(id int,name varchar(30));
CREATE TABLE
postgres=# insert into test_v values(9,'abc'),(9,'def'),(9,'gh'), (9,'gh');
INSERT 0 4
postgres=# explain (costs off) select distinct (id,name,'D3Q84xpymM',123,'123') from test_v;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;QUERY PLAN &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
-------------------------------------------------------------
&nbsp;Unique
&nbsp; &nbsp;-&gt; &nbsp;Sort
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Sort Key: (ROW(id, name, 'D3Q84xpymM', 123, '123'))
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-&gt; &nbsp;Seq Scan on test_v
(4 rows)

postgres=# select distinct (id,name,'D3Q84xpymM',123,'123') from test_v;
ERROR: &nbsp;could not identify a comparison function for type unknown

PostgreSQL &nbsp;could not identify 'D3Q84xpymM' and '123' datatype:

we can allow an UNKNOWN type to change it to TEXT,&nbsp;
please check my patch.

Thanks!

Attachment Content-Type Size
FD112B01@A84E6B19.6A714065.png.jpg image/jpeg 278.4 KB
error_fix.patch application/octet-stream 1.0 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2023-10-31 03:25:44 Re: Not deleted mentions of the cleared path
Previous Message Amit Kapila 2023-10-31 03:14:58 Re: Is this a problem in GenericXLogFinish()?