Home Explore Blog CI



postgresql

2nd chunk of `doc/src/sgml/hstore.sgml`
fca906ed1555b834e8e370af07f6e3371f48e37dda79ae850000000100000fbd
 </para>

 </sect2>

 <sect2 id="hstore-ops-funcs">
  <title><type>hstore</type> Operators and Functions</title>

  <para>
   The operators provided by the <literal>hstore</literal> module are
   shown in <xref linkend="hstore-op-table"/>, the functions
   in <xref linkend="hstore-func-table"/>.
  </para>

  <table id="hstore-op-table">
   <title><type>hstore</type> Operators</title>
    <tgroup cols="1">
     <thead>
      <row>
       <entry role="func_table_entry"><para role="func_signature">
        Operator
       </para>
       <para>
        Description
       </para>
       <para>
        Example(s)
       </para></entry>
      </row>
     </thead>

     <tbody>
      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <type>hstore</type> <literal>-&gt;</literal> <type>text</type>
        <returnvalue>text</returnvalue>
       </para>
       <para>
        Returns value associated with given key, or <literal>NULL</literal> if
        not present.
       </para>
       <para>
        <literal>'a=&gt;x, b=&gt;y'::hstore -&gt; 'a'</literal>
        <returnvalue>x</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <type>hstore</type> <literal>-&gt;</literal> <type>text[]</type>
        <returnvalue>text[]</returnvalue>
       </para>
       <para>
        Returns values associated with given keys, or <literal>NULL</literal>
        if not present.
       </para>
       <para>
        <literal>'a=&gt;x, b=&gt;y, c=&gt;z'::hstore -&gt; ARRAY['c','a']</literal>
        <returnvalue>{"z","x"}</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <type>hstore</type> <literal>||</literal> <type>hstore</type>
        <returnvalue>hstore</returnvalue>
       </para>
       <para>
        Concatenates two <type>hstore</type>s.
       </para>
       <para>
        <literal>'a=&gt;b, c=&gt;d'::hstore || 'c=&gt;x, d=&gt;q'::hstore</literal>
        <returnvalue>"a"=&gt;"b", "c"=&gt;"x", "d"=&gt;"q"</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <type>hstore</type> <literal>?</literal> <type>text</type>
        <returnvalue>boolean</returnvalue>
       </para>
       <para>
        Does <type>hstore</type> contain key?
       </para>
       <para>
        <literal>'a=&gt;1'::hstore ? 'a'</literal>
        <returnvalue>t</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <type>hstore</type> <literal>?&amp;</literal> <type>text[]</type>
        <returnvalue>boolean</returnvalue>
       </para>
       <para>
        Does <type>hstore</type> contain all the specified keys?
       </para>
       <para>
        <literal>'a=&gt;1,b=&gt;2'::hstore ?&amp; ARRAY['a','b']</literal>
        <returnvalue>t</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <type>hstore</type> <literal>?|</literal> <type>text[]</type>
        <returnvalue>boolean</returnvalue>
       </para>
       <para>
        Does <type>hstore</type> contain any of the specified keys?
       </para>
       <para>
        <literal>'a=&gt;1,b=&gt;2'::hstore ?| ARRAY['b','c']</literal>
        <returnvalue>t</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <type>hstore</type> <literal>@&gt;</literal> <type>hstore</type>
        <returnvalue>boolean</returnvalue>
       </para>
       <para>
        Does left operand contain right?
       </para>
       <para>
        <literal>'a=&gt;b, b=&gt;1, c=&gt;NULL'::hstore @&gt; 'b=&gt;1'</literal>
        <returnvalue>t</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para

Title: hstore Operators and Functions in PostgreSQL
Summary
This section details the operators and functions available for the hstore data type in PostgreSQL. It includes a table of operators such as key retrieval (->), concatenation (||), key existence checks (?), multiple key checks (?& and ?|), and containment checks (@>). Each operator is described with its syntax, return type, and example usage, demonstrating how to manipulate and query hstore data effectively.