Home Explore Blog CI



postgresql

36th chunk of `doc/src/sgml/func.sgml`
7c7bd8ca8c0d041b1b64895bddfc39381292089b1dd1bbc30000000100000fa1
 role="func_signature">
        <indexterm>
         <primary>casefold</primary>
        </indexterm>
        <function>casefold</function> ( <type>text</type> )
        <returnvalue>text</returnvalue>
       </para>
       <para>
        Performs case folding of the input string according to the collation.
        Case folding is similar to case conversion, but the purpose of case
        folding is to facilitate case-insensitive matching of strings,
        whereas the purpose of case conversion is to convert to a particular
        cased form.  This function can only be used when the server encoding
        is <literal>UTF8</literal>.
       </para>
       <para>
        Ordinarily, case folding simply converts to lowercase, but there may
        be exceptions depending on the collation.  For instance, some
        characters have more than two lowercase variants, or fold to uppercase.
       </para>
       <para>
        Case folding may change the length of the string.  For instance, in
        the <literal>PG_UNICODE_FAST</literal> collation, <literal>ß</literal>
        (U+00DF) folds to <literal>ss</literal>.
       </para>
       <para>
        <function>casefold</function> can be used for Unicode Default Caseless
        Matching.  It does not always preserve the normalized form of the
        input string (see <xref linkend="function-normalize"/>).
       </para>
       <para>
        The <literal>libc</literal> provider doesn't support case folding, so
        <function>casefold</function> is identical to <xref
        linkend="function-lower"/>.
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <indexterm>
         <primary>left</primary>
        </indexterm>
        <function>left</function> ( <parameter>string</parameter> <type>text</type>,
        <parameter>n</parameter> <type>integer</type> )
        <returnvalue>text</returnvalue>
       </para>
       <para>
        Returns first <parameter>n</parameter> characters in the
        string, or when <parameter>n</parameter> is negative, returns
        all but last |<parameter>n</parameter>| characters.
       </para>
       <para>
        <literal>left('abcde', 2)</literal>
        <returnvalue>ab</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <indexterm>
         <primary>length</primary>
        </indexterm>
        <function>length</function> ( <type>text</type> )
        <returnvalue>integer</returnvalue>
       </para>
       <para>
        Returns the number of characters in the string.
       </para>
       <para>
        <literal>length('jose')</literal>
        <returnvalue>4</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <indexterm>
         <primary>md5</primary>
        </indexterm>
        <function>md5</function> ( <type>text</type> )
        <returnvalue>text</returnvalue>
       </para>
       <para>
        Computes the MD5 <link linkend="functions-hash-note">hash</link> of
        the argument, with the result written in hexadecimal.
       </para>
       <para>
        <literal>md5('abc')</literal>
        <returnvalue>900150983cd24fb0&zwsp;d6963f7d28e17f72</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <indexterm>
         <primary>parse_ident</primary>
        </indexterm>
        <function>parse_ident</function> ( <parameter>qualified_identifier</parameter> <type>text</type>
        <optional>, <parameter>strict_mode</parameter> <type>boolean</type> <literal>DEFAULT</literal> <literal>true</literal> </optional> )
        <returnvalue>text[]</returnvalue>
       </para>
       <para>
        Splits <parameter>qualified_identifier</parameter> into an array of
        identifiers, removing any quoting

Title: PostgreSQL String Functions: CASEFOLD, LEFT, LENGTH, MD5, and PARSE_IDENT
Summary
This section describes several PostgreSQL string functions: `casefold` (performs case folding for case-insensitive string matching), `left` (returns the first n characters of a string), `length` (returns the character length of a string), `md5` (computes the MD5 hash of a string), and `parse_ident` (splits a qualified identifier into an array of identifiers).