mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
Add user-callable CRC functions.
We've had code for CRC-32 and CRC-32C for some time (for WAL records, etc.), but there was no way for users to call it, despite apparent popular demand. The new crc32() and crc32c() functions accept bytea input and return bigint (to avoid returning negative values). Bumps catversion. Author: Aleksander Alekseev Reviewed-by: Peter Eisentraut, Tom Lane Discussion: https://postgr.es/m/CAJ7c6TNMTGnqnG%3DyXXUQh9E88JDckmR45H2Q%2B%3DucaCLMOW1QQw%40mail.gmail.com
This commit is contained in:
@ -4490,6 +4490,40 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry role="func_table_entry"><para role="func_signature">
|
||||
<indexterm>
|
||||
<primary>crc32</primary>
|
||||
</indexterm>
|
||||
<function>crc32</function> ( <type>bytea</type> )
|
||||
<returnvalue>bigint</returnvalue>
|
||||
</para>
|
||||
<para>
|
||||
Computes the CRC-32 value of the binary string.
|
||||
</para>
|
||||
<para>
|
||||
<literal>crc32('abc'::bytea)</literal>
|
||||
<returnvalue>891568578</returnvalue>
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry role="func_table_entry"><para role="func_signature">
|
||||
<indexterm>
|
||||
<primary>crc32c</primary>
|
||||
</indexterm>
|
||||
<function>crc32c</function> ( <type>bytea</type> )
|
||||
<returnvalue>bigint</returnvalue>
|
||||
</para>
|
||||
<para>
|
||||
Computes the CRC-32C value of the binary string.
|
||||
</para>
|
||||
<para>
|
||||
<literal>crc32c('abc'::bytea)</literal>
|
||||
<returnvalue>910901175</returnvalue>
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry role="func_table_entry"><para role="func_signature">
|
||||
<indexterm>
|
||||
|
Reference in New Issue
Block a user