{"Entry":{"collection":"func","key":"jsonb-set","name":"jsonb_set","aliases":[],"metadata":{"changed_in":[],"changes":[{"descriptions_changed":false,"doc_overhaul":false,"from":"9.4","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"added","to":"9.5"},{"descriptions_changed":false,"doc_overhaul":true,"from":"12","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"13"}],"content_hash":"6002b6eb94a2891a626eb657da35aea23affe0e7c3fbb4dfd0bfed44899119d0","derived_content_hash":"b9fe5edf73350dd5092e1e89528d6ddc26296be678af1887c2dd7e445d775322","documentation_refresh":{"batch":"20261113","original_source_rev":"wiki-repair-20261023:73968ce097211b81c85669bfc65539403975d63ff3b3c9c1c10dc29aec992127","versions":{"14":"14.25","15":"15.20","16":"16.16","17":"17.12","18":"18.7","19":"19rc2"}},"first_version":"9.5","group":"json","group_label":"Json Functions And Operators","groups":["json"],"imported_at":"2026-09-14T21:49:48.813589+08:00","last_version":"20","name":"jsonb_set","name_key":"jsonb_set","position":16052,"present_in":["9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"repair_provenance":{"original_source_revision":"2026-09-14T13:14:25.684213+00:00@99e6866c","receipt_sha256":"e6c99f0d9402afd953ee73d228ebac8b933c1b7535bfe6c9a043387729d4e815","repair":"wiki-repair-20261023"},"signature":"jsonb_set ( target jsonb, path text[], new_value jsonb [, create_if_missing boolean ] ) → jsonb","signature_count":1,"slug":"jsonb-set","source_rev":"wiki-repair-20261023:73968ce097211b81c85669bfc65539403975d63ff3b3c9c1c10dc29aec992127","summary":"Returns target with the item designated by path replaced by new_value, or with new_value added if create_if_missing is true (which is the default) and the item designated by path does not exist.","summary_zh":""}},"Definition":{"Collection":"func","Key":"jsonb-set","SourceDatabase":"center","Version":"18","SourceTable":"func","SourceKey":"jsonb-set","SourceRevision":"wiki-repair-20261023:73968ce097211b81c85669bfc65539403975d63ff3b3c9c1c10dc29aec992127","Facts":{"description":"Returns jsonb_in with the item designated by path replaced by replacement, or with replacement added if create_if_missing is true (which is the default) and the item designated by path does not exist. All earlier steps in the path must exist, or the jsonb_in is returned unchanged. As with the path oriented operators, negative integers that appear in the path count from the end of JSON arrays. If the last path step is an array index that is out of range, and create_if_missing is true, the new value is added at the beginning of the array if the index is negative, or at the end of the array if it is positive.","description_html":"Returns \u003cem class=\"parameter\"\u003e\u003ccode\u003ejsonb_in\u003c/code\u003e\u003c/em\u003e with the item designated by \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e replaced by \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e, or with \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e added if \u003cem class=\"parameter\"\u003e\u003ccode\u003ecreate_if_missing\u003c/code\u003e\u003c/em\u003e is true (which is the default) and the item designated by \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e does not exist. All earlier steps in the path must exist, or the \u003cem class=\"parameter\"\u003e\u003ccode\u003ejsonb_in\u003c/code\u003e\u003c/em\u003e is returned unchanged. As with the path oriented operators, negative integers that appear in the \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e count from the end of JSON arrays. If the last path step is an array index that is out of range, and \u003cem class=\"parameter\"\u003e\u003ccode\u003ecreate_if_missing\u003c/code\u003e\u003c/em\u003e is true, the new value is added at the beginning of the array if the index is negative, or at the end of the array if it is positive.","description_zh":"返回 jsonb_in，将 path 指定的项替换为 replacement，如果 create_if_missing 为真（此为默认值）并且 path 指定的项不存在，则添加 replacement。路径中的所有前面步骤都必须存在，否则将不加改变地返回 jsonb_in。与面向路径的操作符一样，path 中的负整数从 JSON 数组末尾计数。如果最后一个路径步骤是超出范围的数组索引，并且 create_if_missing 为真，那么如果索引为负，新值将添加到数组的开头，如果索引为正，则添加到数组的结尾。","description_zh_html":"返回 \u003cem class=\"parameter\"\u003e\u003ccode\u003ejsonb_in\u003c/code\u003e\u003c/em\u003e，将 \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e 指定的项替换为 \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e，如果 \u003cem class=\"parameter\"\u003e\u003ccode\u003ecreate_if_missing\u003c/code\u003e\u003c/em\u003e 为真（此为默认值）并且 \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e 指定的项不存在，则添加 \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e。路径中的所有前面步骤都必须存在，否则将不加改变地返回 \u003cem class=\"parameter\"\u003e\u003ccode\u003ejsonb_in\u003c/code\u003e\u003c/em\u003e。与面向路径的操作符一样，\u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e 中的负整数从 JSON 数组末尾计数。如果最后一个路径步骤是超出范围的数组索引，并且 \u003cem class=\"parameter\"\u003e\u003ccode\u003ecreate_if_missing\u003c/code\u003e\u003c/em\u003e 为真，那么如果索引为负，新值将添加到数组的开头，如果索引为正，则添加到数组的结尾。","doc":{"anchor":"FUNCTIONS-JSON-PROCESSING-TABLE","file":"functions-json.html","sha256":"060b67147827d70ddcf5948833ddfbeada321366476016c8b8b7d68afda8045c","slug":"18"},"documentation_revision":{"inputs":[{"file":"functions-json.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"060b67147827d70ddcf5948833ddfbeada321366476016c8b8b7d68afda8045c","version":"18.7"},{"file":"functions-json.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"31b98fa7f00387abf441728c31918bfe8b368642bceeb8bba88a73c3fbd607de","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"},"group":"json","group_label":"JSON 函数和操作符","lang":"en","layout":"table-new","pages":["functions-json.html"],"prose_only":false,"signatures":[{"description":"Returns jsonb_in with the item designated by path replaced by replacement, or with replacement added if create_if_missing is true (which is the default) and the item designated by path does not exist. All earlier steps in the path must exist, or the jsonb_in is returned unchanged. As with the path oriented operators, negative integers that appear in the path count from the end of JSON arrays. If the last path step is an array index that is out of range, and create_if_missing is true, the new value is added at the beginning of the array if the index is negative, or at the end of the array if it is positive.","description_html":"Returns \u003cem class=\"parameter\"\u003e\u003ccode\u003ejsonb_in\u003c/code\u003e\u003c/em\u003e with the item designated by \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e replaced by \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e, or with \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e added if \u003cem class=\"parameter\"\u003e\u003ccode\u003ecreate_if_missing\u003c/code\u003e\u003c/em\u003e is true (which is the default) and the item designated by \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e does not exist. All earlier steps in the path must exist, or the \u003cem class=\"parameter\"\u003e\u003ccode\u003ejsonb_in\u003c/code\u003e\u003c/em\u003e is returned unchanged. As with the path oriented operators, negative integers that appear in the \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e count from the end of JSON arrays. If the last path step is an array index that is out of range, and \u003cem class=\"parameter\"\u003e\u003ccode\u003ecreate_if_missing\u003c/code\u003e\u003c/em\u003e is true, the new value is added at the beginning of the array if the index is negative, or at the end of the array if it is positive.","description_zh":"返回 jsonb_in，将 path 指定的项替换为 replacement，如果 create_if_missing 为真（此为默认值）并且 path 指定的项不存在，则添加 replacement。路径中的所有前面步骤都必须存在，否则将不加改变地返回 jsonb_in。与面向路径的操作符一样，path 中的负整数从 JSON 数组末尾计数。如果最后一个路径步骤是超出范围的数组索引，并且 create_if_missing 为真，那么如果索引为负，新值将添加到数组的开头，如果索引为正，则添加到数组的结尾。","description_zh_html":"返回 \u003cem class=\"parameter\"\u003e\u003ccode\u003ejsonb_in\u003c/code\u003e\u003c/em\u003e，将 \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e 指定的项替换为 \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e，如果 \u003cem class=\"parameter\"\u003e\u003ccode\u003ecreate_if_missing\u003c/code\u003e\u003c/em\u003e 为真（此为默认值）并且 \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e 指定的项不存在，则添加 \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e。路径中的所有前面步骤都必须存在，否则将不加改变地返回 \u003cem class=\"parameter\"\u003e\u003ccode\u003ejsonb_in\u003c/code\u003e\u003c/em\u003e。与面向路径的操作符一样，\u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e 中的负整数从 JSON 数组末尾计数。如果最后一个路径步骤是超出范围的数组索引，并且 \u003cem class=\"parameter\"\u003e\u003ccode\u003ecreate_if_missing\u003c/code\u003e\u003c/em\u003e 为真，那么如果索引为负，新值将添加到数组的开头，如果索引为正，则添加到数组的结尾。","examples":[{"expr":"jsonb_set('[{\"f1\":1,\"f2\":null},2,null,3]', '{0,f1}', '[2,3,4]', false)","result":"[{\"f1\": [2, 3, 4], \"f2\": null}, 2, null, 3]"},{"expr":"jsonb_set('[{\"f1\":1,\"f2\":null},2]', '{0,f3}', '[2,3,4]')","result":"[{\"f1\": 1, \"f2\": null, \"f3\": [2, 3, 4]}, 2]"}],"html":"\u003ccode class=\"function\"\u003ejsonb_set\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003ejsonb_in\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003ejsonb\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext[]\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003ejsonb\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003ecreate_if_missing\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003eboolean\u003c/code\u003e\u003c/span\u003e] ) → \u003ccode class=\"returnvalue\"\u003ejsonb\u003c/code\u003e","returns":"jsonb","text":"jsonb_set ( jsonb_in jsonb, path text[], replacement jsonb [, create_if_missing boolean] ) → jsonb","zh_from":"same-version-manual"}],"translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/functions-json.html","sha256":"a412feb14a229f1d9f14fa2d7735255aa297d5eb8f2971d744d9dfee659c7cca"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"zh_from":"same-version-manual"},"ManualEvidence":{"doc":{"anchor":"FUNCTIONS-JSON-PROCESSING-TABLE","file":"functions-json.html","sha256":"060b67147827d70ddcf5948833ddfbeada321366476016c8b8b7d68afda8045c","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"jsonb-set","SourceDatabase":"center","Version":"18","Locale":"en","Title":"jsonb_set","Summary":"Returns jsonb_in with the item designated by path replaced by replacement, or with replacement added if create_if_missing is true (which is the default) and the item designated by path does not exist. All earlier steps in the path must exist, or the jsonb_in is returned unchanged. As with the path oriented operators, negative integers that appear in the path count from the end of JSON arrays. If the last path step is an array index that is out of range, and create_if_missing is true, the new value is added at the beginning of the array if the index is negative, or at the end of the array if it is positive.","BodyHTML":"Returns \u003cem\u003e\u003ccode\u003ejsonb_in\u003c/code\u003e\u003c/em\u003e with the item designated by \u003cem\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e replaced by \u003cem\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e, or with \u003cem\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e added if \u003cem\u003e\u003ccode\u003ecreate_if_missing\u003c/code\u003e\u003c/em\u003e is true (which is the default) and the item designated by \u003cem\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e does not exist. All earlier steps in the path must exist, or the \u003cem\u003e\u003ccode\u003ejsonb_in\u003c/code\u003e\u003c/em\u003e is returned unchanged. As with the path oriented operators, negative integers that appear in the \u003cem\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e count from the end of JSON arrays. If the last path step is an array index that is out of range, and \u003cem\u003e\u003ccode\u003ecreate_if_missing\u003c/code\u003e\u003c/em\u003e is true, the new value is added at the beginning of the array if the index is negative, or at the end of the array if it is positive.","SourceRevision":"wiki-repair-20261023:73968ce097211b81c85669bfc65539403975d63ff3b3c9c1c10dc29aec992127","ContentHash":"73855e523960664b74f26f54703a60feddacf257048036311a9e6b4b18f218c5","Payload":{"description":"Returns jsonb_in with the item designated by path replaced by replacement, or with replacement added if create_if_missing is true (which is the default) and the item designated by path does not exist. All earlier steps in the path must exist, or the jsonb_in is returned unchanged. As with the path oriented operators, negative integers that appear in the path count from the end of JSON arrays. If the last path step is an array index that is out of range, and create_if_missing is true, the new value is added at the beginning of the array if the index is negative, or at the end of the array if it is positive.","description_html":"Returns \u003cem class=\"parameter\"\u003e\u003ccode\u003ejsonb_in\u003c/code\u003e\u003c/em\u003e with the item designated by \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e replaced by \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e, or with \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e added if \u003cem class=\"parameter\"\u003e\u003ccode\u003ecreate_if_missing\u003c/code\u003e\u003c/em\u003e is true (which is the default) and the item designated by \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e does not exist. All earlier steps in the path must exist, or the \u003cem class=\"parameter\"\u003e\u003ccode\u003ejsonb_in\u003c/code\u003e\u003c/em\u003e is returned unchanged. As with the path oriented operators, negative integers that appear in the \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e count from the end of JSON arrays. If the last path step is an array index that is out of range, and \u003cem class=\"parameter\"\u003e\u003ccode\u003ecreate_if_missing\u003c/code\u003e\u003c/em\u003e is true, the new value is added at the beginning of the array if the index is negative, or at the end of the array if it is positive.","signatures":[{"description":"Returns jsonb_in with the item designated by path replaced by replacement, or with replacement added if create_if_missing is true (which is the default) and the item designated by path does not exist. All earlier steps in the path must exist, or the jsonb_in is returned unchanged. As with the path oriented operators, negative integers that appear in the path count from the end of JSON arrays. If the last path step is an array index that is out of range, and create_if_missing is true, the new value is added at the beginning of the array if the index is negative, or at the end of the array if it is positive.","description_html":"Returns \u003cem class=\"parameter\"\u003e\u003ccode\u003ejsonb_in\u003c/code\u003e\u003c/em\u003e with the item designated by \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e replaced by \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e, or with \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e added if \u003cem class=\"parameter\"\u003e\u003ccode\u003ecreate_if_missing\u003c/code\u003e\u003c/em\u003e is true (which is the default) and the item designated by \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e does not exist. All earlier steps in the path must exist, or the \u003cem class=\"parameter\"\u003e\u003ccode\u003ejsonb_in\u003c/code\u003e\u003c/em\u003e is returned unchanged. As with the path oriented operators, negative integers that appear in the \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e count from the end of JSON arrays. If the last path step is an array index that is out of range, and \u003cem class=\"parameter\"\u003e\u003ccode\u003ecreate_if_missing\u003c/code\u003e\u003c/em\u003e is true, the new value is added at the beginning of the array if the index is negative, or at the end of the array if it is positive.","description_zh":"返回 jsonb_in，将 path 指定的项替换为 replacement，如果 create_if_missing 为真（此为默认值）并且 path 指定的项不存在，则添加 replacement。路径中的所有前面步骤都必须存在，否则将不加改变地返回 jsonb_in。与面向路径的操作符一样，path 中的负整数从 JSON 数组末尾计数。如果最后一个路径步骤是超出范围的数组索引，并且 create_if_missing 为真，那么如果索引为负，新值将添加到数组的开头，如果索引为正，则添加到数组的结尾。","description_zh_html":"返回 \u003cem class=\"parameter\"\u003e\u003ccode\u003ejsonb_in\u003c/code\u003e\u003c/em\u003e，将 \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e 指定的项替换为 \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e，如果 \u003cem class=\"parameter\"\u003e\u003ccode\u003ecreate_if_missing\u003c/code\u003e\u003c/em\u003e 为真（此为默认值）并且 \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e 指定的项不存在，则添加 \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e。路径中的所有前面步骤都必须存在，否则将不加改变地返回 \u003cem class=\"parameter\"\u003e\u003ccode\u003ejsonb_in\u003c/code\u003e\u003c/em\u003e。与面向路径的操作符一样，\u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e 中的负整数从 JSON 数组末尾计数。如果最后一个路径步骤是超出范围的数组索引，并且 \u003cem class=\"parameter\"\u003e\u003ccode\u003ecreate_if_missing\u003c/code\u003e\u003c/em\u003e 为真，那么如果索引为负，新值将添加到数组的开头，如果索引为正，则添加到数组的结尾。","examples":[{"expr":"jsonb_set('[{\"f1\":1,\"f2\":null},2,null,3]', '{0,f1}', '[2,3,4]', false)","result":"[{\"f1\": [2, 3, 4], \"f2\": null}, 2, null, 3]"},{"expr":"jsonb_set('[{\"f1\":1,\"f2\":null},2]', '{0,f3}', '[2,3,4]')","result":"[{\"f1\": 1, \"f2\": null, \"f3\": [2, 3, 4]}, 2]"}],"html":"\u003ccode class=\"function\"\u003ejsonb_set\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003ejsonb_in\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003ejsonb\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext[]\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003ejsonb\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003ecreate_if_missing\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003eboolean\u003c/code\u003e\u003c/span\u003e] ) → \u003ccode class=\"returnvalue\"\u003ejsonb\u003c/code\u003e","returns":"jsonb","text":"jsonb_set ( jsonb_in jsonb, path text[], replacement jsonb [, create_if_missing boolean] ) → jsonb","zh_from":"same-version-manual"}]}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":[{"Version":"18","Ordinal":0,"Hash":"66e0bd779a81865a9dc048cb50166e438782df6ad4042670605a596efafda3b5","Text":"jsonb_set ( jsonb_in jsonb, path text[], replacement jsonb [, create_if_missing boolean] ) → jsonb","Returns":"jsonb","Payload":{"description":"Returns jsonb_in with the item designated by path replaced by replacement, or with replacement added if create_if_missing is true (which is the default) and the item designated by path does not exist. All earlier steps in the path must exist, or the jsonb_in is returned unchanged. As with the path oriented operators, negative integers that appear in the path count from the end of JSON arrays. If the last path step is an array index that is out of range, and create_if_missing is true, the new value is added at the beginning of the array if the index is negative, or at the end of the array if it is positive.","description_html":"Returns \u003cem class=\"parameter\"\u003e\u003ccode\u003ejsonb_in\u003c/code\u003e\u003c/em\u003e with the item designated by \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e replaced by \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e, or with \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e added if \u003cem class=\"parameter\"\u003e\u003ccode\u003ecreate_if_missing\u003c/code\u003e\u003c/em\u003e is true (which is the default) and the item designated by \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e does not exist. All earlier steps in the path must exist, or the \u003cem class=\"parameter\"\u003e\u003ccode\u003ejsonb_in\u003c/code\u003e\u003c/em\u003e is returned unchanged. As with the path oriented operators, negative integers that appear in the \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e count from the end of JSON arrays. If the last path step is an array index that is out of range, and \u003cem class=\"parameter\"\u003e\u003ccode\u003ecreate_if_missing\u003c/code\u003e\u003c/em\u003e is true, the new value is added at the beginning of the array if the index is negative, or at the end of the array if it is positive.","description_zh":"返回 jsonb_in，将 path 指定的项替换为 replacement，如果 create_if_missing 为真（此为默认值）并且 path 指定的项不存在，则添加 replacement。路径中的所有前面步骤都必须存在，否则将不加改变地返回 jsonb_in。与面向路径的操作符一样，path 中的负整数从 JSON 数组末尾计数。如果最后一个路径步骤是超出范围的数组索引，并且 create_if_missing 为真，那么如果索引为负，新值将添加到数组的开头，如果索引为正，则添加到数组的结尾。","description_zh_html":"返回 \u003cem class=\"parameter\"\u003e\u003ccode\u003ejsonb_in\u003c/code\u003e\u003c/em\u003e，将 \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e 指定的项替换为 \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e，如果 \u003cem class=\"parameter\"\u003e\u003ccode\u003ecreate_if_missing\u003c/code\u003e\u003c/em\u003e 为真（此为默认值）并且 \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e 指定的项不存在，则添加 \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e。路径中的所有前面步骤都必须存在，否则将不加改变地返回 \u003cem class=\"parameter\"\u003e\u003ccode\u003ejsonb_in\u003c/code\u003e\u003c/em\u003e。与面向路径的操作符一样，\u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e 中的负整数从 JSON 数组末尾计数。如果最后一个路径步骤是超出范围的数组索引，并且 \u003cem class=\"parameter\"\u003e\u003ccode\u003ecreate_if_missing\u003c/code\u003e\u003c/em\u003e 为真，那么如果索引为负，新值将添加到数组的开头，如果索引为正，则添加到数组的结尾。","examples":[{"expr":"jsonb_set('[{\"f1\":1,\"f2\":null},2,null,3]', '{0,f1}', '[2,3,4]', false)","result":"[{\"f1\": [2, 3, 4], \"f2\": null}, 2, null, 3]"},{"expr":"jsonb_set('[{\"f1\":1,\"f2\":null},2]', '{0,f3}', '[2,3,4]')","result":"[{\"f1\": 1, \"f2\": null, \"f3\": [2, 3, 4]}, 2]"}],"html":"\u003ccode class=\"function\"\u003ejsonb_set\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003ejsonb_in\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003ejsonb\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext[]\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003ejsonb\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003ecreate_if_missing\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003eboolean\u003c/code\u003e\u003c/span\u003e] ) → \u003ccode class=\"returnvalue\"\u003ejsonb\u003c/code\u003e","returns":"jsonb","text":"jsonb_set ( jsonb_in jsonb, path text[], replacement jsonb [, create_if_missing boolean] ) → jsonb","zh_from":"same-version-manual"}}],"Spellings":null,"SQLState":null,"Evidence":null}
