Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kQ9yu-0000Hi-Ab for pgsql-general@arkaria.postgresql.org; Wed, 07 Oct 2020 13:59:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kQ9ys-0007jf-M8 for pgsql-general@arkaria.postgresql.org; Wed, 07 Oct 2020 13:59:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kQ9ys-0007jY-EM for pgsql-general@lists.postgresql.org; Wed, 07 Oct 2020 13:59:46 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kQ9yq-0003Cu-AL for pgsql-general@postgresql.org; Wed, 07 Oct 2020 13:59:46 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 032CCAD4; Wed, 7 Oct 2020 09:59:41 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 07 Oct 2020 09:59:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=x b96LsG25EAU26pXJ2mtCCYj6ju8IbXIuSlUZGGv+Zo=; b=TCy9rMtPdIRXsvCH6 wiKYNm7U6M59TxCySySWobnYehbTm141TGVV1paI0JpI+hyeviE0LTGRb65rFfKP Mv/4Ay1Hxhjz7ZHPd7VcD6mNvkcUVfC1I6Gnmf1rVQUgf5V5r6f48Z1Hen+nbyLr qpeP0baQ1oQdi51WohOzd9XpdQyzS8iomqmsgmbxNz9He8WhzjfmSVm4IyhOflp0 rFIpNnjX/FWKtxzpsTl/bIN7ai7Yg51+Wcq8sSkp/UMgRqNCu0tM5cWwhO9653wU Zp2yFGHr0f3hSq92l8B2oBnKHxb5pzXZgfjLING3smI7Ru7tOjLQJyFsrvgL9tbe lyuPg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=xb96LsG25EAU26pXJ2mtCCYj6ju8IbXIuSlUZGGv+ Zo=; b=q+iHEoSHTN4qTtg0JeeeEIdLKUTFH4E+qqy533i0F2llihT3UCYX7LZaH BQ5XwHDER7OVdcZU+vQJaMiWHEZYo7I7vWR72CFwN3g2p1LIWm7pYRMsQDSTpBnc Rgu3hjnUYSXJqXFYbf3tloDY5R/HsKuLMCtdfbRCRj3mFanU8xLrgrF6sLySQEfr J8p6CXIlBTNSQWfsDC/rbT/ra2DMqp6m9ysDrxSSFcXmyMQLO5OkzYKL2hipNFo0 tP4531VlLWl+DIGy/dL/yU7N42TG9WRuE7AmlFH8BZ+dcsbwhuKc517R5cW5xc8C MjNS0VI+hil1Rzb7L8U51tunspPng== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrgeeigdejvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhffkffgfgggjtgfgsehtjeertddtfeejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecuggftrfgrthhtvghrnhepteejvdetffejuedvleeifeefheeutdfhgfdvhffhhfek vdduveegvdejudefgfevnecukfhppeejhedrudejvddrhedrvdefudenucevlhhushhtvg hrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghv vghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Received: from [192.168.1.3] (75-172-5-231.tukw.qwest.net [75.172.5.231]) by mail.messagingengine.com (Postfix) with ESMTPA id DB72A306467D; Wed, 7 Oct 2020 09:59:40 -0400 (EDT) Subject: Re: How to migrate column type from uuid to serial To: Hemil Ruparel References: Cc: pgsql-general From: Adrian Klaver Message-ID: <14155fce-965e-ae6b-256b-51df8e17e6e6@aklaver.com> Date: Wed, 7 Oct 2020 06:59:40 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 10/7/20 6:58 AM, Hemil Ruparel wrote: Please reply to list also. Ccing list > Yes. The id is stored as uuid. Thanks for the suggestion. Should work > > > On Wed, Oct 7, 2020 at 7:27 PM Adrian Klaver > wrote: > > On 10/7/20 5:48 AM, Hemil Ruparel wrote: > > I was integrating a payment gateway for my app when I noticed its > > maximum length of customer id string is 32. SIze of UUID is 36 (32 > > characters and 4 dashes). So I want to change the type of > customer id to > > serial. The problem is by now, the column is being used at many > places. > > How to migrate the column to serial without dropping the data? > > Changing the size of the column is not an option? > > Your description of the customer id column above is somewhat confusing > to me. Is the id actually stored as a UUID? > > Why is the max length an issue? > > If you where to migrate I would say create an independent > serial/identity column. Then point the dependent objects at that. After > all have been converted drop the old column. > > > > > > -- > Adrian Klaver > adrian.klaver@aklaver.com > -- Adrian Klaver adrian.klaver@aklaver.com