Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc0dc44e

Browse files
committed
A bit more editing for collation documentation.
1 parentd367d41 commitc0dc44e

File tree

1 file changed

+30
-11
lines changed

1 file changed

+30
-11
lines changed

‎doc/src/sgml/syntax.sgml

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,6 +1257,12 @@ SELECT 3 OPERATOR(pg_catalog.+) 4;
12571257
</para>
12581258
</listitem>
12591259

1260+
<listitem>
1261+
<para>
1262+
A collation expression
1263+
</para>
1264+
</listitem>
1265+
12601266
<listitem>
12611267
<para>
12621268
A scalar subquery
@@ -1898,8 +1904,8 @@ CAST ( <replaceable>expression</replaceable> AS <replaceable>type</replaceable>
18981904
</note>
18991905
</sect2>
19001906

1901-
<sect2 id="sql-syntax-collate-clause">
1902-
<title>COLLATE Clause</title>
1907+
<sect2 id="sql-syntax-collate-exprs">
1908+
<title>Collation Expressions</title>
19031909

19041910
<indexterm>
19051911
<primary>COLLATE</primary>
@@ -1925,7 +1931,7 @@ CAST ( <replaceable>expression</replaceable> AS <replaceable>type</replaceable>
19251931
</para>
19261932

19271933
<para>
1928-
The twotypical uses of the <literal>COLLATE</literal> clause are
1934+
The twocommon uses of the <literal>COLLATE</literal> clause are
19291935
overriding the sort order in an <literal>ORDER BY</> clause, for
19301936
example:
19311937
<programlisting>
@@ -1934,15 +1940,28 @@ SELECT a, b, c FROM tbl WHERE ... ORDER BY a COLLATE "C";
19341940
and overriding the collation of a function or operator call that
19351941
has locale-sensitive results, for example:
19361942
<programlisting>
1937-
SELECT * FROM tbl WHERE a > 'foo' COLLATE "C";
1943+
SELECT * FROM tbl WHERE a &gt; 'foo' COLLATE "C";
1944+
</programlisting>
1945+
Note that in the latter case the <literal>COLLATE</> clause is
1946+
attached to an input argument of the operator we wish to affect.
1947+
It doesn't matter which argument of the operator or function call the
1948+
<literal>COLLATE</> clause is attached to, because the collation that is
1949+
applied by the operator or function is derived by considering all
1950+
arguments, and an explicit <literal>COLLATE</> clause will override the
1951+
collations of all other arguments. (Attaching non-matching
1952+
<literal>COLLATE</> clauses to more than one argument, however, is an
1953+
error. For more details see <xref linkend="collation">.)
1954+
Thus, this gives the same result as the previous example:
1955+
<programlisting>
1956+
SELECT * FROM tbl WHERE a COLLATE "C" &gt; 'foo';
1957+
</programlisting>
1958+
But this is an error:
1959+
<programlisting>
1960+
SELECT * FROM tbl WHERE (a &gt; 'foo') COLLATE "C";
19381961
</programlisting>
1939-
In the latter case it doesn't matter which argument of the
1940-
operator of function call the <literal>COLLATE</> clause is
1941-
attached to, because the collation that is applied by the operator
1942-
or function is derived from all arguments, and
1943-
the <literal>COLLATE</> clause will override the collations of all
1944-
other arguments. Attaching nonmatching <literal>COLLATE</>
1945-
clauses to more than one argument, however, is an error.
1962+
because it attempts to apply a collation to the result of the
1963+
<literal>&gt;</> operator, which is of the non-collatable data type
1964+
<type>boolean</>.
19461965
</para>
19471966
</sect2>
19481967

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp