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

From: Gambhir Singh <gambhir(dot)singh05(at)gmail(dot)com>
To: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Alter the datatype on all tables present in the database (bigint to varchar)
Date: 2026-05-11 12:31:05
Message-ID: CAHOGQfVo0FWX8mS9FLTmpDOb5XC5-T4qx4ouhw0wOfNeLdahsA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin 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

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Gabriel Guillem Barceló Soteras 2026-05-12 06:24:46 PostgreSQL Repos and archiving
Previous Message Raj 2026-05-07 17:28:54 Re: Load test

Browse pgsql-general by date

  From Date Subject
Next Message Frank Lanitz 2026-05-12 05:40:44 Re: Tablespace size in TB
Previous Message Ron Johnson 2026-05-10 02:51:15 Re: fdw: foreign partition and aggregate function