Re: How to migrate column type from uuid to serial

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: How to migrate column type from uuid to serial
Дата
Msg-id 987d062d-dfcc-6954-f7b2-b895fcbd3783@gmx.net
обсуждение исходный текст
Ответ на Re: How to migrate column type from uuid to serial  (Hemil Ruparel <hemilruparel2002@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: Handling time series data with PostgreSQL
Следующее
От: Hemil Ruparel
Дата:
Сообщение: Re: How to migrate column type from uuid to serial