Commit 526427f6 authored by Peter Eisentraut's avatar Peter Eisentraut

Add information about bit types. Adjust some other things to promote

SQL type names over internal type names.
parent 475c1452
This diff is collapsed.
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.46 2000/12/22 18:00:24 tgl Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.47 2001/01/13 18:34:51 petere Exp $ -->
<chapter id="functions"> <chapter id="functions">
<title>Functions and Operators</title> <title>Functions and Operators</title>
...@@ -184,42 +184,102 @@ ...@@ -184,42 +184,102 @@
<entry>@ -5.0</entry> <entry>@ -5.0</entry>
<entry>5.0</entry> <entry>5.0</entry>
</row> </row>
<row>
<entry> <literal>&amp;</literal> </entry>
<entry>Binary AND</entry>
<entry>91 & 15</entry>
<entry>11</entry>
</row>
<row>
<entry> <literal>|</literal> </entry>
<entry>Binary OR</entry>
<entry>32 | 3</entry>
<entry>35</entry>
</row>
<row>
<entry> <literal>#</literal> </entry>
<entry>Binary XOR</entry>
<entry>17 # 5</entry>
<entry>20</entry>
</row>
<row>
<entry> <literal>~</literal> </entry>
<entry>Binary NOT</entry>
<entry>~1</entry>
<entry>-2</entry>
</row>
<row>
<entry> &lt;&lt; </entry>
<entry>Binary shift left</entry>
<entry>1 &lt;&lt; 4</entry>
<entry>16</entry>
</row>
<row>
<entry> &gt;&gt; </entry>
<entry>Binary shift right</entry>
<entry>8 &gt;&gt; 2</entry>
<entry>2</entry>
</row>
</tbody> </tbody>
</tgroup> </tgroup>
</table> </table>
<!-- <para>
<ROW> The <quote>binary</quote> operators are also available for the bit
<ENTRY> & </ENTRY> string types <type>BIT</type> and <type>BIT VARYING</type>.
<ENTRY>Binary AND</ENTRY>
<ENTRY>91 & 15</ENTRY> <table>
</ROW> <title>Bit String Binary Operators</title>
<ROW>
<ENTRY> | </ENTRY> <tgroup cols="2">
<ENTRY>Binary OR</ENTRY> <thead>
<ENTRY>32 | 3</ENTRY> <row>
</ROW> <entry>Example</entry>
<ROW> <entry>Result</entry>
<ENTRY> # </ENTRY> </row>
<ENTRY>Binary XOR</ENTRY> </thead>
<ENTRY>15 # 4</ENTRY>
</ROW> <tbody>
<ROW> <row>
<ENTRY> ~ </ENTRY> <entry>B'10001' & B'01101'</entry>
<ENTRY>Binary NOT</ENTRY> <entry>00001</entry>
<ENTRY>~1</ENTRY> </row>
</ROW> <row>
<ROW> <entry>B'10001' | B'01101'</entry>
<ENTRY> &lt;&lt; </ENTRY> <entry>11101</entry>
<ENTRY>Binary shift left</ENTRY> </row>
<ENTRY>1 &lt;&lt; 4</ENTRY> <row>
</ROW> <entry>B'10001' # B'01101'</entry>
<ROW> <entry>11110</entry>
<ENTRY> &gt;&gt; </ENTRY> </row>
<ENTRY>Binary shift right</ENTRY> <row>
<ENTRY>8 &gt;&gt; 2</ENTRY> <entry>~ B'10001'</entry>
</ROW> <entry>01110</entry>
--> </row>
<row>
<entry>B'10001' << 3</entry>
<entry>01000</entry>
</row>
<row>
<entry>B'10001' >> 2</entry>
<entry>00100</entry>
</row>
</tbody>
</tgroup>
</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
here.
</para>
<table tocentry="1"> <table tocentry="1">
<title>Mathematical Functions</title> <title>Mathematical Functions</title>
...@@ -484,7 +544,8 @@ ...@@ -484,7 +544,8 @@
wary of potential effects of the automatic padding when using the wary of potential effects of the automatic padding when using the
<type>CHARACTER</type> type. Generally the functions described <type>CHARACTER</type> type. Generally the functions described
here also work on data of non-string types by converting that data here also work on data of non-string types by converting that data
to a string representation first. to a string representation first. Some functions also exist
natively for bit string types.
</para> </para>
<para> <para>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.33 2001/01/08 22:07:47 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.34 2001/01/13 18:34:51 petere Exp $
--> -->
<chapter id="sql-syntax"> <chapter id="sql-syntax">
...@@ -232,7 +232,7 @@ SELECT 'foo' 'bar'; ...@@ -232,7 +232,7 @@ SELECT 'foo' 'bar';
</para> </para>
</sect3> </sect3>
<sect3> <sect3 id="sql-syntax-bit-strings">
<title>Bit String Constants</title> <title>Bit String Constants</title>
<para> <para>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment