Re: bigint out of range - Mailing list pgsql-general

From Peter J. Holzer
Subject Re: bigint out of range
Date
Msg-id 20190518192703.ml6duizgdyfyetva@hjp.at
Whole thread Raw
In response to Re: bigint out of range  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: bigint out of range
List pgsql-general
On 2019-05-18 10:49:53 -0700, David G. Johnston wrote:
> On Saturday, May 18, 2019, Peter J. Holzer <hjp-pgsql@hjp.at> wrote:
>
>     On 2019-05-16 08:48:51 -0700, David G. Johnston wrote:
>     > On Thu, May 16, 2019 at 8:31 AM Daulat Ram <Daulat.Ram@exponential.com>
>     wrote:
>     >
>     >
>     >     url_hash        | bigint                  |           | not null |
>     >
>     >
>     > Change the type of url_hash; make it text instead of bigint.
>
>     Or numeric(38, 0). I think it isn't coincidence that he tries to store
>     a 38-digit number in it.
>
>
> You don’t perform math on a hash

That's not generally true. Hashes are used for further computation for
example in hash tables or in cryptography.

> thus its not a number

This is just silly. All hash functions I have ever encountered compute a
single fixed size integer from a stream of integers. The result may be
larger than a machine word, in which case the representation in C (or a
similar low level language) may be an array of words (or bytes), but
it's still an integer.

        hp

--
   _  | Peter J. Holzer    | we build much bigger, better disasters now
|_|_) |                    | because we have much more sophisticated
| |   | hjp@hjp.at         | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson <https://www.edge.org/>

Attachment

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Loading table with indexed jsonb field is stalling
Next
From: Ron
Date:
Subject: Re: bigint out of range