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 1scNiQ-006kdI-2p for pgsql-general@arkaria.postgresql.org; Fri, 09 Aug 2024 11:23:26 +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 1scNiO-002poc-O4 for pgsql-general@arkaria.postgresql.org; Fri, 09 Aug 2024 11:23:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1scNiO-002poT-Cf for pgsql-general@lists.postgresql.org; Fri, 09 Aug 2024 11:23:24 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1scNiM-003xdo-0D for pgsql-general@lists.postgresql.org; Fri, 09 Aug 2024 11:23:23 +0000 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a7a975fb47eso232136266b.3 for ; Fri, 09 Aug 2024 04:23:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723202601; x=1723807401; 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=sSh6KnTkwZeMUtpt67f4iyNKOEQF7erW1X6AauXPli8=; b=hPDObtH1X/pDa/Sd59iGzrHd9bo/R6s7gPLWpp/9t6LSi9B3bVeglzFZ2aKBBy+EG+ /35GDLXJS0iW2522Kj4OS0y9rR1Q/HKqe/dNbOvcUse9smcfGemrrEbmx4Xj9edSBzDZ 3mgwTYdL8/pncxLZKFv2dCWqguUdGGFM8OtVl9B2V8DgkhQCi52k3Cc20bVfSr70IR+E cU2ff6QbpgK2rg4YJbjTVtBWt9Q/Hp0YJ6awffbWutkKo5eBlvcGNue8x4pnWuqtjVZw ZltYpv/7wDONw6r4NDy1XTUzmwYZ7irLxVH/N9g3iOBUV0svhuXyoVlWofnQRGiU/zHr 0qTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723202601; x=1723807401; 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=sSh6KnTkwZeMUtpt67f4iyNKOEQF7erW1X6AauXPli8=; b=gbI0Dm1YbaC1d/ZEQsFIzhNp8qQb8UV6LduqCiYrYpxUnZt5nX0iYU4NNjuTbZ/Dck c5j9vNpf9bjUDH02Kreg9FMmbp/9N7mtvzlcse6U2fo0Yn/IM4TP6dYQyvkKy0eL/JRa PrFCi8ZRL6mIbQK0hTkqZsos1crucsjelyVYyvjDjLAFVtp7GP5gosTEHJQg01ACTWL3 +c+QqCxj9dP/aLyDvk4VNOjWFLugHI8c/wL/2cfu5r1RJdXpX2k1E+Rq+hwrLkp3M5vZ vqxXDBWjoHGzLlcR3kEiZF0Dg9npqrduVt7G9IktvtxlSI8JdAQHAeVBHcY1OaelksrJ cpNA== X-Gm-Message-State: AOJu0YyhTB6MIdom7AHgzkEMsPr4WIX8o8D4aN2Kcnw+Ej5PmETvKRvW 7Rrz76fXctlClNqbmvDQe5i8UUp373Qs8dPB1fCHHZ7oOoJIIbf/S4QxH4TNBKoBVevMB4HOFzc gz28CU3o/4Bh/CKiA6T6Rlpd58QgOMw== X-Google-Smtp-Source: AGHT+IExWbWa8ATRMD8dfk9/NvFPoztNunuvLmneDuM/kTreedm8d33GsyPCtIQLjL6fpOCCTqcGuDROxcCYYCJp6cs= X-Received: by 2002:a17:907:e6c1:b0:a7a:929f:c0ce with SMTP id a640c23a62f3a-a80aa5993b4mr102348566b.19.1723202600564; Fri, 09 Aug 2024 04:23:20 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: veem v Date: Fri, 9 Aug 2024 16:53:09 +0530 Message-ID: Subject: Re: Getting specific partition from the partition name To: Greg Sabino Mullane Cc: pgsql-general Content-Type: multipart/alternative; boundary="000000000000e22ae9061f3e5ec2" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000e22ae9061f3e5ec2 Content-Type: text/plain; charset="UTF-8" This helps. Thank you very much. On Fri, 9 Aug 2024 at 02:15, 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_]+)$'); > > Cheers, > Greg > > --000000000000e22ae9061f3e5ec2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
This helps. Thank you very much.

On Fri, 9 Aug 2024 at 02:1= 5, Greg Sabino Mullane <htamfids@g= mail.com> wrote:
YYYY_MM_DD is already setup for sorting, so just d= o:

SELECT table_name FROM information_schema.tables WHER= E table_name ~ 'table_part_p' ORDER BY 1 DESC;

If you need to grab the numbers:

SELECT s= ubstring('table_part_p2022_03_04' from '([\d_]+)$');

Cheers,
Greg

--000000000000e22ae9061f3e5ec2--