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

Started by 下雨天almost 3 years ago1 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

appliessuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t48670
psql -h localhost -U postgres

Built from patchset v1 (message #1), August 17, 2026 at 10:13 AM.

Jump to latest
#1下雨天
chenzaini@qq.com

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;
                         QUERY PLAN                          
-------------------------------------------------------------
 Unique
   ->  Sort
         Sort Key: (ROW(id, name, 'D3Q84xpymM', 123, '123'))
         ->  Seq Scan on test_v
(4 rows)

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

PostgreSQL  could not identify 'D3Q84xpymM' and '123' datatype:

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

Thanks!

Attachments:

FD112B01@A84E6B19.6A714065.png.jpgimage/jpeg; name="FD112B01@A84E6B19.6A714065.png.jpg"Download+11-4
error_fix.patchapplication/octet-stream; charset=gb18030; name=error_fix.patchDownload+26-0