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.96) (envelope-from ) id 1wNcPP-000wXh-1w for pgsql-general@arkaria.postgresql.org; Thu, 14 May 2026 20:11:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wNcPO-00Exzw-1j for pgsql-general@arkaria.postgresql.org; Thu, 14 May 2026 20:11:50 +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.96) (envelope-from ) id 1wNcPN-00Exzn-2E for pgsql-general@lists.postgresql.org; Thu, 14 May 2026 20:11:50 +0000 Received: from fout-a8-smtp.messagingengine.com ([103.168.172.151]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wNcPL-00000000apE-3ApC for pgsql-general@postgresql.org; Thu, 14 May 2026 20:11:48 +0000 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.phl.internal (Postfix) with ESMTP id C56A7EC01C4; Thu, 14 May 2026 16:11:46 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Thu, 14 May 2026 16:11:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1778789506; x=1778875906; bh=5m5nNC6YFO7O/4T5R2Zk/W0xwfogVHM646hneSBeDqY=; b= GacfmiwO/M8wZ9QkMvGw9mACIvHxcciFfDh41967lOS9gg5DhOTaFkLAFzafwM1T kUA+aVvfBperMLe6rv48g+DiXqpppqql+FBxqXZxp4qnYV8LZAbJzFSMvfAfbUB4 cZZPEwhVAFGgxdQKFumuFSHJQNEdqspsQ0sRFt2A1RN5ZWz+VHpaZ9aCvR4EnLgE cc8DUa5V05e1JnUkfS+xiNgal+5+tZELtvqAIwKhqySU6WeG7xu6ASkZ7bNu14dl BXBEFA3Z1v5MVfwv7qQXKDMkaOVWisYFS9EJ4sqoQWd0BWVL7Aom6BUxIO1RppBr UWJnN5zytH06jHq6RSv/DQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1778789506; x= 1778875906; bh=5m5nNC6YFO7O/4T5R2Zk/W0xwfogVHM646hneSBeDqY=; b=J AIn2LL21/IIB5lxjHx/rGx/VTSYtW9UEnToeWHSO4u/m4DgnWIPtJIonDZ61zIYj Ri6uXuMKKRa4JCoG2Ai/0eY2ZrGr4a1DsTrgqPTUB/l5HBK6GwwJZXcBEc63cYZU c0dvII0GuddYErUbtvG6C4WuZnXt0f+ZBVkeuAe5acoPbKwvD+mVBqB8IEccvDwi TMVC6gZooLccnELzD6BpKBzYjiF62FIZG6H9JH3FXwEHkdwvVzPmztPBcv5vgIul q40gMtTFbQLG16JoS3PFrtRFPC4aEyqsm3KFVZ7HA7rd5bYxObin77s21dei58He nlLyDjpPIFqBUwXxM1qlQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdduvdekgeehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepkfffgggfuffvfhevhfgjtgfgsehtjeertddtvdejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecuggftrfgrthhtvghrnhepheeikefgiefhtdekheeiteevheeltdfhtdejheegffef tdeikeejiedutdffvdetnecuffhomhgrihhnpehpohhsthhgrhgvshhqlhdrohhrghenuc evlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgr nhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmpdhnsggprhgtphhtthhopedvpdhmoh guvgepshhmthhpohhuthdprhgtphhtthhopehgrghmsghhihhrrdhsihhnghhhtdehsehg mhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqghgvnhgvrhgrlhesphhoshhtgh hrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 14 May 2026 16:11:46 -0400 (EDT) Message-ID: Date: Thu, 14 May 2026 13:11:45 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Alter the datatype on all tables present in the database (bigint to varchar) To: Gambhir Singh References: Content-Language: en-US Cc: pgsql-general From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 5/14/26 11:34 AM, Gambhir Singh wrote: Please reply to list also. Ccing list > Hi Adrian, > > I've received this requirement from the application team. My main > concern is the partitioned tables. I would think there would be a least some rationale for doing this, if for no other reason then to determine whether this is the best solution. From here: https://www.postgresql.org/docs/17/sql-altertable.html "Adding a column with a volatile DEFAULT or changing the type of an existing column will require the entire table and its indexes to be rewritten. As an exception, when changing the type of an existing column, if the USING clause does not change the column contents and the old type is either binary coercible to the new type or an unconstrained domain over the new type, a table rewrite is not needed. However, indexes must always be rebuilt unless the system can verify that the new index would be logically equivalent to the existing one. For example, if the collation for a column has been changed, an index rebuild is always required because the new sort order might be different. However, in the absence of a collation change, a column can be changed from text to varchar (or vice versa) without rebuilding the indexes because these data types sort identically. Table and/or index rebuilds may take a significant amount of time for a large table; and will temporarily require as much as double the disk space." You also mentioned FKs, do these involve the columns being changed? > > Thanks & Regards > Gambhir Singh > -- Adrian Klaver adrian.klaver@aklaver.com