summaryrefslogtreecommitdiff
path: root/doc/src/sgml/func
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/sgml/func')
-rw-r--r--doc/src/sgml/func/func-array.sgml2
-rw-r--r--doc/src/sgml/func/func-binarystring.sgml10
-rw-r--r--doc/src/sgml/func/func-bitstring.sgml8
-rw-r--r--doc/src/sgml/func/func-datetime.sgml14
-rw-r--r--doc/src/sgml/func/func-formatting.sgml4
-rw-r--r--doc/src/sgml/func/func-info.sgml4
-rw-r--r--doc/src/sgml/func/func-json.sgml80
-rw-r--r--doc/src/sgml/func/func-matching.sgml8
-rw-r--r--doc/src/sgml/func/func-srf.sgml4
-rw-r--r--doc/src/sgml/func/func-string.sgml14
-rw-r--r--doc/src/sgml/func/func-textsearch.sgml2
-rw-r--r--doc/src/sgml/func/func-xml.sgml20
12 files changed, 85 insertions, 85 deletions
diff --git a/doc/src/sgml/func/func-array.sgml b/doc/src/sgml/func/func-array.sgml
index 97e4865a5f7..7f162bd7670 100644
--- a/doc/src/sgml/func/func-array.sgml
+++ b/doc/src/sgml/func/func-array.sgml
@@ -624,7 +624,7 @@
in a query's FROM clause; see <xref linkend="queries-tablefunctions"/>.
</para>
<para>
- <literal>select * from unnest(ARRAY[1,2], ARRAY['foo','bar','baz']) as x(a,b)</literal>
+ <literal>SELECT * FROM unnest(ARRAY[1, 2], ARRAY['foo', 'bar', 'baz']) AS x(a, b)</literal>
<returnvalue></returnvalue>
<programlisting>
a | b
diff --git a/doc/src/sgml/func/func-binarystring.sgml b/doc/src/sgml/func/func-binarystring.sgml
index dd7037811af..b256381e01f 100644
--- a/doc/src/sgml/func/func-binarystring.sgml
+++ b/doc/src/sgml/func/func-binarystring.sgml
@@ -151,7 +151,7 @@
of <parameter>newsubstring</parameter>.
</para>
<para>
- <literal>overlay('\x1234567890'::bytea placing '\002\003'::bytea from 2 for 3)</literal>
+ <literal>overlay('\x1234567890'::bytea PLACING '\002\003'::bytea FROM 2 FOR 3)</literal>
<returnvalue>\x12020390</returnvalue>
</para></entry>
</row>
@@ -170,7 +170,7 @@
<parameter>bytes</parameter>, or zero if it's not present.
</para>
<para>
- <literal>position('\x5678'::bytea in '\x1234567890'::bytea)</literal>
+ <literal>position('\x5678'::bytea IN '\x1234567890'::bytea)</literal>
<returnvalue>3</returnvalue>
</para></entry>
</row>
@@ -211,7 +211,7 @@
and <parameter>count</parameter>.
</para>
<para>
- <literal>substring('\x1234567890'::bytea from 3 for 2)</literal>
+ <literal>substring('\x1234567890'::bytea FROM 3 FOR 2)</literal>
<returnvalue>\x5678</returnvalue>
</para></entry>
</row>
@@ -856,8 +856,8 @@
significant byte first. Some examples:
<programlisting>
1234::smallint::bytea <lineannotation>\x04d2</lineannotation>
-cast(1234 as bytea) <lineannotation>\x000004d2</lineannotation>
-cast(-1234 as bytea) <lineannotation>\xfffffb2e</lineannotation>
+cast(1234 AS bytea) <lineannotation>\x000004d2</lineannotation>
+cast(-1234 AS bytea) <lineannotation>\xfffffb2e</lineannotation>
'\x8000'::bytea::smallint <lineannotation>-32768</lineannotation>
'\x8000'::bytea::integer <lineannotation>32768</lineannotation>
</programlisting>
diff --git a/doc/src/sgml/func/func-bitstring.sgml b/doc/src/sgml/func/func-bitstring.sgml
index f03dd63afcc..3f59de464a4 100644
--- a/doc/src/sgml/func/func-bitstring.sgml
+++ b/doc/src/sgml/func/func-bitstring.sgml
@@ -251,7 +251,7 @@
of <parameter>newsubstring</parameter>.
</para>
<para>
- <literal>overlay(B'01010101010101010' placing B'11111' from 2 for 3)</literal>
+ <literal>overlay(B'01010101010101010' PLACING B'11111' FROM 2 FOR 3)</literal>
<returnvalue>0111110101010101010</returnvalue>
</para></entry>
</row>
@@ -269,7 +269,7 @@
within <parameter>bits</parameter>, or zero if it's not present.
</para>
<para>
- <literal>position(B'010' in B'000001101011')</literal>
+ <literal>position(B'010' IN B'000001101011')</literal>
<returnvalue>8</returnvalue>
</para></entry>
</row>
@@ -290,7 +290,7 @@
and <parameter>count</parameter>.
</para>
<para>
- <literal>substring(B'110010111111' from 3 for 2)</literal>
+ <literal>substring(B'110010111111' FROM 3 FOR 2)</literal>
<returnvalue>00</returnvalue>
</para></entry>
</row>
@@ -348,7 +348,7 @@
<programlisting>
44::bit(10) <lineannotation>0000101100</lineannotation>
44::bit(3) <lineannotation>100</lineannotation>
-cast(-44 as bit(12)) <lineannotation>111111010100</lineannotation>
+cast(-44 AS bit(12)) <lineannotation>111111010100</lineannotation>
'1110'::bit(4)::integer <lineannotation>14</lineannotation>
</programlisting>
Note that casting to just <quote>bit</quote> means casting to
diff --git a/doc/src/sgml/func/func-datetime.sgml b/doc/src/sgml/func/func-datetime.sgml
index 8cd7150b0d3..39dddde4fe1 100644
--- a/doc/src/sgml/func/func-datetime.sgml
+++ b/doc/src/sgml/func/func-datetime.sgml
@@ -602,28 +602,28 @@
<indexterm>
<primary>extract</primary>
</indexterm>
- <function>extract</function> ( <parameter>field</parameter> <literal>from</literal> <type>timestamp</type> )
+ <function>extract</function> ( <parameter>field</parameter> <literal>FROM</literal> <type>timestamp</type> )
<returnvalue>numeric</returnvalue>
</para>
<para>
Get timestamp subfield; see <xref linkend="functions-datetime-extract"/>
</para>
<para>
- <literal>extract(hour from timestamp '2001-02-16 20:38:40')</literal>
+ <literal>extract(hour FROM timestamp '2001-02-16 20:38:40')</literal>
<returnvalue>20</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
- <function>extract</function> ( <parameter>field</parameter> <literal>from</literal> <type>interval</type> )
+ <function>extract</function> ( <parameter>field</parameter> <literal>FROM</literal> <type>interval</type> )
<returnvalue>numeric</returnvalue>
</para>
<para>
Get interval subfield; see <xref linkend="functions-datetime-extract"/>
</para>
<para>
- <literal>extract(month from interval '2 years 3 months')</literal>
+ <literal>extract(month FROM interval '2 years 3 months')</literal>
<returnvalue>3</returnvalue>
</para></entry>
</row>
@@ -1849,7 +1849,7 @@ SELECT date_bin('15 minutes', TIMESTAMP '2020-02-11 15:44:17', TIMESTAMP '2001-0
value is in the named time zone.
</para>
<para>
- <literal>timestamp '2001-02-16 20:38:40' at time zone 'America/Denver'</literal>
+ <literal>timestamp '2001-02-16 20:38:40' AT TIME ZONE 'America/Denver'</literal>
<returnvalue>2001-02-17 03:38:40+00</returnvalue>
</para></entry>
</row>
@@ -1881,7 +1881,7 @@ SELECT date_bin('15 minutes', TIMESTAMP '2020-02-11 15:44:17', TIMESTAMP '2001-0
appear in that zone.
</para>
<para>
- <literal>timestamp with time zone '2001-02-16 20:38:40-05' at time zone 'America/Denver'</literal>
+ <literal>timestamp with time zone '2001-02-16 20:38:40-05' AT TIME ZONE 'America/Denver'</literal>
<returnvalue>2001-02-16 18:38:40</returnvalue>
</para></entry>
</row>
@@ -1913,7 +1913,7 @@ SELECT date_bin('15 minutes', TIMESTAMP '2020-02-11 15:44:17', TIMESTAMP '2001-0
offset for the named destination zone.
</para>
<para>
- <literal>time with time zone '05:34:17-05' at time zone 'UTC'</literal>
+ <literal>time with time zone '05:34:17-05' AT TIME ZONE 'UTC'</literal>
<returnvalue>10:34:17+00</returnvalue>
</para></entry>
</row>
diff --git a/doc/src/sgml/func/func-formatting.sgml b/doc/src/sgml/func/func-formatting.sgml
index df05e5c1676..af9e2223998 100644
--- a/doc/src/sgml/func/func-formatting.sgml
+++ b/doc/src/sgml/func/func-formatting.sgml
@@ -748,9 +748,9 @@
<listitem>
<para>
<function>to_char(..., 'ID')</function>'s day of the week numbering
- matches the <function>extract(isodow from ...)</function> function, but
+ matches the <function>extract(isodow FROM ...)</function> function, but
<function>to_char(..., 'D')</function>'s does not match
- <function>extract(dow from ...)</function>'s day numbering.
+ <function>extract(dow FROM ...)</function>'s day numbering.
</para>
</listitem>
diff --git a/doc/src/sgml/func/func-info.sgml b/doc/src/sgml/func/func-info.sgml
index c393832d94c..d4508114a48 100644
--- a/doc/src/sgml/func/func-info.sgml
+++ b/doc/src/sgml/func/func-info.sgml
@@ -1962,11 +1962,11 @@ SELECT currval(pg_get_serial_sequence('sometable', 'id'));
collatable data type, then an error is raised.
</para>
<para>
- <literal>collation for ('foo'::text)</literal>
+ <literal>COLLATION FOR ('foo'::text)</literal>
<returnvalue>"default"</returnvalue>
</para>
<para>
- <literal>collation for ('foo' COLLATE "de_DE")</literal>
+ <literal>COLLATION FOR ('foo' COLLATE "de_DE")</literal>
<returnvalue>"de_DE"</returnvalue>
</para></entry>
</row>
diff --git a/doc/src/sgml/func/func-json.sgml b/doc/src/sgml/func/func-json.sgml
index b9316ba0ee5..c529ddf1808 100644
--- a/doc/src/sgml/func/func-json.sgml
+++ b/doc/src/sgml/func/func-json.sgml
@@ -981,7 +981,7 @@ array w/o UK? | t
Expands the top-level JSON array into a set of JSON values.
</para>
<para>
- <literal>select * from json_array_elements('[1,true, [2,false]]')</literal>
+ <literal>SELECT * FROM json_array_elements('[1,true, [2,false]]')</literal>
<returnvalue></returnvalue>
<programlisting>
value
@@ -1012,7 +1012,7 @@ array w/o UK? | t
Expands the top-level JSON array into a set of <type>text</type> values.
</para>
<para>
- <literal>select * from json_array_elements_text('["foo", "bar"]')</literal>
+ <literal>SELECT * FROM json_array_elements_text('["foo", "bar"]')</literal>
<returnvalue></returnvalue>
<programlisting>
value
@@ -1074,7 +1074,7 @@ array w/o UK? | t
Expands the top-level JSON object into a set of key/value pairs.
</para>
<para>
- <literal>select * from json_each('{"a":"foo", "b":"bar"}')</literal>
+ <literal>SELECT * FROM json_each('{"a":"foo", "b":"bar"}')</literal>
<returnvalue></returnvalue>
<programlisting>
key | value
@@ -1110,7 +1110,7 @@ array w/o UK? | t
type <type>text</type>.
</para>
<para>
- <literal>select * from json_each_text('{"a":"foo", "b":"bar"}')</literal>
+ <literal>SELECT * FROM json_each_text('{"a":"foo", "b":"bar"}')</literal>
<returnvalue></returnvalue>
<programlisting>
key | value
@@ -1193,7 +1193,7 @@ array w/o UK? | t
Returns the set of keys in the top-level JSON object.
</para>
<para>
- <literal>select * from json_object_keys('{"f1":"abc","f2":{"f3":"a", "f4":"b"}}')</literal>
+ <literal>SELECT * FROM json_object_keys('{"f1":"abc","f2":{"f3":"a", "f4":"b"}}')</literal>
<returnvalue></returnvalue>
<programlisting>
json_object_keys
@@ -1286,11 +1286,11 @@ array w/o UK? | t
calls.
</para>
<para>
- <literal>create type subrowtype as (d int, e text);</literal>
- <literal>create type myrowtype as (a int, b text[], c subrowtype);</literal>
+ <literal>CREATE TYPE subrowtype AS (d int, e text);</literal>
+ <literal>CREATE TYPE myrowtype AS (a int, b text[], c subrowtype);</literal>
</para>
<para>
- <literal>select * from json_populate_record(null::myrowtype,
+ <literal>SELECT * FROM json_populate_record(NULL::myrowtype,
'{"a": 1, "b": ["2", "a b"], "c": {"d": 4, "e": "a b c"}, "x": "foo"}')</literal>
<returnvalue></returnvalue>
<programlisting>
@@ -1316,10 +1316,10 @@ array w/o UK? | t
valid input, <literal>false</literal> otherwise.
</para>
<para>
- <literal>create type jsb_char2 as (a char(2));</literal>
+ <literal>CREATE TYPE jsb_char2 AS (a char(2));</literal>
</para>
<para>
- <literal>select jsonb_populate_record_valid(NULL::jsb_char2, '{"a": "aaa"}');</literal>
+ <literal>SELECT jsonb_populate_record_valid(NULL::jsb_char2, '{"a": "aaa"}');</literal>
<returnvalue></returnvalue>
<programlisting>
jsonb_populate_record_valid
@@ -1328,12 +1328,12 @@ array w/o UK? | t
(1 row)
</programlisting>
- <literal>select * from jsonb_populate_record(NULL::jsb_char2, '{"a": "aaa"}') q;</literal>
+ <literal>SELECT * FROM jsonb_populate_record(NULL::jsb_char2, '{"a": "aaa"}') q;</literal>
<returnvalue></returnvalue>
<programlisting>
ERROR: value too long for type character(2)
</programlisting>
- <literal>select jsonb_populate_record_valid(NULL::jsb_char2, '{"a": "aa"}');</literal>
+ <literal>SELECT jsonb_populate_record_valid(NULL::jsb_char2, '{"a": "aa"}');</literal>
<returnvalue></returnvalue>
<programlisting>
jsonb_populate_record_valid
@@ -1342,7 +1342,7 @@ ERROR: value too long for type character(2)
(1 row)
</programlisting>
- <literal>select * from jsonb_populate_record(NULL::jsb_char2, '{"a": "aa"}') q;</literal>
+ <literal>SELECT * FROM jsonb_populate_record(NULL::jsb_char2, '{"a": "aa"}') q;</literal>
<returnvalue></returnvalue>
<programlisting>
a
@@ -1375,10 +1375,10 @@ ERROR: value too long for type character(2)
for <function>json[b]_populate_record</function>.
</para>
<para>
- <literal>create type twoints as (a int, b int);</literal>
+ <literal>CREATE TYPE twoints AS (a int, b int);</literal>
</para>
<para>
- <literal>select * from json_populate_recordset(null::twoints, '[{"a":1,"b":2}, {"a":3,"b":4}]')</literal>
+ <literal>SELECT * FROM json_populate_recordset(NULL::twoints, '[{"a":1,"b":2}, {"a":3,"b":4}]')</literal>
<returnvalue></returnvalue>
<programlisting>
a | b
@@ -1415,10 +1415,10 @@ ERROR: value too long for type character(2)
input record value, unmatched columns are always filled with nulls.
</para>
<para>
- <literal>create type myrowtype as (a int, b text);</literal>
+ <literal>CREATE TYPE myrowtype AS (a int, b text);</literal>
</para>
<para>
- <literal>select * from json_to_record('{"a":1,"b":[1,2,3],"c":[1,2,3],"e":"bar","r": {"a": 123, "b": "a b c"}}') as x(a int, b text, c int[], d text, r myrowtype)</literal>
+ <literal>SELECT * FROM json_to_record('{"a":1,"b":[1,2,3],"c":[1,2,3],"e":"bar","r": {"a": 123, "b": "a b c"}}') AS x(a int, b text, c int[], d text, r myrowtype)</literal>
<returnvalue></returnvalue>
<programlisting>
a | b | c | d | r
@@ -1453,7 +1453,7 @@ ERROR: value too long for type character(2)
for <function>json[b]_populate_record</function>.
</para>
<para>
- <literal>select * from json_to_recordset('[{"a":1,"b":"foo"}, {"a":"2","c":"bar"}]') as x(a int, b text)</literal>
+ <literal>SELECT * FROM json_to_recordset('[{"a":1,"b":"foo"}, {"a":"2","c":"bar"}]') AS x(a int, b text)</literal>
<returnvalue></returnvalue>
<programlisting>
a | b
@@ -1674,7 +1674,7 @@ ERROR: value too long for type character(2)
for <function>jsonb_path_exists</function>.
</para>
<para>
- <literal>select * from jsonb_path_query('{"a":[1,2,3,4,5]}', '$.a[*] ? (@ >= $min &amp;&amp; @ &lt;= $max)', '{"min":2, "max":4}')</literal>
+ <literal>SELECT * FROM jsonb_path_query('{"a":[1,2,3,4,5]}', '$.a[*] ? (@ >= $min &amp;&amp; @ &lt;= $max)', '{"min":2, "max":4}')</literal>
<returnvalue></returnvalue>
<programlisting>
jsonb_path_query
@@ -1932,7 +1932,7 @@ SELECT '{
<literal>.<replaceable>key</replaceable></literal> accessor
operator to descend through surrounding JSON objects, for example:
<screen>
-<prompt>=&gt;</prompt> <userinput>select jsonb_path_query(:'json', '$.track.segments');</userinput>
+<prompt>=&gt;</prompt> <userinput>SELECT jsonb_path_query(:'json', '$.track.segments');</userinput>
jsonb_path_query
-----------------------------------------------------------&zwsp;-----------------------------------------------------------&zwsp;---------------------------------------------
[{"HR": 73, "location": [47.763, 13.4034], "start time": "2018-10-14 10:05:14"}, {"HR": 135, "location": [47.706, 13.2635], "start time": "2018-10-14 10:39:21"}]
@@ -1945,7 +1945,7 @@ SELECT '{
The following example will return the location coordinates for all
the available track segments:
<screen>
-<prompt>=&gt;</prompt> <userinput>select jsonb_path_query(:'json', '$.track.segments[*].location');</userinput>
+<prompt>=&gt;</prompt> <userinput>SELECT jsonb_path_query(:'json', '$.track.segments[*].location');</userinput>
jsonb_path_query
-------------------
[47.763, 13.4034]
@@ -1971,7 +1971,7 @@ SELECT '{
specify the corresponding subscript in the <literal>[]</literal>
accessor operator. Recall that JSON array indexes are 0-relative:
<screen>
-<prompt>=&gt;</prompt> <userinput>select jsonb_path_query(:'json', '$.track.segments[0].location');</userinput>
+<prompt>=&gt;</prompt> <userinput>SELECT jsonb_path_query(:'json', '$.track.segments[0].location');</userinput>
jsonb_path_query
-------------------
[47.763, 13.4034]
@@ -1985,7 +1985,7 @@ SELECT '{
Each method name must be preceded by a dot. For example,
you can get the size of an array:
<screen>
-<prompt>=&gt;</prompt> <userinput>select jsonb_path_query(:'json', '$.track.segments.size()');</userinput>
+<prompt>=&gt;</prompt> <userinput>SELECT jsonb_path_query(:'json', '$.track.segments.size()');</userinput>
jsonb_path_query
------------------
2
@@ -2014,7 +2014,7 @@ SELECT '{
produce <literal>true</literal>, <literal>false</literal>,
or <literal>unknown</literal>. The <literal>unknown</literal> value
plays the same role as SQL <literal>NULL</literal> and can be tested
- for with the <literal>is unknown</literal> predicate. Further path
+ for with the <literal>IS UNKNOWN</literal> predicate. Further path
evaluation steps use only those items for which the filter expression
returned <literal>true</literal>.
</para>
@@ -2032,7 +2032,7 @@ SELECT '{
For example, suppose you would like to retrieve all heart rate values higher
than 130. You can achieve this as follows:
<screen>
-<prompt>=&gt;</prompt> <userinput>select jsonb_path_query(:'json', '$.track.segments[*].HR ? (@ &gt; 130)');</userinput>
+<prompt>=&gt;</prompt> <userinput>SELECT jsonb_path_query(:'json', '$.track.segments[*].HR ? (@ &gt; 130)');</userinput>
jsonb_path_query
------------------
135
@@ -2045,7 +2045,7 @@ SELECT '{
filter expression is applied to the previous step, and the path used
in the condition is different:
<screen>
-<prompt>=&gt;</prompt> <userinput>select jsonb_path_query(:'json', '$.track.segments[*] ? (@.HR &gt; 130)."start time"');</userinput>
+<prompt>=&gt;</prompt> <userinput>SELECT jsonb_path_query(:'json', '$.track.segments[*] ? (@.HR &gt; 130)."start time"');</userinput>
jsonb_path_query
-----------------------
"2018-10-14 10:39:21"
@@ -2057,7 +2057,7 @@ SELECT '{
The following example selects start times of all segments that
contain locations with relevant coordinates and high heart rate values:
<screen>
-<prompt>=&gt;</prompt> <userinput>select jsonb_path_query(:'json', '$.track.segments[*] ? (@.location[1] &lt; 13.4) ? (@.HR &gt; 130)."start time"');</userinput>
+<prompt>=&gt;</prompt> <userinput>SELECT jsonb_path_query(:'json', '$.track.segments[*] ? (@.location[1] &lt; 13.4) ? (@.HR &gt; 130)."start time"');</userinput>
jsonb_path_query
-----------------------
"2018-10-14 10:39:21"
@@ -2069,7 +2069,7 @@ SELECT '{
The following example first filters all segments by location, and then
returns high heart rate values for these segments, if available:
<screen>
-<prompt>=&gt;</prompt> <userinput>select jsonb_path_query(:'json', '$.track.segments[*] ? (@.location[1] &lt; 13.4).HR ? (@ &gt; 130)');</userinput>
+<prompt>=&gt;</prompt> <userinput>SELECT jsonb_path_query(:'json', '$.track.segments[*] ? (@.location[1] &lt; 13.4).HR ? (@ &gt; 130)');</userinput>
jsonb_path_query
------------------
135
@@ -2081,7 +2081,7 @@ SELECT '{
This example returns the size of the track if it contains any
segments with high heart rate values, or an empty sequence otherwise:
<screen>
-<prompt>=&gt;</prompt> <userinput>select jsonb_path_query(:'json', '$.track ? (exists(@.segments[*] ? (@.HR &gt; 130))).segments.size()');</userinput>
+<prompt>=&gt;</prompt> <userinput>SELECT jsonb_path_query(:'json', '$.track ? (exists(@.segments[*] ? (@.HR &gt; 130))).segments.size()');</userinput>
jsonb_path_query
------------------
2
@@ -2108,7 +2108,7 @@ SELECT '{
<literal>false</literal>, or <literal>null</literal>.
For example, we could write this SQL-standard filter expression:
<screen>
-<prompt>=&gt;</prompt> <userinput>select jsonb_path_query(:'json', '$.track.segments ?(@[*].HR &gt; 130)');</userinput>
+<prompt>=&gt;</prompt> <userinput>SELECT jsonb_path_query(:'json', '$.track.segments ?(@[*].HR &gt; 130)');</userinput>
jsonb_path_query
-----------------------------------------------------------&zwsp;----------------------
{"HR": 135, "location": [47.706, 13.2635], "start time": "2018-10-14 10:39:21"}
@@ -2116,7 +2116,7 @@ SELECT '{
The similar predicate check expression simply
returns <literal>true</literal>, indicating that a match exists:
<screen>
-<prompt>=&gt;</prompt> <userinput>select jsonb_path_query(:'json', '$.track.segments[*].HR &gt; 130');</userinput>
+<prompt>=&gt;</prompt> <userinput>SELECT jsonb_path_query(:'json', '$.track.segments[*].HR &gt; 130');</userinput>
jsonb_path_query
------------------
true
@@ -2204,7 +2204,7 @@ SELECT '{
abstract from the fact that it stores an array of segments
when using lax mode:
<screen>
-<prompt>=&gt;</prompt> <userinput>select jsonb_path_query(:'json', 'lax $.track.segments.location');</userinput>
+<prompt>=&gt;</prompt> <userinput>SELECT jsonb_path_query(:'json', 'lax $.track.segments.location');</userinput>
jsonb_path_query
-------------------
[47.763, 13.4034]
@@ -2217,13 +2217,13 @@ SELECT '{
the queried JSON document, so using this path
expression will cause an error:
<screen>
-<prompt>=&gt;</prompt> <userinput>select jsonb_path_query(:'json', 'strict $.track.segments.location');</userinput>
+<prompt>=&gt;</prompt> <userinput>SELECT jsonb_path_query(:'json', 'strict $.track.segments.location');</userinput>
ERROR: jsonpath member accessor can only be applied to an object
</screen>
To get the same result as in lax mode, you have to explicitly unwrap the
<literal>segments</literal> array:
<screen>
-<prompt>=&gt;</prompt> <userinput>select jsonb_path_query(:'json', 'strict $.track.segments[*].location');</userinput>
+<prompt>=&gt;</prompt> <userinput>SELECT jsonb_path_query(:'json', 'strict $.track.segments[*].location');</userinput>
jsonb_path_query
-------------------
[47.763, 13.4034]
@@ -2236,7 +2236,7 @@ ERROR: jsonpath member accessor can only be applied to an object
instance, the following query using the <literal>.**</literal> accessor
selects every <literal>HR</literal> value twice:
<screen>
-<prompt>=&gt;</prompt> <userinput>select jsonb_path_query(:'json', 'lax $.**.HR');</userinput>
+<prompt>=&gt;</prompt> <userinput>SELECT jsonb_path_query(:'json', 'lax $.**.HR');</userinput>
jsonb_path_query
------------------
73
@@ -2251,7 +2251,7 @@ ERROR: jsonpath member accessor can only be applied to an object
the <literal>.**</literal> accessor only in strict mode. The
following query selects each <literal>HR</literal> value just once:
<screen>
-<prompt>=&gt;</prompt> <userinput>select jsonb_path_query(:'json', 'strict $.**.HR');</userinput>
+<prompt>=&gt;</prompt> <userinput>SELECT jsonb_path_query(:'json', 'strict $.**.HR');</userinput>
jsonb_path_query
------------------
73
@@ -2263,7 +2263,7 @@ ERROR: jsonpath member accessor can only be applied to an object
The unwrapping of arrays can also lead to unexpected results. Consider this
example, which selects all the <literal>location</literal> arrays:
<screen>
-<prompt>=&gt;</prompt> <userinput>select jsonb_path_query(:'json', 'lax $.track.segments[*].location');</userinput>
+<prompt>=&gt;</prompt> <userinput>SELECT jsonb_path_query(:'json', 'lax $.track.segments[*].location');</userinput>
jsonb_path_query
-------------------
[47.763, 13.4034]
@@ -2274,7 +2274,7 @@ ERROR: jsonpath member accessor can only be applied to an object
causes the arrays to be unwrapped to evaluate each item, returning only the
items that match the expression:
<screen>
-<prompt>=&gt;</prompt> <userinput>select jsonb_path_query(:'json', 'lax $.track.segments[*].location ?(@[*] &gt; 15)');</userinput>
+<prompt>=&gt;</prompt> <userinput>SELECT jsonb_path_query(:'json', 'lax $.track.segments[*].location ?(@[*] &gt; 15)');</userinput>
jsonb_path_query
------------------
47.763
@@ -2284,7 +2284,7 @@ ERROR: jsonpath member accessor can only be applied to an object
This despite the fact that the full arrays are selected by the path
expression. Use strict mode to restore selecting the arrays:
<screen>
-<prompt>=&gt;</prompt> <userinput>select jsonb_path_query(:'json', 'strict $.track.segments[*].location ?(@[*] &gt; 15)');</userinput>
+<prompt>=&gt;</prompt> <userinput>SELECT jsonb_path_query(:'json', 'strict $.track.segments[*].location ?(@[*] &gt; 15)');</userinput>
jsonb_path_query
-------------------
[47.763, 13.4034]
@@ -3423,7 +3423,7 @@ DETAIL: Missing "]" after array dimensions.
<returnvalue>2015-02-01</returnvalue>
</para>
<para>
- <literal>JSON_VALUE(jsonb '[1,2]', 'strict $[$off]' PASSING 1 as off)</literal>
+ <literal>JSON_VALUE(jsonb '[1,2]', 'strict $[$off]' PASSING 1 AS off)</literal>
<returnvalue>2</returnvalue>
</para>
<para>
diff --git a/doc/src/sgml/func/func-matching.sgml b/doc/src/sgml/func/func-matching.sgml
index ebe0b22c8f6..91a0b7ca0de 100644
--- a/doc/src/sgml/func/func-matching.sgml
+++ b/doc/src/sgml/func/func-matching.sgml
@@ -412,8 +412,8 @@ substring(<replaceable>string</replaceable>, <replaceable>pattern</replaceable>,
<para>
Some examples, with <literal>#&quot;</literal> delimiting the return string:
<programlisting>
-substring('foobar' similar '%#"o_b#"%' escape '#') <lineannotation>oob</lineannotation>
-substring('foobar' similar '#"o_b#"%' escape '#') <lineannotation>NULL</lineannotation>
+substring('foobar' SIMILAR '%#"o_b#"%' ESCAPE '#') <lineannotation>oob</lineannotation>
+substring('foobar' SIMILAR '#"o_b#"%' ESCAPE '#') <lineannotation>NULL</lineannotation>
</programlisting>
</para>
</sect2>
@@ -600,8 +600,8 @@ substring('foobar' similar '#"o_b#"%' escape '#') <lineannotation>NULL</linea
<para>
Some examples:
<programlisting>
-substring('foobar' from 'o.b') <lineannotation>oob</lineannotation>
-substring('foobar' from 'o(.)b') <lineannotation>o</lineannotation>
+substring('foobar' FROM 'o.b') <lineannotation>oob</lineannotation>
+substring('foobar' FROM 'o(.)b') <lineannotation>o</lineannotation>
</programlisting>
</para>
diff --git a/doc/src/sgml/func/func-srf.sgml b/doc/src/sgml/func/func-srf.sgml
index eafc961c9f9..34a45971aad 100644
--- a/doc/src/sgml/func/func-srf.sgml
+++ b/doc/src/sgml/func/func-srf.sgml
@@ -247,8 +247,8 @@ FROM (SELECT generate_subscripts(a, 1) AS s, a FROM arrays) foo;
-- unnest a 2D array:
CREATE OR REPLACE FUNCTION unnest2(anyarray)
RETURNS SETOF anyelement AS $$
-select $1[i][j]
- from generate_subscripts($1,1) g1(i),
+SELECT $1[i][j]
+ FROM generate_subscripts($1,1) g1(i),
generate_subscripts($1,2) g2(j);
$$ LANGUAGE sql IMMUTABLE;
CREATE FUNCTION
diff --git a/doc/src/sgml/func/func-string.sgml b/doc/src/sgml/func/func-string.sgml
index 01cc94c234e..7ad1436e5f8 100644
--- a/doc/src/sgml/func/func-string.sgml
+++ b/doc/src/sgml/func/func-string.sgml
@@ -328,7 +328,7 @@
of <parameter>newsubstring</parameter>.
</para>
<para>
- <literal>overlay('Txxxxas' placing 'hom' from 2 for 4)</literal>
+ <literal>overlay('Txxxxas' PLACING 'hom' FROM 2 FOR 4)</literal>
<returnvalue>Thomas</returnvalue>
</para></entry>
</row>
@@ -347,7 +347,7 @@
<parameter>string</parameter>, or zero if it's not present.
</para>
<para>
- <literal>position('om' in 'Thomas')</literal>
+ <literal>position('om' IN 'Thomas')</literal>
<returnvalue>3</returnvalue>
</para></entry>
</row>
@@ -411,15 +411,15 @@
and <parameter>count</parameter>.
</para>
<para>
- <literal>substring('Thomas' from 2 for 3)</literal>
+ <literal>substring('Thomas' FROM 2 FOR 3)</literal>
<returnvalue>hom</returnvalue>
</para>
<para>
- <literal>substring('Thomas' from 3)</literal>
+ <literal>substring('Thomas' FROM 3)</literal>
<returnvalue>omas</returnvalue>
</para>
<para>
- <literal>substring('Thomas' for 2)</literal>
+ <literal>substring('Thomas' FOR 2)</literal>
<returnvalue>Th</returnvalue>
</para></entry>
</row>
@@ -434,7 +434,7 @@
<xref linkend="functions-posix-regexp"/>.
</para>
<para>
- <literal>substring('Thomas' from '...$')</literal>
+ <literal>substring('Thomas' FROM '...$')</literal>
<returnvalue>mas</returnvalue>
</para></entry>
</row>
@@ -455,7 +455,7 @@
and should be considered obsolete.
</para>
<para>
- <literal>substring('Thomas' similar '%#"o_a#"_' escape '#')</literal>
+ <literal>substring('Thomas' SIMILAR '%#"o_a#"_' ESCAPE '#')</literal>
<returnvalue>oma</returnvalue>
</para></entry>
</row>
diff --git a/doc/src/sgml/func/func-textsearch.sgml b/doc/src/sgml/func/func-textsearch.sgml
index a06a58f1498..290ad81d697 100644
--- a/doc/src/sgml/func/func-textsearch.sgml
+++ b/doc/src/sgml/func/func-textsearch.sgml
@@ -835,7 +835,7 @@
Expands a <type>tsvector</type> into a set of rows, one per lexeme.
</para>
<para>
- <literal>select * from unnest('cat:3 fat:2,4 rat:5A'::tsvector)</literal>
+ <literal>SELECT * FROM unnest('cat:3 fat:2,4 rat:5A'::tsvector)</literal>
<returnvalue></returnvalue>
<programlisting>
lexeme | positions | weights
diff --git a/doc/src/sgml/func/func-xml.sgml b/doc/src/sgml/func/func-xml.sgml
index 21f34467a4f..511bc90852a 100644
--- a/doc/src/sgml/func/func-xml.sgml
+++ b/doc/src/sgml/func/func-xml.sgml
@@ -177,19 +177,19 @@ SELECT xmlconcat('<?xml version="1.1"?><foo/>', '<?xml version="1.1" standalone=
<para>
Examples:
<screen><![CDATA[
-SELECT xmlelement(name foo);
+SELECT xmlelement(NAME foo);
xmlelement
------------
<foo/>
-SELECT xmlelement(name foo, xmlattributes('xyz' as bar));
+SELECT xmlelement(NAME foo, xmlattributes('xyz' AS bar));
xmlelement
------------------
<foo bar="xyz"/>
-SELECT xmlelement(name foo, xmlattributes(current_date as bar), 'cont', 'ent');
+SELECT xmlelement(NAME foo, xmlattributes(current_date AS bar), 'cont', 'ent');
xmlelement
-------------------------------------
@@ -204,7 +204,7 @@ SELECT xmlelement(name foo, xmlattributes(current_date as bar), 'cont', 'ent');
<replaceable>HHHH</replaceable> is the character's Unicode
codepoint in hexadecimal notation. For example:
<screen><![CDATA[
-SELECT xmlelement(name "foo$bar", xmlattributes('xyz' as "a&b"));
+SELECT xmlelement(NAME "foo$bar", xmlattributes('xyz' AS "a&b"));
xmlelement
----------------------------------
@@ -220,12 +220,12 @@ SELECT xmlelement(name "foo$bar", xmlattributes('xyz' as "a&b"));
valid:
<screen>
CREATE TABLE test (a xml, b xml);
-SELECT xmlelement(name test, xmlattributes(a, b)) FROM test;
+SELECT xmlelement(NAME test, xmlattributes(a, b)) FROM test;
</screen>
But these are not:
<screen>
-SELECT xmlelement(name test, xmlattributes('constant'), a, b) FROM test;
-SELECT xmlelement(name test, xmlattributes(func(a, b))) FROM test;
+SELECT xmlelement(NAME test, xmlattributes('constant'), a, b) FROM test;
+SELECT xmlelement(NAME test, xmlattributes(func(a, b))) FROM test;
</screen>
</para>
@@ -234,10 +234,10 @@ SELECT xmlelement(name test, xmlattributes(func(a, b))) FROM test;
its data type. If the content is itself of type <type>xml</type>,
complex XML documents can be constructed. For example:
<screen><![CDATA[
-SELECT xmlelement(name foo, xmlattributes('xyz' as bar),
- xmlelement(name abc),
+SELECT xmlelement(NAME foo, xmlattributes('xyz' AS bar),
+ xmlelement(NAME abc),
xmlcomment('test'),
- xmlelement(name xyz));
+ xmlelement(NAME xyz));
xmlelement
----------------------------------------------