Re: Getting specific partition from the partition name

From: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Getting specific partition from the partition name
Date: 2024-08-09 04:20:04
Message-ID: CANzqJaCs9ZBQvHsu3AhpdoQpry7qTg8KU2JNE-XyFZfO3cq3tg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Aug 8, 2024 at 4:46 PM Greg Sabino Mullane <htamfids(at)gmail(dot)com>
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...

--
Death to America, and butter sauce.
Iraq lobster!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message 王瞿 2024-08-09 09:18:21 searching for libpq5-14.1-42PGDG.rhel8.x86_64
Previous Message Christophe Pettus 2024-08-09 04:17:51 Re: Vacuum full connection exhaustion