pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Zhang Mingli <zmlpostgres@gmail.com>
To: pgsql-bugs <pgsql-bugs@lists.postgresql.org>
To: 谭忠涛 <zhongtao.tan@seaboxdata.com>
Subject: Re: Incorrect sort result caused by ROLLUP and WHERE operation
Date: Thu, 2 Jan 2025 18:49:26 +0800
Message-ID: <c7363f1d-dcc3-4003-bd18-4f80af5be3d7@Spark> (raw)
In-Reply-To: <tencent_4568C7826D8BDEF01BC56D3D@qq.com>
References: <tencent_4568C7826D8BDEF01BC56D3D@qq.com>

Hi,


Zhang Mingli
www.hashdata.xyz

Do you mean order of null value (column a)  is wrong?
Use NULLS FIRST/LAST to order null values.
On Jan 2, 2025 at 18:19 +0800, 谭忠涛 <zhongtao.tan@seaboxdata.com>, wrote:
>
> Case:
> create table t1(a int, b int);
> insert into t1 values(1,1),(1,2);
> select a,b,sum(10) as s from t1 where a = 1 group by rollup(a,b) order by a, s desc;

view thread (3+ messages)  latest in thread

Message-ID: <c7363f1d-dcc3-4003-bd18-4f80af5be3d7@Spark>
Permalink:  ../c7363f1d-dcc3-4003-bd18-4f80af5be3d7@Spark/
Also on:    postgresql.org/message-id/c7363f1d-dcc3-4003-bd18-4f80af5be3d7@Spark

 · 

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: pgsql-bugs@postgresql.org
  Cc: zmlpostgres@gmail.com, pgsql-bugs@lists.postgresql.org, zhongtao.tan@seaboxdata.com
  Subject: Re: Incorrect sort result caused by ROLLUP and WHERE operation
  In-Reply-To: <c7363f1d-dcc3-4003-bd18-4f80af5be3d7@Spark>

* 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