diff options
author | Nathan Bossart <nathan@postgresql.org> | 2024-08-12 10:35:06 -0500 |
---|---|---|
committer | Nathan Bossart <nathan@postgresql.org> | 2024-08-12 10:35:06 -0500 |
commit | 760162fedb4f7ee6f0167cc6acfadee6ccb6be66 (patch) | |
tree | 95564338177e250a12e506473c4e0fe62f9daa7d /doc/src | |
parent | 313df8f5adde186b0052d7d634a6d0ae41852de0 (diff) | |
download | postgresql-760162fedb4f7ee6f0167cc6acfadee6ccb6be66.tar.gz postgresql-760162fedb4f7ee6f0167cc6acfadee6ccb6be66.zip |
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
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/func.sgml | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 968a9985527..cdde6475135 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -4493,6 +4493,40 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three'); <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> <primary>get_bit</primary> </indexterm> <function>get_bit</function> ( <parameter>bytes</parameter> <type>bytea</type>, |