Document get/set bit/byte functions.

This commit is contained in:
Bruce Momjian 2002-12-05 04:38:30 +00:00
parent 7816c7cb94
commit 23e88e25d6
2 changed files with 60 additions and 7 deletions

View File

@ -1,5 +1,5 @@
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.132 2002/11/23 04:04:43 momjian Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.133 2002/12/05 04:38:29 momjian Exp $
PostgreSQL documentation
-->
@ -473,7 +473,8 @@ PostgreSQL documentation
shown in <xref linkend="functions-math-bit-table">.
Bit string arguments to <literal>&</literal>, <literal>|</literal>,
and <literal>#</literal> must be of equal length. When bit
shifting, the original length of the string is preserved, as shown in the table.
shifting, the original length of the string is preserved, as shown
in the table.
</para>
<table id="functions-math-bit-table">
@ -2120,6 +2121,58 @@ PostgreSQL documentation
<entry><literal>trim('\\000'::bytea from '\\000Tom\\000'::bytea)</literal></entry>
<entry><literal>Tom</literal></entry>
</row>
<row>
<entry><function>get_byte</function>(<parameter>string</parameter>, <parameter>offset</parameter>)</entry>
<entry><type>integer</type></entry>
<entry>
Extract byte from string.
<indexterm>
<primary>get_byte</primary>
</indexterm>
</entry>
<entry><literal>get_byte('Th\\000omas'::bytea, 4)</literal></entry>
<entry><literal>109</literal></entry>
</row>
<row>
<entry><function>set_byte</function>(<parameter>string</parameter>, <parameter>offset</parameter>)</entry>
<entry><type>bytea</type></entry>
<entry>
Set byte in string.
<indexterm>
<primary>set_byte</primary>
</indexterm>
</entry>
<entry><literal>set_byte('Th\\000omas'::bytea, 4, 64)</literal></entry>
<entry><literal>Th\000o@as</literal></entry>
</row>
<row>
<entry><function>get_bit</function>(<parameter>string</parameter>, <parameter>offset</parameter>)</entry>
<entry><type>integer</type></entry>
<entry>
Extract bit from string.
<indexterm>
<primary>get_bit</primary>
</indexterm>
</entry>
<entry><literal>get_bit('Th\\000omas'::bytea, 45)</literal></entry>
<entry><literal>1</literal></entry>
</row>
<row>
<entry><function>set_bit</function>(<parameter>string</parameter>, <parameter>offset</parameter>)</entry>
<entry><type>bytea</type></entry>
<entry>
Set bit in string.
<indexterm>
<primary>set_bit</primary>
</indexterm>
</entry>
<entry><literal>set_bit('Th\\000omas'::bytea, 45, 0)</literal></entry>
<entry><literal>Th\000omAs</literal></entry>
</row>
</tbody>
</tgroup>
</table>

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_proc.h,v 1.277 2002/12/04 05:18:36 momjian Exp $
* $Id: pg_proc.h,v 1.278 2002/12/05 04:38:30 momjian Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
@ -958,13 +958,13 @@ DESCR("less-than-or-equal");
DATA(insert OID = 720 ( octet_length PGNSP PGUID 12 f f t f i 1 23 "17" byteaoctetlen - _null_ ));
DESCR("octet length");
DATA(insert OID = 721 ( get_byte PGNSP PGUID 12 f f t f i 2 23 "17 23" byteaGetByte - _null_ ));
DESCR("");
DESCR("get byte");
DATA(insert OID = 722 ( set_byte PGNSP PGUID 12 f f t f i 3 17 "17 23 23" byteaSetByte - _null_ ));
DESCR("");
DESCR("set byte");
DATA(insert OID = 723 ( get_bit PGNSP PGUID 12 f f t f i 2 23 "17 23" byteaGetBit - _null_ ));
DESCR("");
DESCR("get bit");
DATA(insert OID = 724 ( set_bit PGNSP PGUID 12 f f t f i 3 17 "17 23 23" byteaSetBit - _null_ ));
DESCR("");
DESCR("set bit");
DATA(insert OID = 725 ( dist_pl PGNSP PGUID 12 f f t f i 2 701 "600 628" dist_pl - _null_ ));
DESCR("distance between point and line");