Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sRvJL-0023eh-3y for pgsql-general@arkaria.postgresql.org; Thu, 11 Jul 2024 15:02:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sRvJJ-00F0FF-Qe for pgsql-general@arkaria.postgresql.org; Thu, 11 Jul 2024 15:02:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sRvJJ-00F0F5-EN for pgsql-general@lists.postgresql.org; Thu, 11 Jul 2024 15:02:17 +0000 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sRvJG-001YE8-RU for pgsql-general@lists.postgresql.org; Thu, 11 Jul 2024 15:02:16 +0000 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-6bce380eb96so635953a12.0 for ; Thu, 11 Jul 2024 08:02:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720710134; x=1721314934; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=MIJJjoH3MmsobN+Gqu+Z9LmOOJaBCNPoJ9KcgO3hgX0=; b=nMOMBNM6n/8vu6CU8ZaXDaNZQUoWT/4Hmnf9lr1hW6+2z9bhpES/BVDkuuh1SxriAF 4TTKDpcHxY5QRvH5UQ8flVdgYppHfk2VcgnwH5v6t0KTth2ubAySmXGZ83mo6Ru/F8w4 D81HfQzueYpovFLvRutr+GXHmpR8oHfZMuG9+p2bnKILhU8yud0AvubNdkARGZqqBjBi DiujzVuw2/kSRUFuSI4NkQcqM2WNWqA2HtdxI/JgF1l0jOcXC44gl55xMvSM91VSgigt dJ8vc4TXjoTl30HZEVueTJwEMziPku++S4/+Sa00XkpXmbAhNro23ITGcNMXcL1o0bMA upqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720710134; x=1721314934; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MIJJjoH3MmsobN+Gqu+Z9LmOOJaBCNPoJ9KcgO3hgX0=; b=C7QoCzKpeR1clfz4XMQrVqZpomU5OIvv+mh+1KmvgT5pJ/1lJmaVcHh/VqycuYUpTm F0T+Usk+g7zjxt+tAVTVYK9gTQ5qv+01fndmR4IIYFP4KrLDWzp+sbqp8zH4Z/VO4s+1 QM9lBCM1sbOfJzGi9dQiDIaHvj0d9jfx4yGNmgWOqtlXOHCNB6+vUxlMikei5LuhzxKK Yy8sNFca9CRgigQkCqi0LIIibwTQzraOtRfko7Pc+nxe8KKcbnz2XIGc6mnExDClVoCj DYRbjhALTuS0s8Oi+y7APsYSoz+pRpnwxukWWoo7sJ+ApEUPzjDb98TWJbKVEHqOIcYD N7nw== X-Gm-Message-State: AOJu0YwsQ6UkLAyednrGv5yoxy/dZCc/zOk8szjvRIE48poSdsbingit q868pCHzNQfWoeiWei7hs78iQzV0XnqDcHv/e/RCbuA2aiCqy5/voXTmOli0QwKJmiWxOU+MbYe nqVLekbkTm56zzlgS9n7wNpSOZXU= X-Google-Smtp-Source: AGHT+IEDaqmOj6pBzBYEX7QiogiQ3AzMTx25g7GeW8tvkMGrerPxslGT9Y5Frp9TDxIYCR5loc8AsV3VSyGdrXVDZQk= X-Received: by 2002:a17:90a:be09:b0:2c8:452d:e634 with SMTP id 98e67ed59e1d1-2ca35d62a22mr6319917a91.45.1720710133681; Thu, 11 Jul 2024 08:02:13 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: PetSerAl Date: Thu, 11 Jul 2024 18:02:03 +0300 Message-ID: Subject: Re: Postgresql range_agg() Return empty list To: Han Tang Cc: pgsql-general@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Your update expression does not handle empty ranges properly, but convert them into complete ranges. https://dbfiddle.uk/Ia6wESpL On Thu, Jul 11, 2024 at 5:55=E2=80=AFPM Han Tang wro= te: > > Hi > > Hope you are doing well! > > I am using range_agg() function, it works fine with original table value > > Query Result > > But when I try to do some update for range value, it will give back an em= pty list > > Select range_agg(b.r) > From ( > Select int8range(lower(bin_range)+1, upper(bin_range)+5) as r > From bin_data) as b; > > Query Result > > I test with the same query in fiddle but no issue there > > https://dbfiddle.uk/1MRn8hn6 > > All these query are running on pgAdmin4, wondering why it happens > > Thanks > Han > >