Re: [PATCH] Add crc32(text) & crc32(bytea)

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, Aleksander Alekseev <aleksander(at)timescale(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Add crc32(text) & crc32(bytea)
Date: 2024-08-08 15:59:52
Message-ID: ZrTreDUQ6z69itNs@nathan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 08, 2024 at 10:49:42AM -0400, Tom Lane wrote:
> Nathan Bossart <nathandbossart(at)gmail(dot)com> writes:
>> On Thu, Aug 08, 2024 at 04:27:20PM +0200, Peter Eisentraut wrote:
>>> The correct return type of a CRC operation in general is some kind of exact
>>> numerical type. Just pick the best one that fits the result. I don't think
>>> bytea is appropriate.
>
>> That would leave us either "integer" or "bigint". "integer" is more
>> correct from a size perspective, but will result in negative values because
>> it is signed. "bigint" uses twice as many bytes but won't display any CRC
>> values as negative.
>
> bigint seems fine to me; we have used that in other places as a
> substitute for uint32, eg block numbers in contrib/pageinspect.

WFM. Here is what I have staged for commit.

--
nathan

Attachment Content-Type Size
v5-0001-Add-user-callable-CRC-functions.patch text/plain 6.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2024-08-08 16:12:29 Re: Fix memory counter update in reorderbuffer
Previous Message vignesh C 2024-08-08 15:55:03 Re: Logical Replication of sequences