Home Explore Blog CI



postgresql

3rd chunk of `doc/src/sgml/hstore.sgml`
6645e3628a5f88409798384f0ca89c0e24980e98be55f3620000000100000fa0
  </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 role="func_signature">
        <type>hstore</type> <literal>&lt;@</literal> <type>hstore</type>
        <returnvalue>boolean</returnvalue>
       </para>
       <para>
        Is left operand contained in right?
       </para>
       <para>
        <literal>'a=&gt;c'::hstore &lt;@ 'a=&gt;b, b=&gt;1, c=&gt;NULL'</literal>
        <returnvalue>f</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <type>hstore</type> <literal>-</literal> <type>text</type>
        <returnvalue>hstore</returnvalue>
       </para>
       <para>
        Deletes key from left operand.
       </para>
       <para>
        <literal>'a=&gt;1, b=&gt;2, c=&gt;3'::hstore - 'b'::text</literal>
        <returnvalue>"a"=&gt;"1", "c"=&gt;"3"</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <type>hstore</type> <literal>-</literal> <type>text[]</type>
        <returnvalue>hstore</returnvalue>
       </para>
       <para>
        Deletes keys from left operand.
       </para>
       <para>
        <literal>'a=&gt;1, b=&gt;2, c=&gt;3'::hstore - ARRAY['a','b']</literal>
        <returnvalue>"c"=&gt;"3"</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>
        Deletes pairs from left operand that match pairs in the right operand.
       </para>
       <para>
        <literal>'a=&gt;1, b=&gt;2, c=&gt;3'::hstore - 'a=&gt;4, b=&gt;2'::hstore</literal>
        <returnvalue>"a"=&gt;"1", "c"=&gt;"3"</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <type>anyelement</type> <literal>#=</literal> <type>hstore</type>
        <returnvalue>anyelement</returnvalue>
       </para>
       <para>
        Replaces fields in the left operand (which must be a composite type)
        with matching values from <type>hstore</type>.
       </para>
       <para>
        <literal>ROW(1,3) #= 'f1=>11'::hstore</literal>
        <returnvalue>(11,3)</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <literal>%%</literal> <type>hstore</type>
        <returnvalue>text[]</returnvalue>
       </para>
       <para>
        Converts <type>hstore</type> to an array of alternating keys and
        values.
       </para>
       <para>
        <literal>%% 'a=&gt;foo, b=&gt;bar'::hstore</literal>
        <returnvalue>{a,foo,b,bar}</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <literal>%#</literal> <type>hstore</type>
        <returnvalue>text[]</returnvalue>
       </para>
  

Title: Additional hstore Operators in PostgreSQL
Summary
This section continues to describe operators for the hstore data type in PostgreSQL. It covers operators for containment checks (<@), key deletion (-), composite type field replacement (#=), and conversion to arrays (%% and %#). Each operator is explained with its syntax, return type, and practical examples. These operators provide powerful ways to manipulate and query hstore data, including removing keys, checking if one hstore is contained within another, and converting hstore data to array formats for further processing.