Re: alter the datatype of Partition Key

From: akshay polji <akshay(dot)polji(at)gmail(dot)com>
To: Gambhir Singh <gambhir(dot)singh05(at)gmail(dot)com>
Cc: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: alter the datatype of Partition Key
Date: 2025-06-19 07:01:51
Message-ID: CAHecRemysNd-X8hrv_jEJ4OPMB6G2SwVV7dDZcmYbze4rmCXRQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

The cleanest way to do this would be to create a new table with varchar
datatype for the partition key along with the partitions and then move the
data partition-by-partition.
The rollback would be super easy as well in case some issues arise in
applications due to change of datatype.

Regards,
Akshay

On Mon, Jun 16, 2025 at 6:47 PM Gambhir Singh <gambhir(dot)singh05(at)gmail(dot)com>
wrote:

> Please help me on this
>
> Thanks & Regards
> Gambhir Singh
>
>
>
> On Mon, 16 Jun 2025 at 12:45, Gambhir Singh <gambhir(dot)singh05(at)gmail(dot)com>
> wrote:
>
>> Hi,
>>
>> We have a partition table with partitioning type range and got the
>> requirement from the application team to alter the datatype of partitioning
>> key from bigint to varchar. Please suggest to me the way how this can be
>> achieved.
>>
>> Data volume is quite huge in the table. ~50 Billion rows
>>
>> --
>> Thanks & Regards
>> Gambhir Singh
>>
>>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Scott Ribe 2025-06-19 17:23:58 update behavior
Previous Message Gaspare Boscarino, P.Eng. 2025-06-16 18:30:58 Re: Upgrade from 12.22 to 16