public inbox for [email protected]  
help / color / mirror / Atom feed
From: Paul A Jungwirth <[email protected]>
To: Han Tang <[email protected]>
Cc: [email protected]
Subject: Re: Postgresql range_agg() Return empty list
Date: Wed, 10 Jul 2024 21:46:33 -0700
Message-ID: <CA+renyVrWZzX5NcKPyCD5sZQbf6pGOi=7wg=iAWDPXnt+YndTw@mail.gmail.com> (raw)
In-Reply-To: <CAAqOU0s08dTFu0tQgEg=q+ifeU4aSYwxCG=ae229PrwwAea2mA@mail.gmail.com>
References: <CAAqOU0s08dTFu0tQgEg=q+ifeU4aSYwxCG=ae229PrwwAea2mA@mail.gmail.com>

On Wed, Jul 10, 2024 at 6:37 PM Han Tang <[email protected]> wrote:
> I am using range_agg() function, it works fine with original table value
>
> But when I try to do some update for range value, it will give back an empty list
>
> Select range_agg(b.r)
> From (
>   Select int8range(lower(bin_range)+1, upper(bin_range)+5) as r
>   From bin_data) as b;
>

The value '(,)' signifies a range with no lower bound and no upper
bound. So '{(,)}' is the multirange that contains just that range
(unbounded in either direction)---in other words not an empty list but
every integer. Ranges use null to indicate unbounded, so it is the
same as '(null,null)'. It looks like the inputs in your second
screenshot must include some ranges with null lower & upper bounds, so
then when you combine them you get everything.

It appears that query is on lines 153-156 of some larger sequence? So
I'm guessing the table contents are not the same as when you generated
the first screenshot.

If you think something else is going on, perhaps you could share the
full contents of bin_data.

Yours,
Paul






view thread (2+ messages)

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: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Postgresql range_agg() Return empty list
  In-Reply-To: <CA+renyVrWZzX5NcKPyCD5sZQbf6pGOi=7wg=iAWDPXnt+YndTw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox