1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-29 16:21:20 +03:00
Tom Lane 6f34fcbbd5 Fix conversion of JSON strings to JSON output columns in json_to_record().
json_to_record(), when an output column is declared as type json or jsonb,
should emit the corresponding field of the input JSON object.  But it got
this slightly wrong when the field is just a string literal: it failed to
escape the contents of the string.  That typically resulted in syntax
errors if the string contained any double quotes or backslashes.

jsonb_to_record() handles such cases correctly, but I added corresponding
test cases for it too, to prevent future backsliding.

Improve the documentation, as it provided only a very hand-wavy
description of the conversion rules used by these functions.

Per bug report from Robert Vollmert.  Back-patch to v10 where the
error was introduced (by commit cf35346e8).

Note that PG 9.4 - 9.6 also get this case wrong, but differently so:
they feed the de-escaped contents of the string literal to json[b]_in.
That behavior is less obviously wrong, so possibly it's being depended on
in the field, so I won't risk trying to make the older branches behave
like the newer ones.

Discussion: https://postgr.es/m/D6921B37-BD8E-4664-8D5F-DB3525765DCD@vllmrt.net
2019-06-11 13:33:22 -04:00
..
2019-05-26 08:08:05 +02:00
2018-07-16 10:48:05 +02:00
2017-10-20 19:26:10 -04:00
2019-05-26 18:28:18 +05:30
2019-04-08 22:32:46 +02:00
2018-10-11 11:43:56 -07:00
2018-06-20 16:01:18 +02:00
2018-06-20 16:06:03 +02:00
2019-06-09 11:25:56 +09:00
2017-10-17 15:10:33 -04:00
2017-10-17 15:10:33 -04:00
2017-11-23 09:44:28 -05:00
2017-11-23 09:44:28 -05:00
2019-04-08 22:32:46 +02:00
2018-07-16 10:48:05 +02:00
2019-04-03 17:40:29 -07:00
2017-10-17 15:10:33 -04:00
2017-10-17 15:10:33 -04:00
2018-07-16 10:48:05 +02:00
2018-10-03 12:48:37 -07:00
2019-01-02 12:44:25 -05:00
2019-01-02 12:44:25 -05:00
2019-03-29 08:26:33 +01:00
2018-07-16 10:48:05 +02:00
2017-10-17 15:10:33 -04:00
2018-08-28 21:33:32 +09:00
2019-03-13 13:41:14 +01:00
2019-04-08 22:32:46 +02:00
2018-08-14 22:54:52 +02:00
2017-10-17 15:10:33 -04:00
2019-05-09 09:16:59 +02:00
2019-04-03 17:40:29 -07:00
2019-03-29 13:36:24 +01:00
2019-02-17 20:23:10 +09:00
2019-06-09 11:25:56 +09:00
2017-11-23 09:44:28 -05:00
2019-05-26 18:28:18 +05:30
2017-08-15 14:37:44 -04:00
2019-03-27 23:10:23 +01:00
2019-03-27 23:10:23 +01:00
2019-03-30 08:15:57 +01:00
2019-03-30 08:15:57 +01:00
2018-08-28 21:42:45 +09:00
2018-07-16 10:48:05 +02:00

<!-- doc/src/sgml/README.links -->

Linking within DocBook documents can be confusing, so here is a summary:


Intra-document Linking
----------------------

<xref>
	use to get chapter/section number from the title of the target
	link, or xreflabel if defined at the target, or refentrytitle if target
        is a refentry;  has no close tag
	http://www.oasis-open.org/docbook/documentation/reference/html/xref.html

<link>
	use to supply text for the link, requires </link>
	http://www.oasis-open.org/docbook/documentation/reference/html/link.html

linkend=
	controls the target of the link/xref, required

endterm=
	for <xref>, allows the text of the link/xref to be taken from a
	different link target title


External Linking
----------------

<ulink>
	like <link>, but uses a URL (not a document target);  requires
	</ulink>; if no text is specified, the URL appears as the link
	text
	http://www.oasis-open.org/docbook/documentation/reference/html/ulink.html

url=
	used by <ulink> to specify the URL, required


Guidelines
----------

- For an internal link, if you want to supply text, use <link>, else
  <xref>.

- Specific nouns like GUC variables, SQL commands, and contrib modules
  usually have xreflabels.

- For an external link, use <ulink>, with or without link text.