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 1sRlhk-0010bY-0h for pgsql-general@arkaria.postgresql.org; Thu, 11 Jul 2024 04:46:52 +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 1sRlhi-00B1Hg-Kl for pgsql-general@arkaria.postgresql.org; Thu, 11 Jul 2024 04:46:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sRlhi-00B1Ek-4a for pgsql-general@lists.postgresql.org; Thu, 11 Jul 2024 04:46:50 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sRlhf-001V8V-Bh for pgsql-general@lists.postgresql.org; Thu, 11 Jul 2024 04:46:49 +0000 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1fb53bfb6easo3018825ad.2 for ; Wed, 10 Jul 2024 21:46:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=illuminatedcomputing-com.20230601.gappssmtp.com; s=20230601; t=1720673205; x=1721278005; 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=eWcq0D/gBj6bvZISYdAD99Qz5l4FXke4RRy1rGuaqAY=; b=uClWnQ8Nj0q8AwxZx9RbeinXGHQftMOam7lXCEolLQj+IGsTaiBDgtQ+v3GCS+TDGz xcFUI15ewyV3DoACjdCd5Pp86tfYJ2PshA/u6QOviDgKQprvJGpuuN74AJ5bDPbCrBPY mS3Uw10VAVaLEulrFgf+bSYFja3A5ay++FmU2hdLt5BAY5CXO1uXkMV72tvKegVd7jL6 OtRjbR3AoY/ojHIsyDWXgNq6PEAHam4iF6RKGLCKc/awYI4MHC5o/6qSvkTu+QDA+Swl p7B1w89I2laXkRPH7zNR6t488yddGbsDS0vJ2d2Om4BZwFyYx7SlhDJ0YOdPhHJH9o2q sLfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720673205; x=1721278005; 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=eWcq0D/gBj6bvZISYdAD99Qz5l4FXke4RRy1rGuaqAY=; b=Q+9Y+GbMPX5TMPTvuUR9J8ux0GMkWblLGJq7Wk3BbqKFR4W/QsRq5+m1yflmV3GOeB 6jFbF7O1r7UuGKSSxRgs6BZx2AkknHp6KGhiyUssgeTOqCg97uMXX9FfeMJJmH4/NmAP jdHIQJUmXsuid+yXHv4J+z4Sm1pPRqR5FWzXSUjHpq25YutYk15CIWksliyZTGeYlEuR vj4Ev0pFD3CKuY1zTwIZ0urPKLieWoWpE2xwlBmtbWmTUG19npRqsbaC0ZPe/QnO/LWu vRXcEmXTWU2f1sTNI1bKdXp89QikvW1f8H6lqLbIPHVT8dKN2Fs0A97kXdvjkH84mHs+ GWyg== X-Gm-Message-State: AOJu0Yy3gpY4TggiZVvoNVEdEWZqPW74QiJpga03Ud1PIbZosqmMmD4H iX6bG33+msUXxUTBlF0P2dZiD5d3m5FyYkM0BSYXeCRvFQ6yi4nq0CjdVVVbhhI0HpDIrITBOcG FXKk8FsuN+FwJOKIYi7DiOnuKL6pOcSAzXZa8ZA== X-Google-Smtp-Source: AGHT+IFCf6BSJAZ8Ck0EDkiM/3LS0rEQquAZyfz/7YbK4TRl2jj0hdkdtY6z5OZK06uNDaqcwdHfJB+DkSt/OeBcoTk= X-Received: by 2002:a17:90a:4cc4:b0:2c9:62be:292a with SMTP id 98e67ed59e1d1-2ca35c66a4emr6235108a91.21.1720673205014; Wed, 10 Jul 2024 21:46:45 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Paul A Jungwirth Date: Wed, 10 Jul 2024 21:46:33 -0700 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 On Wed, Jul 10, 2024 at 6:37=E2=80=AFPM Han Tang wro= te: > 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 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; > 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