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 1sc9Bv-004MOv-Dh for pgsql-general@arkaria.postgresql.org; Thu, 08 Aug 2024 19:52:55 +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 1sc9Bu-00GiNw-1G for pgsql-general@arkaria.postgresql.org; Thu, 08 Aug 2024 19:52:54 +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 1sc9Bt-00GiNn-Lt for pgsql-general@lists.postgresql.org; Thu, 08 Aug 2024 19:52:53 +0000 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sc9Br-003lGJ-7Z for pgsql-general@lists.postgresql.org; Thu, 08 Aug 2024 19:52:52 +0000 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a728f74c23dso154025366b.1 for ; Thu, 08 Aug 2024 12:52:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723146769; x=1723751569; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=MbFbf3L7DwEUwEkQmHeHY0IMa+DQurOmW082iwULih8=; b=BdfC1c5zgjcFRcuZy55LaAq8q0X1DLHE88NXyYnjhnzkgzSSpd7L/Zs1NlohIZQNhU gjvW5ruwRTtUYWtG44JKN33RJuZvzJHodyjfoF68PdP08cONezkLroA9PweePz1SkU/n KeKF3ACDMqWgoGLS0/eUl6+9AXJ3ye2+UbkBmR+v+9mpXy14/CFPQB00SCwQPHcYFNHY ceoO7gs7BDADlYyC/4zz1P5CVVLzT9P+k20jH/ihcqFoGzJZ/JZiUfD/TiDJQC0BnUNq URQ3AJZt+YN3nRC+sr1Us4djRwS+osZ/kEffKAo/vsteVU4bz+XD57J/woNTa3E7a2ml RDFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723146769; x=1723751569; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=MbFbf3L7DwEUwEkQmHeHY0IMa+DQurOmW082iwULih8=; b=gxtEfzS9BT4+2dvP04HBcdFBBv392DeCL+ncDN5jfPHBJRhg5XTwrCh23oDYVjuJAB kv7owQdmcKl/1sf9ngH5vfd9/JrxhpFUq7CuZakR1oZIEoSUEvyPA0GB+AChDl+kZ/7Y lLdAlFY5ES4YxDh41LwfBbNRYMUeOxLG849cNOTHVsPmYeZYul0b/ae1dT5ToRqfiMck 9iJeDfWZpCF8K3M/lNE6M2/DJ1RgiMq7cqzztHVoNxA6h2EtF84FrYXogGu8LsOWgC9R l9twTErSB3IBWj4FjgnGpWFOJzvCphSbs9SLAxX+0v8h77JWMFK6AOfK5NeIC/W0L95e Z3XQ== X-Gm-Message-State: AOJu0YxIaKsDlw/fRLDKEJ7MIZWYHePp3Oxjy8osjNAJ5td3h69nXufv a3HiND0caAeJt8MlgmalyHVHS0hfrDSlpLi7fu+5YqAxjueXdxydvOYOtAAZRBdmxP0JbJ3K5Hr 5RZww4LfjDEvAzcuoD6VXdxY3sCjHfQto X-Google-Smtp-Source: AGHT+IEidkUpLefYyfBQBlF2Q/vmNvAABQ45t9gbedUgYJV3DVD7K/6ZATO6EbtYSuB4E67C6l//x/2jv27n6gErJTA= X-Received: by 2002:a17:906:d267:b0:a7a:929f:c0ce with SMTP id a640c23a62f3a-a8090c68adcmr202942166b.19.1723146769180; Thu, 08 Aug 2024 12:52:49 -0700 (PDT) MIME-Version: 1.0 From: veem v Date: Fri, 9 Aug 2024 01:22:36 +0530 Message-ID: Subject: Getting specific partition from the partition name To: pgsql-general Content-Type: multipart/alternative; boundary="00000000000012acca061f315f0a" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000012acca061f315f0a Content-Type: text/plain; charset="UTF-8" Hi , We are using postgres version 15.4. We have a range partition table and the partition naming convention is generated by pg_partman and is something like "table_name>_pYYYY_MM_DD". We have a requirement of extracting specific partitions ordered by the date criteria and also do some operations on that specific date. But I am struggling and it's not working as expected.I tried something as below but it's not working.Can somebody guide me here please. to_date( substring('table_part_p2024_08_08' from '_p(\d{4})_(\d{2})_(\d{2})'), 'YYYY_MM_DD' ) < current_date or is there any ready-made data dictionary which will give us the order of the partitions by the date and we can get hold of the specific nth partition in that table? Regards Veem --00000000000012acca061f315f0a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi ,
We are using=C2=A0postgres version 15.4. We h= ave a range partition table and the partition naming convention is generate= d by pg_partman and is something like "table_name>_pYYYY_MM_DD"= ;.

We have a requirement=C2=A0of extracting specif= ic partitions ordered by the date criteria and also do some operations on t= hat specific date. But I am struggling and it's not working as expected= .I tried something as below but it's not working.Can somebody guide me = here please.

=C2=A0to_date(=C2=A0substring('ta= ble_part_p2024_08_08' from '_p(\d{4})_(\d{2})_(\d{2})'),=C2=A0 = =C2=A0 =C2=A0 'YYYY_MM_DD'
=C2=A0 =C2=A0 ) < curre= nt_date

or is there any ready-made=C2=A0d= ata dictionary which will give us the order of the partitions by the date a= nd we can get hold of the specific=C2=A0nth partition in that table?
<= /div>

Regards
Veem
--00000000000012acca061f315f0a--