mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
Partial implementation of SQL/JSON path language
SQL 2016 standards among other things contains set of SQL/JSON features for JSON processing inside of relational database. The core of SQL/JSON is JSON path language, allowing access parts of JSON documents and make computations over them. This commit implements partial support JSON path language as separate datatype called "jsonpath". The implementation is partial because it's lacking datetime support and suppression of numeric errors. Missing features will be added later by separate commits. Support of SQL/JSON features requires implementation of separate nodes, and it will be considered in subsequent patches. This commit includes following set of plain functions, allowing to execute jsonpath over jsonb values: * jsonb_path_exists(jsonb, jsonpath[, jsonb, bool]), * jsonb_path_match(jsonb, jsonpath[, jsonb, bool]), * jsonb_path_query(jsonb, jsonpath[, jsonb, bool]), * jsonb_path_query_array(jsonb, jsonpath[, jsonb, bool]). * jsonb_path_query_first(jsonb, jsonpath[, jsonb, bool]). This commit also implements "jsonb @? jsonpath" and "jsonb @@ jsonpath", which are wrappers over jsonpath_exists(jsonb, jsonpath) and jsonpath_predicate(jsonb, jsonpath) correspondingly. These operators will have an index support (implemented in subsequent patches). Catversion bumped, to add new functions and operators. Code was written by Nikita Glukhov and Teodor Sigaev, revised by me. Documentation was written by Oleg Bartunov and Liudmila Mantrova. The work was inspired by Oleg Bartunov. Discussion: https://postgr.es/m/fcc6fc6a-b497-f39a-923d-aa34d0c588e8%402ndQuadrant.com Author: Nikita Glukhov, Teodor Sigaev, Alexander Korotkov, Oleg Bartunov, Liudmila Mantrova Reviewed-by: Tomas Vondra, Andrew Dunstan, Pavel Stehule, Alexander Korotkov
This commit is contained in:
@@ -206,6 +206,21 @@ Section: Class 22 - Data Exception
|
||||
2200N E ERRCODE_INVALID_XML_CONTENT invalid_xml_content
|
||||
2200S E ERRCODE_INVALID_XML_COMMENT invalid_xml_comment
|
||||
2200T E ERRCODE_INVALID_XML_PROCESSING_INSTRUCTION invalid_xml_processing_instruction
|
||||
22030 E ERRCODE_DUPLICATE_JSON_OBJECT_KEY_VALUE duplicate_json_object_key_value
|
||||
22032 E ERRCODE_INVALID_JSON_TEXT invalid_json_text
|
||||
22033 E ERRCODE_INVALID_JSON_SUBSCRIPT invalid_json_subscript
|
||||
22034 E ERRCODE_MORE_THAN_ONE_JSON_ITEM more_than_one_json_item
|
||||
22035 E ERRCODE_NO_JSON_ITEM no_json_item
|
||||
22036 E ERRCODE_NON_NUMERIC_JSON_ITEM non_numeric_json_item
|
||||
22037 E ERRCODE_NON_UNIQUE_KEYS_IN_JSON_OBJECT non_unique_keys_in_json_object
|
||||
22038 E ERRCODE_SINGLETON_JSON_ITEM_REQUIRED singleton_json_item_required
|
||||
22039 E ERRCODE_JSON_ARRAY_NOT_FOUND json_array_not_found
|
||||
2203A E ERRCODE_JSON_MEMBER_NOT_FOUND json_member_not_found
|
||||
2203B E ERRCODE_JSON_NUMBER_NOT_FOUND json_number_not_found
|
||||
2203C E ERRCODE_JSON_OBJECT_NOT_FOUND object_not_found
|
||||
2203F E ERRCODE_JSON_SCALAR_REQUIRED json_scalar_required
|
||||
2203D E ERRCODE_TOO_MANY_JSON_ARRAY_ELEMENTS too_many_json_array_elements
|
||||
2203E E ERRCODE_TOO_MANY_JSON_OBJECT_MEMBERS too_many_json_object_members
|
||||
|
||||
Section: Class 23 - Integrity Constraint Violation
|
||||
|
||||
|
||||
Reference in New Issue
Block a user