From: | 下雨天 <409800246(at)qq(dot)com> |
---|---|
To: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | 回复: BUG #18173: ERROR: could not identify a comparison function for type unknown |
Date: | 2023-10-31 12:19:26 |
Message-ID: | tencent_6BA3819715C0CE1EC6EC89EF9EA4D5ADC506@qq.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
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(dot)albe(at)cybertec(dot)at>;
发送时间: 2023年10月31日(星期二) 晚上7:10
收件人: "下雨天"<409800246(at)qq(dot)com>;"pgsql-bugs"<pgsql-bugs(at)lists(dot)postgresql(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2023-10-31 14:51:52 | Re: BUG #18173: ERROR: could not identify a comparison function for type unknown |
Previous Message | Laurenz Albe | 2023-10-31 11:10:05 | Re: BUG #18173: ERROR: could not identify a comparison function for type unknown |