|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "access/gin.h"#include "access/stratnum.h"#include "catalog/pg_collation.h"#include "catalog/pg_type.h"#include "common/hashfn.h"#include "miscadmin.h"#include "utils/fmgrprotos.h"#include "utils/jsonb.h"#include "utils/jsonpath.h"#include "utils/varlena.h"
Go to the source code of this file.
Data Structures | |
| struct | PathHashStack |
| struct | GinEntries |
| struct | JsonPathGinNode |
| struct | JsonPathGinPathItem |
| union | JsonPathGinPath |
| struct | JsonPathGinContext |
Enumerations | |
| enum | JsonPathGinNodeType { JSP_GIN_OR , JSP_GIN_AND , JSP_GIN_ENTRY } |
| typedef bool(* JsonPathGinAddPathItemFunc) (JsonPathGinPath *path, JsonPathItem *jsp) |
Definition at line 134 of file jsonb_gin.c.
Definition at line 131 of file jsonb_gin.c.
| typedef List *(* JsonPathGinExtractNodesFunc) (JsonPathGinContext *cxt, JsonPathGinPath path, JsonbValue *scalar, List *nodes) |
Definition at line 141 of file jsonb_gin.c.
Definition at line 94 of file jsonb_gin.c.
| Enumerator | |
|---|---|
| JSP_GIN_OR | |
| JSP_GIN_AND | |
| JSP_GIN_ENTRY | |
Definition at line 87 of file jsonb_gin.c.
|
static |
Definition at line 172 of file jsonb_gin.c.
References GinEntries::allocated, GinEntries::buf, GinEntries::count, palloc_array, and repalloc_array.
Referenced by emit_jsp_gin_entries(), gin_extract_jsonb(), and gin_extract_jsonb_path().
|
static |
Definition at line 720 of file jsonb_gin.c.
References add_gin_entry(), JsonPathGinNode::args, check_stack_depth(), emit_jsp_gin_entries(), JsonPathGinNode::entryDatum, JsonPathGinNode::entryIndex, i, JSP_GIN_AND, JSP_GIN_ENTRY, JSP_GIN_OR, JsonPathGinNode::nargs, JsonPathGinNode::type, and JsonPathGinNode::val.
Referenced by emit_jsp_gin_entries(), and extract_jsp_query().
|
static |
Definition at line 800 of file jsonb_gin.c.
References JsonPathGinNode::args, elog, JsonPathGinNode::entryIndex, ERROR, execute_jsp_gin_node(), fb(), GIN_FALSE, GIN_MAYBE, GIN_TRUE, i, JSP_GIN_AND, JSP_GIN_ENTRY, JSP_GIN_OR, JsonPathGinNode::nargs, JsonPathGinNode::type, and JsonPathGinNode::val.
Referenced by execute_jsp_gin_node(), gin_consistent_jsonb(), gin_consistent_jsonb_path(), gin_triconsistent_jsonb(), and gin_triconsistent_jsonb_path().
|
static |
Definition at line 584 of file jsonb_gin.c.
References arg, check_stack_depth(), elog, ERROR, extract_jsp_bool_expr(), extract_jsp_path_expr(), fb(), jbvBool, jbvNull, jbvNumeric, jbvString, jpiAnd, jpiBool, jpiEqual, jpiExists, jpiNot, jpiNotEqual, jpiNull, jpiNumeric, jpiOr, jpiString, JSP_GIN_AND, JSP_GIN_OR, jspGetArg(), jspGetLeftArg(), jspGetRightArg(), jspIsScalar, make_jsp_expr_node_binary(), type, JsonbValue::type, and JsonbValue::val.
Referenced by extract_jsp_bool_expr(), extract_jsp_path_expr_nodes(), and extract_jsp_query().
|
static |
Definition at line 565 of file jsonb_gin.c.
References extract_jsp_path_expr_nodes(), fb(), JSP_GIN_AND, linitial, list_length(), make_jsp_expr_node_args(), and NIL.
Referenced by extract_jsp_bool_expr(), and extract_jsp_query().
|
static |
Definition at line 505 of file jsonb_gin.c.
References JsonPathGinContext::add_path_item, arg, extract_jsp_bool_expr(), JsonPathGinContext::extract_nodes, fb(), jpiCurrent, jpiFilter, jspGetArg(), jspGetNext(), lappend(), next, and NIL.
Referenced by extract_jsp_path_expr().
|
static |
Definition at line 749 of file jsonb_gin.c.
References JsonPathGinContext::add_path_item, GinEntries::buf, GinEntries::count, emit_jsp_gin_entries(), extract_jsp_bool_expr(), extract_jsp_path_expr(), JsonPathGinContext::extract_nodes, fb(), jsonb_ops__add_path_item(), jsonb_ops__extract_nodes(), jsonb_path_ops__add_path_item(), jsonb_path_ops__extract_nodes(), JsonbJsonpathExistsStrategyNumber, JSONPATH_LAX, jspInit(), JsonPathGinContext::lax, palloc0_array, and root.
Referenced by gin_extract_jsonb_query(), and gin_extract_jsonb_query_path().
| Datum gin_compare_jsonb | ( | PG_FUNCTION_ARGS | ) |
Definition at line 204 of file jsonb_gin.c.
References fb(), PG_FREE_IF_COPY, PG_GETARG_TEXT_PP, PG_RETURN_INT32, VARDATA_ANY(), VARSIZE_ANY_EXHDR(), and varstr_cmp().
| Datum gin_consistent_jsonb | ( | PG_FUNCTION_ARGS | ) |
Definition at line 930 of file jsonb_gin.c.
References Assert, elog, ERROR, execute_jsp_gin_node(), GIN_FALSE, i, JsonbContainsStrategyNumber, JsonbExistsAllStrategyNumber, JsonbExistsAnyStrategyNumber, JsonbExistsStrategyNumber, JsonbJsonpathExistsStrategyNumber, JsonbJsonpathPredicateStrategyNumber, PG_GETARG_INT32, PG_GETARG_JSONB_P, PG_GETARG_POINTER, PG_GETARG_UINT16, and PG_RETURN_BOOL.
| Datum gin_consistent_jsonb_path | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1221 of file jsonb_gin.c.
References Assert, elog, ERROR, execute_jsp_gin_node(), GIN_FALSE, i, JsonbContainsStrategyNumber, JsonbJsonpathExistsStrategyNumber, JsonbJsonpathPredicateStrategyNumber, PG_GETARG_INT32, PG_GETARG_JSONB_P, PG_GETARG_POINTER, PG_GETARG_UINT16, and PG_RETURN_BOOL.
| Datum gin_extract_jsonb | ( | PG_FUNCTION_ARGS | ) |
Definition at line 230 of file jsonb_gin.c.
References add_gin_entry(), GinEntries::buf, GinEntries::count, fb(), init_gin_entries(), JB_ROOT_COUNT, jbvString, JsonbIteratorInit(), JsonbIteratorNext(), make_scalar_key(), PG_GETARG_JSONB_P, PG_GETARG_POINTER, PG_RETURN_POINTER, JsonbValue::type, WJB_DONE, WJB_ELEM, WJB_KEY, and WJB_VALUE.
Referenced by gin_extract_jsonb_query().
| Datum gin_extract_jsonb_path | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1091 of file jsonb_gin.c.
References add_gin_entry(), GinEntries::buf, GinEntries::count, elog, ERROR, fb(), PathHashStack::hash, init_gin_entries(), JB_ROOT_COUNT, JsonbHashScalarValue(), JsonbIteratorInit(), JsonbIteratorNext(), palloc_object, PathHashStack::parent, pfree(), PG_GETARG_JSONB_P, PG_GETARG_POINTER, PG_RETURN_POINTER, UInt32GetDatum(), WJB_BEGIN_ARRAY, WJB_BEGIN_OBJECT, WJB_DONE, WJB_ELEM, WJB_END_ARRAY, WJB_END_OBJECT, WJB_KEY, and WJB_VALUE.
Referenced by gin_extract_jsonb_query_path().
| Datum gin_extract_jsonb_query | ( | PG_FUNCTION_ARGS | ) |
Definition at line 849 of file jsonb_gin.c.
References DatumGetPointer(), deconstruct_array_builtin(), DirectFunctionCall2, elog, ERROR, extract_jsp_query(), fb(), gin_extract_jsonb(), GIN_SEARCH_MODE_ALL, i, j, JGINFLAG_KEY, JsonbContainsStrategyNumber, JsonbExistsAllStrategyNumber, JsonbExistsAnyStrategyNumber, JsonbExistsStrategyNumber, JsonbJsonpathExistsStrategyNumber, JsonbJsonpathPredicateStrategyNumber, make_text_key(), palloc_array, palloc_object, PG_GETARG_ARRAYTYPE_P, PG_GETARG_DATUM, PG_GETARG_JSONPATH_P, PG_GETARG_POINTER, PG_GETARG_TEXT_PP, PG_GETARG_UINT16, PG_RETURN_POINTER, PointerGetDatum(), VARDATA_ANY(), and VARSIZE_ANY_EXHDR().
| Datum gin_extract_jsonb_query_path | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1181 of file jsonb_gin.c.
References DatumGetPointer(), DirectFunctionCall2, elog, ERROR, extract_jsp_query(), fb(), gin_extract_jsonb_path(), GIN_SEARCH_MODE_ALL, JsonbContainsStrategyNumber, JsonbJsonpathExistsStrategyNumber, JsonbJsonpathPredicateStrategyNumber, PG_GETARG_DATUM, PG_GETARG_JSONPATH_P, PG_GETARG_POINTER, PG_GETARG_UINT16, PG_RETURN_POINTER, and PointerGetDatum().
| Datum gin_triconsistent_jsonb | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1014 of file jsonb_gin.c.
References Assert, elog, ERROR, execute_jsp_gin_node(), GIN_FALSE, GIN_MAYBE, GIN_TRUE, i, JsonbContainsStrategyNumber, JsonbExistsAllStrategyNumber, JsonbExistsAnyStrategyNumber, JsonbExistsStrategyNumber, JsonbJsonpathExistsStrategyNumber, JsonbJsonpathPredicateStrategyNumber, PG_GETARG_INT32, PG_GETARG_JSONB_P, PG_GETARG_POINTER, PG_GETARG_UINT16, and PG_RETURN_GIN_TERNARY_VALUE.
| Datum gin_triconsistent_jsonb_path | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1273 of file jsonb_gin.c.
References Assert, elog, ERROR, execute_jsp_gin_node(), GIN_FALSE, GIN_MAYBE, GIN_TRUE, i, JsonbContainsStrategyNumber, JsonbJsonpathExistsStrategyNumber, JsonbJsonpathPredicateStrategyNumber, PG_GETARG_INT32, PG_GETARG_JSONB_P, PG_GETARG_POINTER, PG_GETARG_UINT16, and PG_RETURN_GIN_TERNARY_VALUE.
|
static |
Definition at line 163 of file jsonb_gin.c.
References GinEntries::allocated, GinEntries::buf, GinEntries::count, fb(), and palloc_array.
Referenced by gin_extract_jsonb(), and gin_extract_jsonb_path().
|
static |
Definition at line 279 of file jsonb_gin.c.
References fb(), JsonPathGinPath::items, JGINFLAG_KEY, jpiAny, jpiAnyArray, jpiAnyKey, jpiIndexArray, jpiKey, jpiRoot, jspGetString(), len, make_text_key(), palloc_object, and PointerGetDatum().
Referenced by extract_jsp_query().
|
static |
Definition at line 409 of file jsonb_gin.c.
References fb(), GIN_FALSE, GIN_MAYBE, GIN_TRUE, JsonPathGinPath::items, jbvString, jpiAny, jpiAnyArray, jpiIndexArray, jpiKey, JSP_GIN_OR, lappend(), JsonPathGinContext::lax, make_jsp_entry_node(), make_jsp_entry_node_scalar(), make_jsp_expr_node_binary(), JsonPathGinPathItem::type, and JsonbValue::type.
Referenced by extract_jsp_query().
|
static |
Definition at line 324 of file jsonb_gin.c.
References fb(), JsonPathGinPath::hash, jbvString, jpiAnyArray, jpiIndexArray, jpiKey, jpiRoot, JsonbHashScalarValue(), jspGetString(), and JsonbValue::type.
Referenced by extract_jsp_query().
|
static |
Definition at line 479 of file jsonb_gin.c.
References fb(), hash(), JsonPathGinPath::hash, JsonbHashScalarValue(), lappend(), make_jsp_entry_node(), and UInt32GetDatum().
Referenced by extract_jsp_query().
|
static |
Definition at line 354 of file jsonb_gin.c.
References JsonPathGinNode::entryDatum, fb(), JSP_GIN_ENTRY, palloc(), JsonPathGinNode::type, and JsonPathGinNode::val.
Referenced by jsonb_ops__extract_nodes(), jsonb_path_ops__extract_nodes(), and make_jsp_entry_node_scalar().
|
static |
Definition at line 365 of file jsonb_gin.c.
References fb(), make_jsp_entry_node(), and make_scalar_key().
Referenced by jsonb_ops__extract_nodes().
|
static |
Definition at line 371 of file jsonb_gin.c.
References JsonPathGinNode::args, fb(), JsonPathGinNode::nargs, palloc(), type, JsonPathGinNode::type, and JsonPathGinNode::val.
Referenced by make_jsp_expr_node_args(), and make_jsp_expr_node_binary().
|
static |
Definition at line 383 of file jsonb_gin.c.
References JsonPathGinNode::args, fb(), i, lfirst, list_length(), make_jsp_expr_node(), and type.
Referenced by extract_jsp_path_expr().
|
static |
Definition at line 396 of file jsonb_gin.c.
References JsonPathGinNode::args, fb(), make_jsp_expr_node(), and type.
Referenced by extract_jsp_bool_expr(), and jsonb_ops__extract_nodes().
|
static |
Definition at line 1365 of file jsonb_gin.c.
References Assert, elog, ERROR, fb(), jbvBool, jbvNull, jbvNumeric, jbvString, JGINFLAG_BOOL, JGINFLAG_KEY, JGINFLAG_NULL, JGINFLAG_NUM, JGINFLAG_STR, make_text_key(), numeric_normalize(), and pfree().
Referenced by gin_extract_jsonb(), and make_jsp_entry_node_scalar().
Definition at line 1327 of file jsonb_gin.c.
References DatumGetUInt32(), fb(), flag(), hash_any(), JGIN_MAXLENGTH, JGINFLAG_HASHED, len, palloc(), PointerGetDatum(), SET_VARSIZE(), snprintf, str, VARDATA(), and VARHDRSZ.
Referenced by gin_extract_jsonb_query(), jsonb_ops__add_path_item(), and make_scalar_key().