Re: How to migrate column type from uuid to serial

2020-10-10 Thread Hemil Ruparel
oh. I get it now. Thanks On Sat, Oct 10, 2020 at 3:41 PM Peter J. Holzer wrote: > On 2020-10-10 11:31:23 +0200, Peter J. Holzer wrote: > > On 2020-10-07 20:10:34 +0530, Hemil Ruparel wrote: > > > Sorry if this is silly but if it is a 128 bit number, why do we need 32 > > > characters to

Re: How to migrate column type from uuid to serial

2020-10-10 Thread Peter J. Holzer
On 2020-10-10 11:31:23 +0200, Peter J. Holzer wrote: > On 2020-10-07 20:10:34 +0530, Hemil Ruparel 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? > > Yes, 8 bits are 1 byte. But that's 256 different values,

Re: How to migrate column type from uuid to serial

2020-10-10 Thread Peter J. Holzer
On 2020-10-07 20:10:34 +0530, Hemil Ruparel 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? Yes, 8 bits are 1 byte. But that's 256 different values, so to display them in 1 character you would need 256 different

Re: How to migrate column type from uuid to serial

2020-10-08 Thread Francisco Olarte
On Thu, Oct 8, 2020 at 6:14 AM Hemil Ruparel wrote: > I was thinking UUID was not a very good choice for id. Serial would be a > better one because I don't have a billion customers. It is more like a > thousand. So when I saw the customer ID of the payment gateway cannot accept > more than 32

Re: How to migrate column type from uuid to serial

2020-10-07 Thread Hemil Ruparel
I was thinking UUID was not a very good choice for id. Serial would be a better one because I don't have a billion customers. It is more like a thousand. So when I saw the customer ID of the payment gateway cannot accept more than 32 characters, I thought UUID is overkill. So I want to migrate to

Re: How to migrate column type from uuid to serial

2020-10-07 Thread Francisco Olarte
Hemil: On Wed, Oct 7, 2020 at 2:49 PM 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 >

Re: How to migrate column type from uuid to serial

2020-10-07 Thread Hemil Ruparel
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

Re: How to migrate column type from uuid to serial

2020-10-07 Thread Thomas Kellerer
>>> 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

Re: How to migrate column type from uuid to serial

2020-10-07 Thread Hemil Ruparel
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 wrote: > Hemil Ruparel schrieb am 07.10.2020 um 16:21: > > it is declared as uuid. But how does it occupy only 16 bytes? > >

Re: How to migrate column type from uuid to serial

2020-10-07 Thread Thomas Kellerer
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.

Re: How to migrate column type from uuid to serial

2020-10-07 Thread Hemil Ruparel
umm it is declared as uuid. But how does it occupy only 16 bytes? Even if we remove those 4 dashes thats 32 bytes of text right? I am not concerned about the size at all. How do i send it as a string below 32 bytes? On Wed, Oct 7, 2020 at 7:37 PM Thomas Kellerer wrote: > Hemil Ruparel schrieb

Re: How to migrate column type from uuid to serial

2020-10-07 Thread Thomas Kellerer
Hemil Ruparel schrieb am 07.10.2020 um 16:02: > Yes the id is stored as a uuid. Then it should be declared with the data type uuid, which only needs 16 bytes.

Re: How to migrate column type from uuid to serial

2020-10-07 Thread Hemil Ruparel
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 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 > > > >

Re: How to migrate column type from uuid to serial

2020-10-07 Thread Adrian Klaver
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 > wrote: On 10/7/20 5:48 AM, Hemil Ruparel wrote: > I

Re: How to migrate column type from uuid to serial

2020-10-07 Thread Adrian Klaver
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