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 1scH72-005YRC-O5 for pgsql-general@arkaria.postgresql.org; Fri, 09 Aug 2024 04:20:24 +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 1scH71-0012Yk-6D for pgsql-general@arkaria.postgresql.org; Fri, 09 Aug 2024 04:20:23 +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 1scH70-0012Yc-Rx for pgsql-general@lists.postgresql.org; Fri, 09 Aug 2024 04:20:22 +0000 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1scH6u-003oeG-HZ for pgsql-general@lists.postgresql.org; Fri, 09 Aug 2024 04:20:21 +0000 Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3d9e13ef8edso1224526b6e.2 for ; Thu, 08 Aug 2024 21:20:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723177216; x=1723782016; darn=lists.postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=fAjDiYXP7Y8Dr1sWqkDa+Nuyh/lKsO56H7hS4tWZlmI=; b=SzoU+GXuz+3YkO0Sj+blQs9VdmVpdciwTZGNl/EeNSFMIN35gWllFx9okRUIVbw4P/ LiL6StfmTas7UJI0vJSYykJFACxGi7e6G6wyRQOxObdDQSBz8JKAXvw+8slO0+Fc9hKZ 5q6m0t2qhCmN9dYl9ghj5pKig9lXJdVc+ds5loMhSgMphZ6CAUGpAivi0P+VPV5Pw48W W2JjRhPGK+fwRFM/k+mbVYxcQF9Anl2NNajjrM4Kj54BQ/0Rqs5mXPn4m7KhlmPPhowZ 6XJbjGtgWHpRVbHYhdz2L7TzByi+PLMTQm5m9wHD5jyNsrGypyG536sqTGZwTqkjSjyP l76g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723177216; x=1723782016; h=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=fAjDiYXP7Y8Dr1sWqkDa+Nuyh/lKsO56H7hS4tWZlmI=; b=mHeEw/RieC+RKDA0uJ6Ja0KEQhnavI3J4EqzbVknAWFO0WvKLU5rL4Ws5zpm8Z4gdX tW0WJLmG48GJ3RxfBsbf67preUQbMsM7idNafm8gfHsWd7SBJD4Cevn7AIFBlXthT5KU NdQn4u4dhIKeC7xgOgex/QgoxsSYYmnE1125kD5sVs/B6syW91dSgEcGowVpRIAobLme vVSOcMhH+QkazF0gEhmGxiGeEkwhR6sp/NxyONzWOxX6/Dun3EFOEgNpBIe1ysmCcfyX 9GSnyockn1zBlG+EZwmDhHlm4qpCYJOVl0yPeeVpCOa9N9tptsAd8hAxKjygo3C0UBkx FTwg== X-Gm-Message-State: AOJu0Yx8gSzjaUNNjQjvqVCVpfI+CIybqZIFODGGDlHQcg0epY6Anhgi o3p923obxxEXMi4Juei6twNIM5ymrWKXLKljke/aWF5z2kE9kSFuj8wEnzGhKI4fGyJJrK/5/l8 SIIS7gtAlFeglQlIc0D2L+zaPuMYrYQ== X-Google-Smtp-Source: AGHT+IFfQITrk30ctUQqfEQzjxKzQ22OLS+HlDjiCntUBjF+6x6XM3OmXnFTlQh+bWk+wersKbGUeZaqwIomyAzGqN4= X-Received: by 2002:a05:6808:1383:b0:3da:9f65:ff3a with SMTP id 5614622812f47-3dc416da67dmr312704b6e.39.1723177215644; Thu, 08 Aug 2024 21:20:15 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ron Johnson Date: Fri, 9 Aug 2024 00:20:04 -0400 Message-ID: Subject: Re: Getting specific partition from the partition name To: pgsql-general Content-Type: multipart/alternative; boundary="000000000000d2dd45061f387500" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000d2dd45061f387500 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Aug 8, 2024 at 4:46=E2=80=AFPM Greg Sabino Mullane wrote: > YYYY_MM_DD is already setup for sorting, so just do: > > SELECT table_name FROM information_schema.tables WHERE table_name ~ > 'table_part_p' ORDER BY 1 DESC; > > If you need to grab the numbers: > > SELECT substring('table_part_p2022_03_04' from '([\d_]+)$'); > What if the partitions aren't all rationally named? There *must* be a pg_* table out there which contains the partition boundaries... --=20 Death to America, and butter sauce. Iraq lobster! --000000000000d2dd45061f387500 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Aug 8, 2024 at 4:46=E2=80=AFPM Gr= eg Sabino Mullane <htamfids@gmail.= com> wrote:
YYYY_MM_DD is already setup = for sorting, so just do:

SELECT table_name FROM informat= ion_schema.tables WHERE table_name ~ 'table_part_p' ORDER BY 1 DESC= ;

If you need to grab the numbers:
<= br>
SELECT substring('table_part_p2022_03_04' from '(= [\d_]+)$');

What if the partitions aren't all rationally named?=C2=A0 There <= i>must=C2=A0be a pg_* table out there which contains the partition boun= daries...

--
Death t= o America, and butter sauce.
Iraq lobster!
--000000000000d2dd45061f387500--