From: 下雨天 <409800246@qq.com>
To: Laurenz Albe <laurenz.albe@cybertec.at>
To: pgsql-bugs <pgsql-bugs@lists.postgresql.org>
Subject: 回复: BUG #18173: ERROR: could not identify a comparison function for type unknown
Date: Tue, 31 Oct 2023 20:19:26 +0800
Message-ID: <tencent_6BA3819715C0CE1EC6EC89EF9EA4D5ADC506@qq.com> (raw)
In-Reply-To: <52e52bddd9d5396ca07f103f799518f82e2c8aad.camel@cybertec.at>
References: <18173-c971c32eb961e810@postgresql.org>
<52e52bddd9d5396ca07f103f799518f82e2c8aad.camel@cybertec.at>
Thank you very much for your reply.
when remove the parentheses, it is OK.
because plan is diffrent:
postgres=# explain select distinct id,name,'D3Q84xpymM',123,'123' from test_v;
QUERY PLAN
------------------------------------------------------------------
HashAggregate (cost=28.75..30.75 rows=200 width=105)
Group Key: id, name
-> Seq Scan on test_v (cost=0.00..22.50 rows=1250 width=105)
(3 rows)
postgres=# explain select distinct (id,name,'D3Q84xpymM',123,'123') from test_v;
QUERY PLAN
-----------------------------------------------------------------------
Unique (cost=86.80..93.05 rows=200 width=32)
-> Sort (cost=86.80..89.92 rows=1250 width=32)
Sort Key: (ROW(id, name, 'D3Q84xpymM', 123, '123'))
-> Seq Scan on test_v (cost=0.00..22.50 rows=1250 width=32)
(4 rows)
Sometimes users just want to use parentheses, because they were used on Oracle like this before.
Thanks!
------------------ 原始邮件 ------------------
发件人: "Laurenz Albe" <laurenz.albe@cybertec.at>;
发送时间: 2023年10月31日(星期二) 晚上7:10
收件人: "下雨天"<409800246@qq.com>;"pgsql-bugs"<pgsql-bugs@lists.postgresql.org>;
主题: Re: BUG #18173: ERROR: could not identify a comparison function for type unknown
On Mon, 2023-10-30 at 13:24 +0000, PG Bug reporting form wrote:
> PostgreSQL version: 16.0
>
> 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
This is not a bug. You probably want to remove the parentheses.
Yours,
Laurenz Albe
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: 409800246@qq.com, laurenz.albe@cybertec.at
Subject: Re: 回复: BUG #18173: ERROR: could not identify a comparison function for type unknown
In-Reply-To: <tencent_6BA3819715C0CE1EC6EC89EF9EA4D5ADC506@qq.com>
References: <18173-c971c32eb961e810@postgresql.org> <52e52bddd9d5396ca07f103f799518f82e2c8aad.camel@cybertec.at> <tencent_6BA3819715C0CE1EC6EC89EF9EA4D5ADC506@qq.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox