Re: How to migrate column type from uuid to serial - Mailing list pgsql-general

From Thomas Kellerer
Subject Re: How to migrate column type from uuid to serial
Date
Msg-id 987d062d-dfcc-6954-f7b2-b895fcbd3783@gmx.net
Whole thread Raw
In response to Re: How to migrate column type from uuid to serial  (Hemil Ruparel <hemilruparel2002@gmail.com>)
List pgsql-general
>>> 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.

> Sorry if this is silly but if it is a 128 bit number, why do we need 32 characters to represent it?

The 36 (or 32 without the dashes) characters are just the default hex representation.

If you wanted to, you could convert it to a bigint (or a numeric).

See e.g. here for an example: https://stackoverflow.com/a/27286610




pgsql-general by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Handling time series data with PostgreSQL
Next
From: Hemil Ruparel
Date:
Subject: Re: How to migrate column type from uuid to serial