Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kRBDv-0003ZI-Az for pgsql-general@arkaria.postgresql.org; Sat, 10 Oct 2020 09:31:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kRBDu-00021i-8f for pgsql-general@arkaria.postgresql.org; Sat, 10 Oct 2020 09:31:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kRBDu-00021a-1N for pgsql-general@lists.postgresql.org; Sat, 10 Oct 2020 09:31:30 +0000 Received: from mail.hjp.at ([212.17.106.138] helo=rorschach.hjp.at) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kRBDr-0000LZ-J5 for pgsql-general@lists.postgresql.org; Sat, 10 Oct 2020 09:31:28 +0000 Received: by rorschach.hjp.at (Postfix, from userid 1000) id 8239A3AEF; Sat, 10 Oct 2020 11:31:23 +0200 (CEST) Date: Sat, 10 Oct 2020 11:31:23 +0200 From: "Peter J. Holzer" To: pgsql-general@lists.postgresql.org Subject: Re: How to migrate column type from uuid to serial Message-ID: <20201010093123.GC25239@hjp.at> References: <14155fce-965e-ae6b-256b-51df8e17e6e6@aklaver.com> <6fe03b17-f1ff-81e8-4ed1-72eb29d8d51d@gmx.net> <9ea3ff13-d78b-b5ce-2619-72cb02522e90@gmx.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="KDt/GgjP6HVcx58l" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --KDt/GgjP6HVcx58l Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 characters. That's not possible in ASCII (ASCII has only 94 graphic characters), and even if you included accented characters and other alphabets (like Greek or Cyrillic) it would be hard to read. So the decision was to display each byte as a pair of two hexadecimal digits (because 16 * 16 =3D 256). They could also have used 3 decimal digits (000 - 255) for each byte, but that would have wasted even more space, or they could have used base 32 or 64 for the whole number, but that would make conversion harder. hp --=20 _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" --KDt/GgjP6HVcx58l Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAl+Bf2sACgkQ8g5IURL+ KF0ueg/+MoqEvCvR6MppdxpcJQH/5taDmwpORmQi8tzAmbgC7X5b6MpbxLi87UhJ QYCNBnP2gk5gk1c5aybwj73zQcPn49dWyH3Ojqmt3E72fpkxvY3Uvy4hukHAFU8q gWQuULClKkfhrQDUPNXU522Lz5w1YoQV6TQ0Ieru9W9PMoNO3lOsTC09y6SBPaPD WwUdMaWy0U419FobwZaVGBvyxXlUDVBtAqXXd/neJxuaJiRpFaBcRhDJlXdVCvSb 4+4KowPIMpLCXnevq3LgeTJuPbTjrfAPHa8PxxRdv7vCJ1epKI8GM1aa7VZBLW7I DzN+TYGOV50Lybfqu39PfMtNJp2utvhAFSxp0Qhub7sjws1RFyKHLomQeRS9ApW4 nmlNqle+e57FsxOfgI004gxNqi0BQ+jrytbmpxoBuIpafoI0TxEWFAneXaasjcCn Xy6K7hlRY82iCE4Ao/nJYYBV2Pz89m+MfOxB9kMo8CEr/Sa+qC7ggb2fb5tBew2N /ry5qK+hv8X/uGyAwHUBwUWdSsxW+mPL0ULp3maNHkSm7wDROAYdlljIl+5grT7j WtfBySz1TlBZvGI1ZBEqJxQZk09UbOnHFqPpUlWO2XQtROnFhWg2faq5HtbCWLxz 1BOY0mJq8oXjUnh4ka5Le5duoIfPh3jqKp1SpCXH9AqidNsTRLc= =WyEr -----END PGP SIGNATURE----- --KDt/GgjP6HVcx58l--