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

Gambhir Singh <gambhir.singh05@gmail.com>

From: Gambhir Singh <gambhir.singh05@gmail.com>
To: Pgsql-admin <pgsql-admin@lists.postgresql.org>, pgsql-general@lists.postgresql.org
Date: 2026-05-11T12:31:05Z
Lists: pgsql-general
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.


   - 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