Re: How to migrate column type from uuid to serial

From: Hemil Ruparel <hemilruparel2002(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: How to migrate column type from uuid to serial
Date: 2020-10-07 14:02:16
Message-ID: CANW1aT-ic-FFNcgsT6_uXn=SC8WXr6EJ=r2Eg7_bpMfHHApyDw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Yes the id is stored as a uuid. Thanks for the suggestion. Should work

On Wed, Oct 7, 2020 at 7:29 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:

> 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 <adrian(dot)klaver(at)aklaver(dot)com
> > <mailto:adrian(dot)klaver(at)aklaver(dot)com>> 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(dot)klaver(at)aklaver(dot)com <mailto:adrian(dot)klaver(at)aklaver(dot)com>
> >
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2020-10-07 14:06:53 Re: How to migrate column type from uuid to serial
Previous Message Adrian Klaver 2020-10-07 13:59:40 Re: How to migrate column type from uuid to serial