Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
c0dc44eb
Commit
c0dc44eb
authored
Mar 08, 2011
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A bit more editing for collation documentation.
parent
d367d41d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
11 deletions
+30
-11
doc/src/sgml/syntax.sgml
doc/src/sgml/syntax.sgml
+30
-11
No files found.
doc/src/sgml/syntax.sgml
View file @
c0dc44eb
...
...
@@ -1257,6 +1257,12 @@ SELECT 3 OPERATOR(pg_catalog.+) 4;
</para>
</listitem>
<listitem>
<para>
A collation expression
</para>
</listitem>
<listitem>
<para>
A scalar subquery
...
...
@@ -1898,8 +1904,8 @@ CAST ( <replaceable>expression</replaceable> AS <replaceable>type</replaceable>
</note>
</sect2>
<sect2 id="sql-syntax-collate-
clause
">
<title>C
OLLATE Clause
</title>
<sect2 id="sql-syntax-collate-
exprs
">
<title>C
ollation Expressions
</title>
<indexterm>
<primary>COLLATE</primary>
...
...
@@ -1925,7 +1931,7 @@ CAST ( <replaceable>expression</replaceable> AS <replaceable>type</replaceable>
</para>
<para>
The two
typical
uses of the <literal>COLLATE</literal> clause are
The two
common
uses of the <literal>COLLATE</literal> clause are
overriding the sort order in an <literal>ORDER BY</> clause, for
example:
<programlisting>
...
...
@@ -1934,15 +1940,28 @@ SELECT a, b, c FROM tbl WHERE ... ORDER BY a COLLATE "C";
and overriding the collation of a function or operator call that
has locale-sensitive results, for example:
<programlisting>
SELECT * FROM tbl WHERE a > 'foo' COLLATE "C";
SELECT * FROM tbl WHERE a > 'foo' COLLATE "C";
</programlisting>
Note that in the latter case the <literal>COLLATE</> clause is
attached to an input argument of the operator we wish to affect.
It doesn't matter which argument of the operator or function call the
<literal>COLLATE</> clause is attached to, because the collation that is
applied by the operator or function is derived by considering all
arguments, and an explicit <literal>COLLATE</> clause will override the
collations of all other arguments. (Attaching non-matching
<literal>COLLATE</> clauses to more than one argument, however, is an
error. For more details see <xref linkend="collation">.)
Thus, this gives the same result as the previous example:
<programlisting>
SELECT * FROM tbl WHERE a COLLATE "C" > 'foo';
</programlisting>
But this is an error:
<programlisting>
SELECT * FROM tbl WHERE (a > 'foo') COLLATE "C";
</programlisting>
In the latter case it doesn't matter which argument of the
operator of function call the <literal>COLLATE</> clause is
attached to, because the collation that is applied by the operator
or function is derived from all arguments, and
the <literal>COLLATE</> clause will override the collations of all
other arguments. Attaching nonmatching <literal>COLLATE</>
clauses to more than one argument, however, is an error.
because it attempts to apply a collation to the result of the
<literal>></> operator, which is of the non-collatable data type
<type>boolean</>.
</para>
</sect2>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment