@@ -13698,6 +13698,10 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
1369813698 <primary>pg_typeof</primary>
1369913699 </indexterm>
1370013700
13701+ <indexterm>
13702+ <primary>collation for</primary>
13703+ </indexterm>
13704+
1370113705 <para>
1370213706 <xref linkend="functions-info-catalog-table"> lists functions that
1370313707 extract information from the system catalogs.
@@ -13859,6 +13863,11 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
1385913863 <entry><type>regtype</type></entry>
1386013864 <entry>get the data type of any value</entry>
1386113865 </row>
13866+ <row>
13867+ <entry><literal><function>collation for (<parameter>any</parameter>)</function></literal></entry>
13868+ <entry><type>text</type></entry>
13869+ <entry>get the collation of the argument</entry>
13870+ </row>
1386213871 </tbody>
1386313872 </tgroup>
1386413873 </table>
@@ -13983,6 +13992,27 @@ SELECT typlen FROM pg_type WHERE oid = pg_typeof(33);
1398313992 4
1398413993(1 row)
1398513994</programlisting>
13995+ </para>
13996+
13997+ <para>
13998+ The expression <literal>collation for</literal> returns the collation of the
13999+ value that is passed to it. Example:
14000+ <programlisting>
14001+ SELECT collation for (description) FROM pg_description LIMIT 1;
14002+ pg_collation_for
14003+ ------------------
14004+ "default"
14005+ (1 row)
14006+
14007+ SELECT collation for ('foo' COLLATE "de_DE");
14008+ pg_collation_for
14009+ ------------------
14010+ "de_DE"
14011+ (1 row)
14012+ </programlisting>
14013+ The value might be quoted and schema-qualified. If no collation is derived
14014+ for the argument expression, then a null value is returned. If the argument
14015+ is not of a collatable data type, then an error is raised.
1398614016 </para>
1398714017
1398814018 <indexterm>