Home Explore Blog CI



postgresql

3rd chunk of `doc/src/sgml/intarray.sgml`
b4f5bd45546d11804119457c026537d695815b9af0e00e1e0000000100000fad
 <function>subarray</function> ( <type>integer[]</type>, <parameter>start</parameter> <type>integer</type> )
        <returnvalue>integer[]</returnvalue>
       </para>
       <para>
        Extracts the portion of the array starting at
        position <parameter>start</parameter>.
       </para>
       <para>
        <literal>subarray('{1,2,3,2,1}'::integer[], 2)</literal>
        <returnvalue>{2,3,2,1}</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <indexterm><primary>intset</primary></indexterm>
        <function>intset</function> ( <type>integer</type> )
        <returnvalue>integer[]</returnvalue>
       </para>
       <para>
        Makes a single-element array.
       </para>
       <para>
        <literal>intset(42)</literal>
        <returnvalue>{42}</returnvalue>
       </para></entry>
      </row>
    </tbody>
   </tgroup>
  </table>

  <table id="intarray-op-table">
   <title><filename>intarray</filename> Operators</title>
    <tgroup cols="1">
     <thead>
      <row>
       <entry role="func_table_entry"><para role="func_signature">
        Operator
       </para>
       <para>
        Description
       </para></entry>
      </row>
     </thead>

     <tbody>
      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <type>integer[]</type> <literal>&amp;&amp;</literal> <type>integer[]</type>
        <returnvalue>boolean</returnvalue>
       </para>
       <para>
        Do arrays overlap (have at least one element in common)?
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <type>integer[]</type> <literal>@&gt;</literal> <type>integer[]</type>
        <returnvalue>boolean</returnvalue>
       </para>
       <para>
        Does left array contain right array?
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <type>integer[]</type> <literal>&lt;@</literal> <type>integer[]</type>
        <returnvalue>boolean</returnvalue>
       </para>
       <para>
        Is left array contained in right array?
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <type></type> <literal>#</literal> <type>integer[]</type>
        <returnvalue>integer</returnvalue>
       </para>
       <para>
        Returns the number of elements in the array.
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <type>integer[]</type> <literal>#</literal> <type>integer</type>
        <returnvalue>integer</returnvalue>
       </para>
       <para>
        Returns index of the first array element
        matching the right argument, or 0 if no match.
        (Same as <function>idx</function> function.)
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <type>integer[]</type> <literal>+</literal> <type>integer</type>
        <returnvalue>integer[]</returnvalue>
       </para>
       <para>
        Adds element to end of array.
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <type>integer[]</type> <literal>+</literal> <type>integer[]</type>
        <returnvalue>integer[]</returnvalue>
       </para>
       <para>
        Concatenates the arrays.
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <type>integer[]</type> <literal>-</literal> <type>integer</type>
        <returnvalue>integer[]</returnvalue>
       </para>
       <para>
        Removes entries matching the right argument from the array.
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <type>integer[]</type>

Title: intarray Module Operators
Summary
This section describes the operators provided by the intarray module for PostgreSQL. These operators work with integer arrays and include: '&&' (checks if arrays overlap), '@>' (checks if left array contains right array), '<@' (checks if left array is contained in right array), '#' (returns number of elements or index of first matching element), '+' (adds element to array or concatenates arrays), and '-' (removes matching entries from array). Each operator is explained with its syntax, return type, and a brief description of its functionality. These operators enhance the manipulation and comparison capabilities for integer arrays in PostgreSQL.