From a2bade71867aecbea90c7c03f0295cecca0c215d Mon Sep 17 00:00:00 2001 From: Erik Wienhold Date: Sun, 17 Mar 2024 19:28:07 +0100 Subject: [PATCH v1] Simplify docs on backslash escapes in jsonpath The paragraph describing the JavaScript string literals allowed in jsonpath expressions is not ideal: it unnecessarily mentions JSON by erroneously listing \v as allowed by JSON and mentioning the \xNN and \u{N...} backslash escapes as deviations from JSON when in fact both are accepted by ECMAScript/JavaScript. Fix this by only referring to JavaScript and with a bulleted list of backslash escapes to make it more readable. --- doc/src/sgml/json.sgml | 47 ++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/doc/src/sgml/json.sgml b/doc/src/sgml/json.sgml index 1dbb9606e9..1ec4b90abb 100644 --- a/doc/src/sgml/json.sgml +++ b/doc/src/sgml/json.sgml @@ -803,21 +803,38 @@ UPDATE table_name SET jsonb_field[1]['a'] = '1'; In particular, the way to write a double quote within an embedded string literal is \", and to write a backslash itself, you must write \\. Other special backslash sequences - include those recognized in JSON strings: - \b, - \f, - \n, - \r, - \t, - \v - for various ASCII control characters, and - \uNNNN for a Unicode - character identified by its 4-hex-digit code point. The backslash - syntax also includes two cases not allowed by JSON: - \xNN for a character code - written with only two hex digits, and - \u{N...} for a character - code written with 1 to 6 hex digits. + include those recognized in JavaScript strings: + + + + \b, + \f, + \n, + \r, + \t, + \v + for various ASCII control characters + + + + + \xNN + for a character code written with 2 hex digits + + + + + \uNNNN + for a Unicode code point written with 4 hex digits + + + + + \u{N...} + for a Unicode code point written with 1 to 6 hex digits + + + -- 2.44.0