Re: How to migrate column type from uuid to serial

From: Hemil Ruparel <hemilruparel2002(at)gmail(dot)com>
To: Thomas Kellerer <shammat(at)gmx(dot)net>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: How to migrate column type from uuid to serial
Date: 2020-10-07 14:53:58
Message-ID: CANW1aT8N1KeyjK2dR_01hZookOTxP9=AP4rZR0AaEK7QRXeKRA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is it because they are hex characters and hence only need 4 bit to store
per character but we display each of those 4 bits as a character as a hex
value (0 to 9 and a-f) all of which in ASCII and UTF-8 require a byte to
represent? Hence the length of 32 (or 36 with dashes)?

On Wed, Oct 7, 2020 at 8:10 PM Hemil Ruparel <hemilruparel2002(at)gmail(dot)com>
wrote:

> Sorry if this is silly but if it is a 128 bit number, why do we need 32
> characters to represent it? Isn't 8 bits one byte?
>
> On Wed, Oct 7, 2020 at 8:08 PM Thomas Kellerer <shammat(at)gmx(dot)net> wrote:
>
>> Hemil Ruparel schrieb am 07.10.2020 um 16:21:
>> > it is declared as uuid. But how does it occupy only 16 bytes?
>>
>> Because a UUID is internally simply a 128bit number - the dashes you see
>> are just formatting.
>>
>> But if you can only send the text represnation, then yes 32 characters
>> aren't enough.
>>
>>
>>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2020-10-07 15:18:07 Re: What version specification used by PG community developers?
Previous Message Thomas Kellerer 2020-10-07 14:50:07 Re: How to migrate column type from uuid to serial