Re: Alter the datatype on all tables present in the database (bigint to varchar)

Adrian Klaver <adrian.klaver@aklaver.com>

From: Adrian Klaver <adrian.klaver@aklaver.com>
To: pgsql-general@lists.postgresql.org
Date: 2026-05-14T17:00:28Z
Lists: pgsql-general
On 5/11/26 5:31 AM, Gambhir Singh wrote:
> Hi,
> 
> Please help me with the best way to change the datatype of a column in a 
> all tables in DB from bigint to varchar. Please consider the following 
> facts.

1) Do not cross post to multiple lists.

2) What is the purpose behind this change?

> 
>   * DB Size - 75 TB
>   * Number of tables - ~100
>   * Some tables are partitioned and some are not partitioned.
>   * All partitioned tables are big in size.
>   * For reference, the largest partition size is 4 TB, similarly the
>     size of 10-12 partitions ranges between 1 to 4 TB.
>   * We have indexes and FK on tables.
>   * Physical Replication is configured with 2 standby DBs. 
> 
> 
> -- 
> Thanks & Regards
> Gambhir Singh
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com