{"Entry":{"collection":"func","key":"jsonb-insert","name":"jsonb_insert","aliases":[],"metadata":{"changed_in":[],"changes":[{"descriptions_changed":false,"doc_overhaul":false,"from":"9.5","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"added","to":"9.6"},{"descriptions_changed":false,"doc_overhaul":true,"from":"12","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"13"}],"content_hash":"59d8fbd32ab5d9715cebe73f7558b93fd56026f3b52044643cdb3f376e684e7f","derived_content_hash":"bae8f2f5969ac4c73f4686c669aaca4f974d31a3f06c8a32fd23e55d38d8e68f","documentation_refresh":{"batch":"20261113","original_source_rev":"wiki-repair-20261023:42fa4bad0e77e50cd5edae6baef701974e042519e2849723510b66e4a2a28927","versions":{"14":"14.25","15":"15.20","16":"16.16","17":"17.12","18":"18.7","19":"19rc2"}},"first_version":"9.6","group":"json","group_label":"Json Functions And Operators","groups":["json"],"imported_at":"2026-09-14T21:49:48.802978+08:00","last_version":"20","name":"jsonb_insert","name_key":"jsonb_insert","position":16035,"present_in":["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":"40a1750d9cf18fad3514855f4062a58ca0826ae3724ad908ba89ef4cb930b5db","repair":"wiki-repair-20261023"},"signature":"jsonb_insert ( target jsonb, path text[], new_value jsonb [, insert_after boolean ] ) → jsonb","signature_count":1,"slug":"jsonb-insert","source_rev":"wiki-repair-20261023:42fa4bad0e77e50cd5edae6baef701974e042519e2849723510b66e4a2a28927","summary":"Returns target with new_value inserted.","summary_zh":""}},"Definition":{"Collection":"func","Key":"jsonb-insert","SourceDatabase":"center","Version":"18","SourceTable":"func","SourceKey":"jsonb-insert","SourceRevision":"wiki-repair-20261023:42fa4bad0e77e50cd5edae6baef701974e042519e2849723510b66e4a2a28927","Facts":{"description":"Returns jsonb_in with replacement inserted. If the item designated by the path is an array element, replacement will be inserted before that item if insert_after is false (which is the default), or after it if insert_after is true. If the item designated by the path is an object field, replacement will be inserted only if the object does not already contain that key. 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, 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 \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e inserted. If the item designated by the \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e is an array element, \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e will be inserted before that item if \u003cem class=\"parameter\"\u003e\u003ccode\u003einsert_after\u003c/code\u003e\u003c/em\u003e is false (which is the default), or after it if \u003cem class=\"parameter\"\u003e\u003ccode\u003einsert_after\u003c/code\u003e\u003c/em\u003e is true. If the item designated by the \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e is an object field, \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e will be inserted only if the object does not already contain that key. 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, 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":"返回插入 replacement 的 jsonb_in。如果 path 指派的项是一个数组元素，则当 insert_after 为假（此为默认值）时，replacement 将被插入到该项之前；当 insert_after 为真时，则插入到该项之后。如果由 path 指派的项是一个对象字段，则只在对象不包含该键时才插入 replacement。路径中的所有前面步骤都必须存在，否则将不加改变地返回 jsonb_in。与面向路径的操作符一样，path 中的负整数从 JSON 数组末尾计数。如果最后一个路径步骤是超出范围的数组下标，那么当下标为负时，新值会被添加到数组开头；当下标为正时，新值会被添加到数组末尾。","description_zh_html":"返回插入 \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 指派的项是一个数组元素，则当 \u003cem class=\"parameter\"\u003e\u003ccode\u003einsert_after\u003c/code\u003e\u003c/em\u003e 为假（此为默认值）时，\u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e 将被插入到该项之前；当 \u003cem class=\"parameter\"\u003e\u003ccode\u003einsert_after\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 数组末尾计数。如果最后一个路径步骤是超出范围的数组下标，那么当下标为负时，新值会被添加到数组开头；当下标为正时，新值会被添加到数组末尾。","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 replacement inserted. If the item designated by the path is an array element, replacement will be inserted before that item if insert_after is false (which is the default), or after it if insert_after is true. If the item designated by the path is an object field, replacement will be inserted only if the object does not already contain that key. 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, 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 \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e inserted. If the item designated by the \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e is an array element, \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e will be inserted before that item if \u003cem class=\"parameter\"\u003e\u003ccode\u003einsert_after\u003c/code\u003e\u003c/em\u003e is false (which is the default), or after it if \u003cem class=\"parameter\"\u003e\u003ccode\u003einsert_after\u003c/code\u003e\u003c/em\u003e is true. If the item designated by the \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e is an object field, \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e will be inserted only if the object does not already contain that key. 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, 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":"返回插入 replacement 的 jsonb_in。如果 path 指派的项是一个数组元素，则当 insert_after 为假（此为默认值）时，replacement 将被插入到该项之前；当 insert_after 为真时，则插入到该项之后。如果由 path 指派的项是一个对象字段，则只在对象不包含该键时才插入 replacement。路径中的所有前面步骤都必须存在，否则将不加改变地返回 jsonb_in。与面向路径的操作符一样，path 中的负整数从 JSON 数组末尾计数。如果最后一个路径步骤是超出范围的数组下标，那么当下标为负时，新值会被添加到数组开头；当下标为正时，新值会被添加到数组末尾。","description_zh_html":"返回插入 \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 指派的项是一个数组元素，则当 \u003cem class=\"parameter\"\u003e\u003ccode\u003einsert_after\u003c/code\u003e\u003c/em\u003e 为假（此为默认值）时，\u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e 将被插入到该项之前；当 \u003cem class=\"parameter\"\u003e\u003ccode\u003einsert_after\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 数组末尾计数。如果最后一个路径步骤是超出范围的数组下标，那么当下标为负时，新值会被添加到数组开头；当下标为正时，新值会被添加到数组末尾。","examples":[{"expr":"jsonb_insert('{\"a\": [0,1,2]}', '{a, 1}', '\"new_value\"')","result":"{\"a\": [0, \"new_value\", 1, 2]}"},{"expr":"jsonb_insert('{\"a\": [0,1,2]}', '{a, 1}', '\"new_value\"', true)","result":"{\"a\": [0, 1, \"new_value\", 2]}"}],"html":"\u003ccode class=\"function\"\u003ejsonb_insert\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\u003einsert_after\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_insert ( jsonb_in jsonb, path text[], replacement jsonb [, insert_after 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-insert","SourceDatabase":"center","Version":"18","Locale":"en","Title":"jsonb_insert","Summary":"Returns jsonb_in with replacement inserted. If the item designated by the path is an array element, replacement will be inserted before that item if insert_after is false (which is the default), or after it if insert_after is true. If the item designated by the path is an object field, replacement will be inserted only if the object does not already contain that key. 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, 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 \u003cem\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e inserted. If the item designated by the \u003cem\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e is an array element, \u003cem\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e will be inserted before that item if \u003cem\u003e\u003ccode\u003einsert_after\u003c/code\u003e\u003c/em\u003e is false (which is the default), or after it if \u003cem\u003e\u003ccode\u003einsert_after\u003c/code\u003e\u003c/em\u003e is true. If the item designated by the \u003cem\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e is an object field, \u003cem\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e will be inserted only if the object does not already contain that key. 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, 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:42fa4bad0e77e50cd5edae6baef701974e042519e2849723510b66e4a2a28927","ContentHash":"408f5f98a4ee1f9596ec444d9a5a5a7457252b13686853bd0e69446330a050b9","Payload":{"description":"Returns jsonb_in with replacement inserted. If the item designated by the path is an array element, replacement will be inserted before that item if insert_after is false (which is the default), or after it if insert_after is true. If the item designated by the path is an object field, replacement will be inserted only if the object does not already contain that key. 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, 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 \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e inserted. If the item designated by the \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e is an array element, \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e will be inserted before that item if \u003cem class=\"parameter\"\u003e\u003ccode\u003einsert_after\u003c/code\u003e\u003c/em\u003e is false (which is the default), or after it if \u003cem class=\"parameter\"\u003e\u003ccode\u003einsert_after\u003c/code\u003e\u003c/em\u003e is true. If the item designated by the \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e is an object field, \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e will be inserted only if the object does not already contain that key. 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, 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 replacement inserted. If the item designated by the path is an array element, replacement will be inserted before that item if insert_after is false (which is the default), or after it if insert_after is true. If the item designated by the path is an object field, replacement will be inserted only if the object does not already contain that key. 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, 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 \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e inserted. If the item designated by the \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e is an array element, \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e will be inserted before that item if \u003cem class=\"parameter\"\u003e\u003ccode\u003einsert_after\u003c/code\u003e\u003c/em\u003e is false (which is the default), or after it if \u003cem class=\"parameter\"\u003e\u003ccode\u003einsert_after\u003c/code\u003e\u003c/em\u003e is true. If the item designated by the \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e is an object field, \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e will be inserted only if the object does not already contain that key. 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, 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":"返回插入 replacement 的 jsonb_in。如果 path 指派的项是一个数组元素，则当 insert_after 为假（此为默认值）时，replacement 将被插入到该项之前；当 insert_after 为真时，则插入到该项之后。如果由 path 指派的项是一个对象字段，则只在对象不包含该键时才插入 replacement。路径中的所有前面步骤都必须存在，否则将不加改变地返回 jsonb_in。与面向路径的操作符一样，path 中的负整数从 JSON 数组末尾计数。如果最后一个路径步骤是超出范围的数组下标，那么当下标为负时，新值会被添加到数组开头；当下标为正时，新值会被添加到数组末尾。","description_zh_html":"返回插入 \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 指派的项是一个数组元素，则当 \u003cem class=\"parameter\"\u003e\u003ccode\u003einsert_after\u003c/code\u003e\u003c/em\u003e 为假（此为默认值）时，\u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e 将被插入到该项之前；当 \u003cem class=\"parameter\"\u003e\u003ccode\u003einsert_after\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 数组末尾计数。如果最后一个路径步骤是超出范围的数组下标，那么当下标为负时，新值会被添加到数组开头；当下标为正时，新值会被添加到数组末尾。","examples":[{"expr":"jsonb_insert('{\"a\": [0,1,2]}', '{a, 1}', '\"new_value\"')","result":"{\"a\": [0, \"new_value\", 1, 2]}"},{"expr":"jsonb_insert('{\"a\": [0,1,2]}', '{a, 1}', '\"new_value\"', true)","result":"{\"a\": [0, 1, \"new_value\", 2]}"}],"html":"\u003ccode class=\"function\"\u003ejsonb_insert\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\u003einsert_after\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_insert ( jsonb_in jsonb, path text[], replacement jsonb [, insert_after boolean] ) → jsonb","zh_from":"same-version-manual"}]}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","9.6"],"Locales":["en","zh-Hans"],"Signatures":[{"Version":"18","Ordinal":0,"Hash":"dde085ba4365a77898bc5b22aea1002dc740bfa6e58c6cb6f3ee4b85a4c57b86","Text":"jsonb_insert ( jsonb_in jsonb, path text[], replacement jsonb [, insert_after boolean] ) → jsonb","Returns":"jsonb","Payload":{"description":"Returns jsonb_in with replacement inserted. If the item designated by the path is an array element, replacement will be inserted before that item if insert_after is false (which is the default), or after it if insert_after is true. If the item designated by the path is an object field, replacement will be inserted only if the object does not already contain that key. 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, 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 \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e inserted. If the item designated by the \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e is an array element, \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e will be inserted before that item if \u003cem class=\"parameter\"\u003e\u003ccode\u003einsert_after\u003c/code\u003e\u003c/em\u003e is false (which is the default), or after it if \u003cem class=\"parameter\"\u003e\u003ccode\u003einsert_after\u003c/code\u003e\u003c/em\u003e is true. If the item designated by the \u003cem class=\"parameter\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/em\u003e is an object field, \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e will be inserted only if the object does not already contain that key. 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, 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":"返回插入 replacement 的 jsonb_in。如果 path 指派的项是一个数组元素，则当 insert_after 为假（此为默认值）时，replacement 将被插入到该项之前；当 insert_after 为真时，则插入到该项之后。如果由 path 指派的项是一个对象字段，则只在对象不包含该键时才插入 replacement。路径中的所有前面步骤都必须存在，否则将不加改变地返回 jsonb_in。与面向路径的操作符一样，path 中的负整数从 JSON 数组末尾计数。如果最后一个路径步骤是超出范围的数组下标，那么当下标为负时，新值会被添加到数组开头；当下标为正时，新值会被添加到数组末尾。","description_zh_html":"返回插入 \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 指派的项是一个数组元素，则当 \u003cem class=\"parameter\"\u003e\u003ccode\u003einsert_after\u003c/code\u003e\u003c/em\u003e 为假（此为默认值）时，\u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e 将被插入到该项之前；当 \u003cem class=\"parameter\"\u003e\u003ccode\u003einsert_after\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 数组末尾计数。如果最后一个路径步骤是超出范围的数组下标，那么当下标为负时，新值会被添加到数组开头；当下标为正时，新值会被添加到数组末尾。","examples":[{"expr":"jsonb_insert('{\"a\": [0,1,2]}', '{a, 1}', '\"new_value\"')","result":"{\"a\": [0, \"new_value\", 1, 2]}"},{"expr":"jsonb_insert('{\"a\": [0,1,2]}', '{a, 1}', '\"new_value\"', true)","result":"{\"a\": [0, 1, \"new_value\", 2]}"}],"html":"\u003ccode class=\"function\"\u003ejsonb_insert\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\u003einsert_after\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_insert ( jsonb_in jsonb, path text[], replacement jsonb [, insert_after boolean] ) → jsonb","zh_from":"same-version-manual"}}],"Spellings":null,"SQLState":null,"Evidence":null}
