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 1scRe4-007LdS-9c for pgsql-general@arkaria.postgresql.org; Fri, 09 Aug 2024 15:35:12 +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 1scRe2-0047oe-Rs for pgsql-general@arkaria.postgresql.org; Fri, 09 Aug 2024 15:35:10 +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 1scRe2-0047oV-F2 for pgsql-general@lists.postgresql.org; Fri, 09 Aug 2024 15:35:10 +0000 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1scRdz-003uD7-Rp for pgsql-general@lists.postgresql.org; Fri, 09 Aug 2024 15:35:09 +0000 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-5314c6dbaa5so532380e87.2 for ; Fri, 09 Aug 2024 08:35:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723217706; x=1723822506; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=dKg5Oac6tuAfUSrjLcwT187WomBc3WQFaFT9CbeL/FM=; b=Y60fe5sx4XGiICDHxANoYT2yX64u8rZO4vtq/l4Cm2aOB7zumVCJaaN+WTx/Iob0kh T9gQpi2c5warqOTWGVj9O+CJrOA9un46k/MB0glu42bBAdwS5HgRPEDFHWWpddScIz0N KDpz20Fye7gXrybUUS4NymfDsADA5lmMAWyjhNnATkeItxIt/V/vCtgScu5BkmU8Vr9Z T+rVWygGTs1myYsuIVou85d/jscG85q7KQ0DgpE2BtNZ+3BAiu5ZE9DQbXPKCNUJdNRd 9fIwBo2zfSAGeeWVsYzE06LrN0dJAYwzLIo0X+kUBjVI2Rer18BMJqv2SGE0Pbj8RlWY e0VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723217706; x=1723822506; h=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=dKg5Oac6tuAfUSrjLcwT187WomBc3WQFaFT9CbeL/FM=; b=VetJ0NdTr3+NHnbXbv4H2Oo50UhsNDb6mXt6kgszcUhrBtbAQ555L2Nc2YBT7rVfYB 52I9xsKiiVOxQL2URq7ShKclqITGuwBmgALboPhLYO5C4lD3ig1Y7Ku3b4oTxvOe82HC 2eVeWkleD/qXkXiGl9zGE6SSqFCFPjwCeaHj40KBJDJaRmhobpXpgWkHT9wEL7TcGx0K kicuioZypRzei+63a0kKB1JxR78H2on9K+VWvQuxim7l6AunKvk9Gef/Oq0oaK2jB0XW th24yd5aEuQA4XQnCBAnIDzdXWqpbezKn+piyeNWmmvB8TCJ6WlmA5jmq0bRP5uLTnSh 4B+g== X-Gm-Message-State: AOJu0Yz24qJJ3uHmRr5oucWdcDV/NwRXyYOTyEGGfV1DgZ5NXy0yxQ0e +bl361PDlBKVWvOlb29/nGaFTwSB70XrHoPm5W9d4tnlcG+3jvP2vbypsiQtB2l5LmUX1qB/KyB bzr4TKJBjjIFqJYTZe+Xsphb7exI= X-Google-Smtp-Source: AGHT+IFq+Wy4epm6EaoNLDjj5oDfHP/JKwoRV4DKAsuOYblASo8IJjMaVKB8ai9Ou53zmHriPIdYfaoYzbrxBEmrJJ0= X-Received: by 2002:a05:6512:2203:b0:52c:e0e1:9ae3 with SMTP id 2adb3069b0e04-530eea146a9mr1467812e87.57.1723217705615; Fri, 09 Aug 2024 08:35:05 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: GF Date: Fri, 9 Aug 2024 17:34:54 +0200 Message-ID: Subject: Re: Getting specific partition from the partition name To: Ron Johnson Cc: pgsql-general Content-Type: multipart/alternative; boundary="00000000000036ccf4061f41e346" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000036ccf4061f41e346 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 9 Aug 2024 at 06:20, Ron Johnson wrote: > > What if the partitions aren't all rationally named? There *must* be a > pg_* table out there which contains the partition boundaries... > > The pg_class column relpartbound contains an internal representation of the partition boundary, when applicable. You can decompile it into the canonical text format with pg_get_expr( expr pg_node_tree, relation oid [, pretty boolean ] ) =E2=86=92 text. So: create table t(x int primary key) partition by list(x); create table u partition of t for values in (0,1); create table v partition of t for values in (2,3,4,5,6,7,8,9); select oid::regclass,pg_get_expr(relpartbound,oid) from pg_class where relkind=3D'r' and relispartition; oid | pg_get_expr -----+---------------------------------------- u | FOR VALUES IN (0, 1) v | FOR VALUES IN (2, 3, 4, 5, 6, 7, 8, 9) (2 rows) Best, Giovanni --00000000000036ccf4061f41e346 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable



--00000000000036ccf4061f41e346--