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 1so9nv-008iY8-7x for pgsql-general@arkaria.postgresql.org; Tue, 10 Sep 2024 22:57:48 +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 1so9nu-003zy6-5x for pgsql-general@arkaria.postgresql.org; Tue, 10 Sep 2024 22:57:46 +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 1so9nt-003zxw-Ma for pgsql-general@lists.postgresql.org; Tue, 10 Sep 2024 22:57:45 +0000 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1so9nq-000XNo-6V for pgsql-general@postgresql.org; Tue, 10 Sep 2024 22:57:44 +0000 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a8d29b7edc2so508156966b.1 for ; Tue, 10 Sep 2024 15:57:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20230601.gappssmtp.com; s=20230601; t=1726009060; x=1726613860; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=FoLNJ+7i1Iu9FrRrLK7c5RIjKg0qAb79YRUumxN78pQ=; b=m1y9u05Z7FsG1ZkWie5L/ygeHTUMO/+rL23jttT9pecBke0TGWoV9XV9Zyp7X3lSL7 Ps/+tJP3LyPonUDNUgpaQXfrKlCbAyQ5ETcNu8ajBjzfjQ8qJS2R6PtDHmXFSYvvCiC0 f/dSaSDmkFg/bSl3WXAUvUitcfMsLtCMaoByyntbOVH+0nDQRyAYI6E5Y1ylDIIw0yaV y67AlC7MUlOLrTC113VVT/cvMXxD2+Px0jKk4gwgfqCVsy1sgIT9bcFDz8qgkJ6UvNb+ 5H2OWMXeIIP4OQ5q6S+GbIxvgBsyv9wIhJMAXB5LYpLQEXcsuHHoIb3bq/xUA4SZJcjG Tk4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726009060; x=1726613860; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=FoLNJ+7i1Iu9FrRrLK7c5RIjKg0qAb79YRUumxN78pQ=; b=m+KQRO0FIL08DESxMOX8FhQuBhdaHstX/olTRlWL65sCzZfnjferEwyY+0U9N+qBJT O8JMlWZ7hJTudzlwC7I2/Xd7kvwWI8lmUIHAxlKhazvinU2jL9JHoHFerDNJLepLCLEl 63mbpiFWrJdetU8YJIFco+W89mnaNYNL9Yv0Ha+GBTU6pkSX2Voa+NDX9jd+yjhK78D3 0Aq/c2uuhmKPzL9PjQkkFXxDgewpQ8Y7fqiZpKyTMEH7FDDEQz1s+a+NT5y4v5t7F7HB lphyKcSTwxI0oBvATGU+6wQF+2pHxMKIQrJR/s7wvs8IV/1tMfmQxYi7MmP+FkomS+f0 lg6A== X-Forwarded-Encrypted: i=1; AJvYcCXZKYU0yJbmhDNlldxsQUw4L5aA715X6Iq1WLDj9q6UoE4Ir24aFreod4p39pW6l8QFn/SEAKxXX7YR+hBJ@postgresql.org X-Gm-Message-State: AOJu0Yxy+4BRyJGCUlm/a+z0Rm/y3Whdc986rIyzhS4RbR8ia4GqyJP7 j0f456SfMXdwyOFCefcaidmlVlmTJvLNHmccVNMRkaguOiLYDljej8P0m8oIpeo= X-Google-Smtp-Source: AGHT+IGR33jk2GeqNltFDA6jYFUUN/2TPyie1cNAznDh56JoNU4V+aI/adrBWo3aUq7p3m0YzvlNEA== X-Received: by 2002:a17:906:f586:b0:a8d:2d2e:90e6 with SMTP id a640c23a62f3a-a8ffae14002mr187758166b.60.1726009059410; Tue, 10 Sep 2024 15:57:39 -0700 (PDT) Received: from [10.93.0.121] (p50992f7c.dip0.t-ipconnect.de. [80.153.47.124]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25835551sm537906266b.24.2024.09.10.15.57.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 15:57:39 -0700 (PDT) Message-ID: Subject: Re: Overlapping values (?) in multi-column partitioned tables From: Laurenz Albe To: Christophe Pettus , pgsql-general Date: Wed, 11 Sep 2024 00:57:38 +0200 In-Reply-To: <2FAC43EB-7E04-476A-BEBE-39CDBCA0EDCC@thebuild.com> References: <2FAC43EB-7E04-476A-BEBE-39CDBCA0EDCC@thebuild.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.4 (3.52.4-1.fc40) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 2024-09-10 at 15:13 -0700, Christophe Pettus wrote: > I am clearly not understanding something.=C2=A0 Consider: >=20 > > xof=3D# create table t (pk bigint not null, ts timestamp not null) part= ition by range (ts, pk); > > CREATE TABLE > > xof=3D# create table t1 partition of t for values from ('2024-01-01'::t= imestamp, minvalue) to ('2024-02-01'::timestamp, maxvalue); > > CREATE TABLE > > xof=3D# create table t2 partition of t for values from ('2024-02-01'::t= imestamp, minvalue) to ('2024-03-01'::timestamp, maxvalue); > > ERROR:=C2=A0 partition "t2" would overlap partition "t1" > > LINE 1: ...on of t for values from ('2024-02-01'::timestamp, minvalue) = ... > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ^ > > xof=3D#=20 >=20 > In what way do those partitions overlap? In this way: SELECT ROW('2024-02-01'::timestamp, '9223372036854775807'::bigint) <=3D ROW('2024-02-01'::timestamp, '-9223372036854775808'::bigint); ?column?=20 =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90 f (1 row) So the upper limit of the first partition is strictly bigger than the lower= end of the second partition. "record" types have the same lexicographical sorting order as ORDER BY clau= ses. Perhaps your confusion is that you expect the first partition to only go up= to and including ('2023-12-31 23:59:59.999999', 9223372036854775806), but that= 's not the case. The biggest value you can store in the first partition is ('2024-02-01 00:00:00', 9223372036854775806). You should specify the upper bound as ('2023-12-31 23:59:59.999999', MAXVAL= UE). Yours, Laurenz Albe