pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Hemil Ruparel <hemilruparel2002@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: How to migrate column type from uuid to serial
Date: Wed, 7 Oct 2020 06:57:13 -0700
Message-ID: <e06aab47-151c-ea50-36bf-a34d68337f22@aklaver.com> (raw)
In-Reply-To: <CANW1aT8fpZqpr6WcN1oj8-0PWjsgorPMEUQguUpO00E=bXYG2A@mail.gmail.com>
References: <CANW1aT8fpZqpr6WcN1oj8-0PWjsgorPMEUQguUpO00E=bXYG2A@mail.gmail.com>

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





view thread (16+ messages)  latest in thread

Message-ID: <e06aab47-151c-ea50-36bf-a34d68337f22@aklaver.com>
Permalink:  ../e06aab47-151c-ea50-36bf-a34d68337f22@aklaver.com/
Also on:    postgresql.org/message-id/e06aab47-151c-ea50-36bf-a34d68337f22@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, hemilruparel2002@gmail.com
  Subject: Re: How to migrate column type from uuid to serial
  In-Reply-To: <e06aab47-151c-ea50-36bf-a34d68337f22@aklaver.com>
  References: <CANW1aT8fpZqpr6WcN1oj8-0PWjsgorPMEUQguUpO00E=bXYG2A@mail.gmail.com> <e06aab47-151c-ea50-36bf-a34d68337f22@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox