From 49d43faa835f3c6817be9fc0b98bec0d661c2587 Mon Sep 17 00:00:00 2001 From: David Rowley Date: Thu, 6 Nov 2025 16:03:02 +1300 Subject: Doc: use uppercase keywords in SQLs Use uppercase SQL keywords consistently throughout the documentation to ease reading. Also add whitespace in a couple of places where it improves readability. Author: Erik Wienhold Reviewed-by: David Rowley Discussion: https://postgr.es/m/82eb512b-8ed2-46be-b311-54ffd26978c4%40ewie.name --- doc/src/sgml/func/func-array.sgml | 2 +- doc/src/sgml/func/func-binarystring.sgml | 10 ++-- doc/src/sgml/func/func-bitstring.sgml | 8 ++-- doc/src/sgml/func/func-datetime.sgml | 14 +++--- doc/src/sgml/func/func-formatting.sgml | 4 +- doc/src/sgml/func/func-info.sgml | 4 +- doc/src/sgml/func/func-json.sgml | 80 ++++++++++++++++---------------- doc/src/sgml/func/func-matching.sgml | 8 ++-- doc/src/sgml/func/func-srf.sgml | 4 +- doc/src/sgml/func/func-string.sgml | 14 +++--- doc/src/sgml/func/func-textsearch.sgml | 2 +- doc/src/sgml/func/func-xml.sgml | 20 ++++---- 12 files changed, 85 insertions(+), 85 deletions(-) (limited to 'doc/src/sgml/func') 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 . - select * from unnest(ARRAY[1,2], ARRAY['foo','bar','baz']) as x(a,b) + SELECT * FROM unnest(ARRAY[1, 2], ARRAY['foo', 'bar', 'baz']) AS x(a, b) 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 newsubstring. - overlay('\x1234567890'::bytea placing '\002\003'::bytea from 2 for 3) + overlay('\x1234567890'::bytea PLACING '\002\003'::bytea FROM 2 FOR 3) \x12020390 @@ -170,7 +170,7 @@ bytes, or zero if it's not present. - position('\x5678'::bytea in '\x1234567890'::bytea) + position('\x5678'::bytea IN '\x1234567890'::bytea) 3 @@ -211,7 +211,7 @@ and count. - substring('\x1234567890'::bytea from 3 for 2) + substring('\x1234567890'::bytea FROM 3 FOR 2) \x5678 @@ -856,8 +856,8 @@ significant byte first. Some examples: 1234::smallint::bytea \x04d2 -cast(1234 as bytea) \x000004d2 -cast(-1234 as bytea) \xfffffb2e +cast(1234 AS bytea) \x000004d2 +cast(-1234 AS bytea) \xfffffb2e '\x8000'::bytea::smallint -32768 '\x8000'::bytea::integer 32768 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 newsubstring. - overlay(B'01010101010101010' placing B'11111' from 2 for 3) + overlay(B'01010101010101010' PLACING B'11111' FROM 2 FOR 3) 0111110101010101010 @@ -269,7 +269,7 @@ within bits, or zero if it's not present. - position(B'010' in B'000001101011') + position(B'010' IN B'000001101011') 8 @@ -290,7 +290,7 @@ and count. - substring(B'110010111111' from 3 for 2) + substring(B'110010111111' FROM 3 FOR 2) 00 @@ -348,7 +348,7 @@ 44::bit(10) 0000101100 44::bit(3) 100 -cast(-44 as bit(12)) 111111010100 +cast(-44 AS bit(12)) 111111010100 '1110'::bit(4)::integer 14 Note that casting to just bit 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 @@ extract - extract ( field from timestamp ) + extract ( field FROM timestamp ) numeric Get timestamp subfield; see - extract(hour from timestamp '2001-02-16 20:38:40') + extract(hour FROM timestamp '2001-02-16 20:38:40') 20 - extract ( field from interval ) + extract ( field FROM interval ) numeric Get interval subfield; see - extract(month from interval '2 years 3 months') + extract(month FROM interval '2 years 3 months') 3 @@ -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. - timestamp '2001-02-16 20:38:40' at time zone 'America/Denver' + timestamp '2001-02-16 20:38:40' AT TIME ZONE 'America/Denver' 2001-02-17 03:38:40+00 @@ -1881,7 +1881,7 @@ SELECT date_bin('15 minutes', TIMESTAMP '2020-02-11 15:44:17', TIMESTAMP '2001-0 appear in that zone. - timestamp with time zone '2001-02-16 20:38:40-05' at time zone 'America/Denver' + timestamp with time zone '2001-02-16 20:38:40-05' AT TIME ZONE 'America/Denver' 2001-02-16 18:38:40 @@ -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. - time with time zone '05:34:17-05' at time zone 'UTC' + time with time zone '05:34:17-05' AT TIME ZONE 'UTC' 10:34:17+00 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 @@ to_char(..., 'ID')'s day of the week numbering - matches the extract(isodow from ...) function, but + matches the extract(isodow FROM ...) function, but to_char(..., 'D')'s does not match - extract(dow from ...)'s day numbering. + extract(dow FROM ...)'s day numbering. 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. - collation for ('foo'::text) + COLLATION FOR ('foo'::text) "default" - collation for ('foo' COLLATE "de_DE") + COLLATION FOR ('foo' COLLATE "de_DE") "de_DE" 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. - select * from json_array_elements('[1,true, [2,false]]') + SELECT * FROM json_array_elements('[1,true, [2,false]]') value @@ -1012,7 +1012,7 @@ array w/o UK? | t Expands the top-level JSON array into a set of text values. - select * from json_array_elements_text('["foo", "bar"]') + SELECT * FROM json_array_elements_text('["foo", "bar"]') value @@ -1074,7 +1074,7 @@ array w/o UK? | t Expands the top-level JSON object into a set of key/value pairs. - select * from json_each('{"a":"foo", "b":"bar"}') + SELECT * FROM json_each('{"a":"foo", "b":"bar"}') key | value @@ -1110,7 +1110,7 @@ array w/o UK? | t type text. - select * from json_each_text('{"a":"foo", "b":"bar"}') + SELECT * FROM json_each_text('{"a":"foo", "b":"bar"}') key | value @@ -1193,7 +1193,7 @@ array w/o UK? | t Returns the set of keys in the top-level JSON object. - select * from json_object_keys('{"f1":"abc","f2":{"f3":"a", "f4":"b"}}') + SELECT * FROM json_object_keys('{"f1":"abc","f2":{"f3":"a", "f4":"b"}}') json_object_keys @@ -1286,11 +1286,11 @@ array w/o UK? | t calls. - create type subrowtype as (d int, e text); - create type myrowtype as (a int, b text[], c subrowtype); + CREATE TYPE subrowtype AS (d int, e text); + CREATE TYPE myrowtype AS (a int, b text[], c subrowtype); - select * from json_populate_record(null::myrowtype, + SELECT * FROM json_populate_record(NULL::myrowtype, '{"a": 1, "b": ["2", "a b"], "c": {"d": 4, "e": "a b c"}, "x": "foo"}') @@ -1316,10 +1316,10 @@ array w/o UK? | t valid input, false otherwise. - create type jsb_char2 as (a char(2)); + CREATE TYPE jsb_char2 AS (a char(2)); - select jsonb_populate_record_valid(NULL::jsb_char2, '{"a": "aaa"}'); + SELECT jsonb_populate_record_valid(NULL::jsb_char2, '{"a": "aaa"}'); jsonb_populate_record_valid @@ -1328,12 +1328,12 @@ array w/o UK? | t (1 row) - select * from jsonb_populate_record(NULL::jsb_char2, '{"a": "aaa"}') q; + SELECT * FROM jsonb_populate_record(NULL::jsb_char2, '{"a": "aaa"}') q; ERROR: value too long for type character(2) - select jsonb_populate_record_valid(NULL::jsb_char2, '{"a": "aa"}'); + SELECT jsonb_populate_record_valid(NULL::jsb_char2, '{"a": "aa"}'); jsonb_populate_record_valid @@ -1342,7 +1342,7 @@ ERROR: value too long for type character(2) (1 row) - select * from jsonb_populate_record(NULL::jsb_char2, '{"a": "aa"}') q; + SELECT * FROM jsonb_populate_record(NULL::jsb_char2, '{"a": "aa"}') q; a @@ -1375,10 +1375,10 @@ ERROR: value too long for type character(2) for json[b]_populate_record. - create type twoints as (a int, b int); + CREATE TYPE twoints AS (a int, b int); - select * from json_populate_recordset(null::twoints, '[{"a":1,"b":2}, {"a":3,"b":4}]') + SELECT * FROM json_populate_recordset(NULL::twoints, '[{"a":1,"b":2}, {"a":3,"b":4}]') a | b @@ -1415,10 +1415,10 @@ ERROR: value too long for type character(2) input record value, unmatched columns are always filled with nulls. - create type myrowtype as (a int, b text); + CREATE TYPE myrowtype AS (a int, b text); - 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) + 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) a | b | c | d | r @@ -1453,7 +1453,7 @@ ERROR: value too long for type character(2) for json[b]_populate_record. - select * from json_to_recordset('[{"a":1,"b":"foo"}, {"a":"2","c":"bar"}]') as x(a int, b text) + SELECT * FROM json_to_recordset('[{"a":1,"b":"foo"}, {"a":"2","c":"bar"}]') AS x(a int, b text) a | b @@ -1674,7 +1674,7 @@ ERROR: value too long for type character(2) for jsonb_path_exists. - select * from jsonb_path_query('{"a":[1,2,3,4,5]}', '$.a[*] ? (@ >= $min && @ <= $max)', '{"min":2, "max":4}') + SELECT * FROM jsonb_path_query('{"a":[1,2,3,4,5]}', '$.a[*] ? (@ >= $min && @ <= $max)', '{"min":2, "max":4}') jsonb_path_query @@ -1932,7 +1932,7 @@ SELECT '{ .key accessor operator to descend through surrounding JSON objects, for example: -=> select jsonb_path_query(:'json', '$.track.segments'); +=> SELECT jsonb_path_query(:'json', '$.track.segments'); 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: -=> select jsonb_path_query(:'json', '$.track.segments[*].location'); +=> SELECT jsonb_path_query(:'json', '$.track.segments[*].location'); jsonb_path_query ------------------- [47.763, 13.4034] @@ -1971,7 +1971,7 @@ SELECT '{ specify the corresponding subscript in the [] accessor operator. Recall that JSON array indexes are 0-relative: -=> select jsonb_path_query(:'json', '$.track.segments[0].location'); +=> SELECT jsonb_path_query(:'json', '$.track.segments[0].location'); 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: -=> select jsonb_path_query(:'json', '$.track.segments.size()'); +=> SELECT jsonb_path_query(:'json', '$.track.segments.size()'); jsonb_path_query ------------------ 2 @@ -2014,7 +2014,7 @@ SELECT '{ produce true, false, or unknown. The unknown value plays the same role as SQL NULL and can be tested - for with the is unknown predicate. Further path + for with the IS UNKNOWN predicate. Further path evaluation steps use only those items for which the filter expression returned true. @@ -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: -=> select jsonb_path_query(:'json', '$.track.segments[*].HR ? (@ > 130)'); +=> SELECT jsonb_path_query(:'json', '$.track.segments[*].HR ? (@ > 130)'); 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: -=> select jsonb_path_query(:'json', '$.track.segments[*] ? (@.HR > 130)."start time"'); +=> SELECT jsonb_path_query(:'json', '$.track.segments[*] ? (@.HR > 130)."start time"'); 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: -=> select jsonb_path_query(:'json', '$.track.segments[*] ? (@.location[1] < 13.4) ? (@.HR > 130)."start time"'); +=> SELECT jsonb_path_query(:'json', '$.track.segments[*] ? (@.location[1] < 13.4) ? (@.HR > 130)."start time"'); 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: -=> select jsonb_path_query(:'json', '$.track.segments[*] ? (@.location[1] < 13.4).HR ? (@ > 130)'); +=> SELECT jsonb_path_query(:'json', '$.track.segments[*] ? (@.location[1] < 13.4).HR ? (@ > 130)'); 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: -=> select jsonb_path_query(:'json', '$.track ? (exists(@.segments[*] ? (@.HR > 130))).segments.size()'); +=> SELECT jsonb_path_query(:'json', '$.track ? (exists(@.segments[*] ? (@.HR > 130))).segments.size()'); jsonb_path_query ------------------ 2 @@ -2108,7 +2108,7 @@ SELECT '{ false, or null. For example, we could write this SQL-standard filter expression: -=> select jsonb_path_query(:'json', '$.track.segments ?(@[*].HR > 130)'); +=> SELECT jsonb_path_query(:'json', '$.track.segments ?(@[*].HR > 130)'); 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 true, indicating that a match exists: -=> select jsonb_path_query(:'json', '$.track.segments[*].HR > 130'); +=> SELECT jsonb_path_query(:'json', '$.track.segments[*].HR > 130'); jsonb_path_query ------------------ true @@ -2204,7 +2204,7 @@ SELECT '{ abstract from the fact that it stores an array of segments when using lax mode: -=> select jsonb_path_query(:'json', 'lax $.track.segments.location'); +=> SELECT jsonb_path_query(:'json', 'lax $.track.segments.location'); 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: -=> select jsonb_path_query(:'json', 'strict $.track.segments.location'); +=> SELECT jsonb_path_query(:'json', 'strict $.track.segments.location'); ERROR: jsonpath member accessor can only be applied to an object To get the same result as in lax mode, you have to explicitly unwrap the segments array: -=> select jsonb_path_query(:'json', 'strict $.track.segments[*].location'); +=> SELECT jsonb_path_query(:'json', 'strict $.track.segments[*].location'); 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 .** accessor selects every HR value twice: -=> select jsonb_path_query(:'json', 'lax $.**.HR'); +=> SELECT jsonb_path_query(:'json', 'lax $.**.HR'); jsonb_path_query ------------------ 73 @@ -2251,7 +2251,7 @@ ERROR: jsonpath member accessor can only be applied to an object the .** accessor only in strict mode. The following query selects each HR value just once: -=> select jsonb_path_query(:'json', 'strict $.**.HR'); +=> SELECT jsonb_path_query(:'json', 'strict $.**.HR'); 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 location arrays: -=> select jsonb_path_query(:'json', 'lax $.track.segments[*].location'); +=> SELECT jsonb_path_query(:'json', 'lax $.track.segments[*].location'); 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: -=> select jsonb_path_query(:'json', 'lax $.track.segments[*].location ?(@[*] > 15)'); +=> SELECT jsonb_path_query(:'json', 'lax $.track.segments[*].location ?(@[*] > 15)'); 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: -=> select jsonb_path_query(:'json', 'strict $.track.segments[*].location ?(@[*] > 15)'); +=> SELECT jsonb_path_query(:'json', 'strict $.track.segments[*].location ?(@[*] > 15)'); jsonb_path_query ------------------- [47.763, 13.4034] @@ -3423,7 +3423,7 @@ DETAIL: Missing "]" after array dimensions. 2015-02-01 - JSON_VALUE(jsonb '[1,2]', 'strict $[$off]' PASSING 1 as off) + JSON_VALUE(jsonb '[1,2]', 'strict $[$off]' PASSING 1 AS off) 2 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(string, pattern, Some examples, with #" delimiting the return string: -substring('foobar' similar '%#"o_b#"%' escape '#') oob -substring('foobar' similar '#"o_b#"%' escape '#') NULL +substring('foobar' SIMILAR '%#"o_b#"%' ESCAPE '#') oob +substring('foobar' SIMILAR '#"o_b#"%' ESCAPE '#') NULL @@ -600,8 +600,8 @@ substring('foobar' similar '#"o_b#"%' escape '#') NULL Some examples: -substring('foobar' from 'o.b') oob -substring('foobar' from 'o(.)b') o +substring('foobar' FROM 'o.b') oob +substring('foobar' FROM 'o(.)b') o 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 newsubstring. - overlay('Txxxxas' placing 'hom' from 2 for 4) + overlay('Txxxxas' PLACING 'hom' FROM 2 FOR 4) Thomas @@ -347,7 +347,7 @@ string, or zero if it's not present. - position('om' in 'Thomas') + position('om' IN 'Thomas') 3 @@ -411,15 +411,15 @@ and count. - substring('Thomas' from 2 for 3) + substring('Thomas' FROM 2 FOR 3) hom - substring('Thomas' from 3) + substring('Thomas' FROM 3) omas - substring('Thomas' for 2) + substring('Thomas' FOR 2) Th @@ -434,7 +434,7 @@ . - substring('Thomas' from '...$') + substring('Thomas' FROM '...$') mas @@ -455,7 +455,7 @@ and should be considered obsolete. - substring('Thomas' similar '%#"o_a#"_' escape '#') + substring('Thomas' SIMILAR '%#"o_a#"_' ESCAPE '#') oma 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 tsvector into a set of rows, one per lexeme. - select * from unnest('cat:3 fat:2,4 rat:5A'::tsvector) + SELECT * FROM unnest('cat:3 fat:2,4 rat:5A'::tsvector) 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('', ' Examples: -SELECT xmlelement(name foo, xmlattributes('xyz' as bar)); +SELECT xmlelement(NAME foo, xmlattributes('xyz' AS bar)); xmlelement ------------------ -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'); HHHH is the character's Unicode codepoint in hexadecimal notation. For example: 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; But these are not: -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; @@ -234,10 +234,10 @@ SELECT xmlelement(name test, xmlattributes(func(a, b))) FROM test; its data type. If the content is itself of type xml, complex XML documents can be constructed. For example: