Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pEBId-0008WS-KF for pgsql-bugs@arkaria.postgresql.org; Sat, 07 Jan 2023 15:39:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pEBIc-0004FV-0u for pgsql-bugs@arkaria.postgresql.org; Sat, 07 Jan 2023 15:39:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pEAwu-00049i-K5 for pgsql-bugs@lists.postgresql.org; Sat, 07 Jan 2023 15:17:32 +0000 Received: from 102b.relay.hey.com ([204.62.115.200]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pEAwn-0001nS-CK for pgsql-bugs@lists.postgresql.org; Sat, 07 Jan 2023 15:17:32 +0000 Received: from hey.com (bigip-vip.rw-ash-int.37signals.com [10.20.0.24]) by 102.relay.hey.com (Postfix) with ESMTPS id EC51C20969 for ; Sat, 7 Jan 2023 15:17:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hey.com; s=heymail; t=1673104643; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lGrkq1fBW+7xh1PSXwf4J/E0lNarfw24Cg48aqLx7tU=; b=NWVOFe1Y9jtm6q8LmO0xguD1bSMyzwhpzvZESapkvFoKlCdqdwYBjUi0MaTmeloGI36Fko AEMQlaIjM+V737QLQOQzDi7bcAOL1p4qLROmVaz8Jj3BoCvC95/mAxq7WGVQWx5PqY4sdG cMtoI7IvOBiFDCp+MiVyKhaoGB/0DBFKqMPIz/IH44hoZ8lwDkdX4PE4P3SmkR7U3Wp0oK udtRH7eTr1XVmkouV4QQfZ5dgj/n4c27b5KBxTHio9SEXRQ35i2lFh0K18D9QzKQRGmwJ1 DOTbcolX4X9w9lVo3iCq7fAHQqdwwtemQ6cSYRlbqU8+rE1tl/8M67qv6l045A== Date: Sat, 07 Jan 2023 16:17:19 +0100 From: Dino Maric To: pgsql-bugs@lists.postgresql.org Message-ID: Subject: Confusion about the range types Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="--==_mimepart_63b98d039b839_421e1db052840"; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ----==_mimepart_63b98d039b839_421e1db052840 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hey! This is first time I'm writing, so I hope I've done this correctly :) I'm confused about how range types are returned when queried When I insert range like this: INSERT INTO public.tests VALUES (int4range(7,8,'[]')) or this INSERT INTO public.tests VALUES ('[7,8]') ---------------- After when querying table my return value for this column is not [7,8] but it is [7,9). I found this behaviour confusing, because I want to insert 7-8 ranges (including upper value) and then present that range to a user. Maybe I'm missing something :) My PG version is: PostgreSQL 14.0 on aarch64-apple-darwin20.6.0, compiled by Apple clang version 12.0.5 (clang-1205.0.22.9), 64-bit -- Sent with HEY =E2=80=94 Email as it should be ----==_mimepart_63b98d039b839_421e1db052840 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hey!

This is first time I'm writing, so I hope I've done th= is correctly :)

I'm confused about how range types are returned wh= en queried

When I insert range like this:

INSERT INTO publi= c.tests
VALUES (int4range(7,8,'[]'))

or this

INSERT INTO= public.tests
VALUES ('[7,8]')

----------------

After wh= en querying table my return value for this column is not [7,8] but it is = [7,9).
I found this behaviour confusing, because I wa= nt to insert 7-8 ranges (including upper value) and then present that ran= ge to a user.

Maybe I'm missing something :)


My PG version is
: PostgreSQL 14.0 on aarch64-apple-darwin20.6.= 0, compiled by Apple clang version 12.0.5 (clang-1205.0.22.9), 64-bit
=




--
Sent with HEY =E2=80=94 Em= ail as it should be
----==_mimepart_63b98d039b839_421e1db052840--