Skip to content

Commit 23e88e2

Browse files
committed
Document get/set bit/byte functions.
1 parent 7816c7c commit 23e88e2

File tree

2 files changed

+60
-7
lines changed

2 files changed

+60
-7
lines changed

doc/src/sgml/func.sgml

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.132 2002/11/23 04:04:43 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.133 2002/12/05 04:38:29 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -473,7 +473,8 @@ PostgreSQL documentation
473473
shown in <xref linkend="functions-math-bit-table">.
474474
Bit string arguments to <literal>&</literal>, <literal>|</literal>,
475475
and <literal>#</literal> must be of equal length. When bit
476-
shifting, the original length of the string is preserved, as shown in the table.
476+
shifting, the original length of the string is preserved, as shown
477+
in the table.
477478
</para>
478479

479480
<table id="functions-math-bit-table">
@@ -2120,6 +2121,58 @@ PostgreSQL documentation
21202121
<entry><literal>trim('\\000'::bytea from '\\000Tom\\000'::bytea)</literal></entry>
21212122
<entry><literal>Tom</literal></entry>
21222123
</row>
2124+
2125+
<row>
2126+
<entry><function>get_byte</function>(<parameter>string</parameter>, <parameter>offset</parameter>)</entry>
2127+
<entry><type>integer</type></entry>
2128+
<entry>
2129+
Extract byte from string.
2130+
<indexterm>
2131+
<primary>get_byte</primary>
2132+
</indexterm>
2133+
</entry>
2134+
<entry><literal>get_byte('Th\\000omas'::bytea, 4)</literal></entry>
2135+
<entry><literal>109</literal></entry>
2136+
</row>
2137+
2138+
<row>
2139+
<entry><function>set_byte</function>(<parameter>string</parameter>, <parameter>offset</parameter>)</entry>
2140+
<entry><type>bytea</type></entry>
2141+
<entry>
2142+
Set byte in string.
2143+
<indexterm>
2144+
<primary>set_byte</primary>
2145+
</indexterm>
2146+
</entry>
2147+
<entry><literal>set_byte('Th\\000omas'::bytea, 4, 64)</literal></entry>
2148+
<entry><literal>Th\000o@as</literal></entry>
2149+
</row>
2150+
2151+
<row>
2152+
<entry><function>get_bit</function>(<parameter>string</parameter>, <parameter>offset</parameter>)</entry>
2153+
<entry><type>integer</type></entry>
2154+
<entry>
2155+
Extract bit from string.
2156+
<indexterm>
2157+
<primary>get_bit</primary>
2158+
</indexterm>
2159+
</entry>
2160+
<entry><literal>get_bit('Th\\000omas'::bytea, 45)</literal></entry>
2161+
<entry><literal>1</literal></entry>
2162+
</row>
2163+
2164+
<row>
2165+
<entry><function>set_bit</function>(<parameter>string</parameter>, <parameter>offset</parameter>)</entry>
2166+
<entry><type>bytea</type></entry>
2167+
<entry>
2168+
Set bit in string.
2169+
<indexterm>
2170+
<primary>set_bit</primary>
2171+
</indexterm>
2172+
</entry>
2173+
<entry><literal>set_bit('Th\\000omas'::bytea, 45, 0)</literal></entry>
2174+
<entry><literal>Th\000omAs</literal></entry>
2175+
</row>
21232176
</tbody>
21242177
</tgroup>
21252178
</table>

src/include/catalog/pg_proc.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: pg_proc.h,v 1.277 2002/12/04 05:18:36 momjian Exp $
10+
* $Id: pg_proc.h,v 1.278 2002/12/05 04:38:30 momjian Exp $
1111
*
1212
* NOTES
1313
* The script catalog/genbki.sh reads this file and generates .bki
@@ -958,13 +958,13 @@ DESCR("less-than-or-equal");
958958
DATA(insert OID = 720 ( octet_length PGNSP PGUID 12 f f t f i 1 23 "17" byteaoctetlen - _null_ ));
959959
DESCR("octet length");
960960
DATA(insert OID = 721 ( get_byte PGNSP PGUID 12 f f t f i 2 23 "17 23" byteaGetByte - _null_ ));
961-
DESCR("");
961+
DESCR("get byte");
962962
DATA(insert OID = 722 ( set_byte PGNSP PGUID 12 f f t f i 3 17 "17 23 23" byteaSetByte - _null_ ));
963-
DESCR("");
963+
DESCR("set byte");
964964
DATA(insert OID = 723 ( get_bit PGNSP PGUID 12 f f t f i 2 23 "17 23" byteaGetBit - _null_ ));
965-
DESCR("");
965+
DESCR("get bit");
966966
DATA(insert OID = 724 ( set_bit PGNSP PGUID 12 f f t f i 3 17 "17 23 23" byteaSetBit - _null_ ));
967-
DESCR("");
967+
DESCR("set bit");
968968

969969
DATA(insert OID = 725 ( dist_pl PGNSP PGUID 12 f f t f i 2 701 "600 628" dist_pl - _null_ ));
970970
DESCR("distance between point and line");

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy