summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2012-03-02 21:12:16 +0200
committerPeter Eisentraut <peter_e@gmx.net>2012-03-02 21:12:16 +0200
commit6688d2878e516314418274ee95c5c30412351933 (patch)
treed3f3048615781ca3a793a452482f774e8f9f301c /doc/src
parentd41f510c807ce8b12c572196e2ae8f3817ac253a (diff)
Add COLLATION FOR expression
reviewed by Jaime Casanova
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/func.sgml30
1 files changed, 30 insertions, 0 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 8f6e2d04bdb..5c1cff3618d 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -13698,6 +13698,10 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
<primary>pg_typeof</primary>
</indexterm>
+ <indexterm>
+ <primary>collation for</primary>
+ </indexterm>
+
<para>
<xref linkend="functions-info-catalog-table"> lists functions that
extract information from the system catalogs.
@@ -13859,6 +13863,11 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
<entry><type>regtype</type></entry>
<entry>get the data type of any value</entry>
</row>
+ <row>
+ <entry><literal><function>collation for (<parameter>any</parameter>)</function></literal></entry>
+ <entry><type>text</type></entry>
+ <entry>get the collation of the argument</entry>
+ </row>
</tbody>
</tgroup>
</table>
@@ -13985,6 +13994,27 @@ SELECT typlen FROM pg_type WHERE oid = pg_typeof(33);
</programlisting>
</para>
+ <para>
+ The expression <literal>collation for</literal> returns the collation of the
+ value that is passed to it. Example:
+<programlisting>
+SELECT collation for (description) FROM pg_description LIMIT 1;
+ pg_collation_for
+------------------
+ "default"
+(1 row)
+
+SELECT collation for ('foo' COLLATE "de_DE");
+ pg_collation_for
+------------------
+ "de_DE"
+(1 row)
+</programlisting>
+ The value might be quoted and schema-qualified. If no collation is derived
+ for the argument expression, then a null value is returned. If the argument
+ is not of a collatable data type, then an error is raised.
+ </para>
+
<indexterm>
<primary>col_description</primary>
</indexterm>