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 |
Typedefs | |
typedef struct PathHashStack | PathHashStack |
typedef struct GinEntries | GinEntries |
typedef enum JsonPathGinNodeType | JsonPathGinNodeType |
typedef struct JsonPathGinNode | JsonPathGinNode |
typedef struct JsonPathGinPathItem | JsonPathGinPathItem |
typedef union JsonPathGinPath | JsonPathGinPath |
typedef struct JsonPathGinContext | JsonPathGinContext |
typedef bool(* | JsonPathGinAddPathItemFunc) (JsonPathGinPath *path, JsonPathItem *jsp) |
typedef List *(* | JsonPathGinExtractNodesFunc) (JsonPathGinContext *cxt, JsonPathGinPath path, JsonbValue *scalar, List *nodes) |
Enumerations | |
enum | JsonPathGinNodeType { JSP_GIN_OR , JSP_GIN_AND , JSP_GIN_ENTRY } |
typedef struct GinEntries GinEntries |
typedef bool(* JsonPathGinAddPathItemFunc) (JsonPathGinPath *path, JsonPathItem *jsp) |
Definition at line 134 of file jsonb_gin.c.
typedef struct JsonPathGinContext JsonPathGinContext |
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.
typedef struct JsonPathGinNode JsonPathGinNode |
Definition at line 94 of file jsonb_gin.c.
typedef enum JsonPathGinNodeType JsonPathGinNodeType |
typedef union JsonPathGinPath JsonPathGinPath |
typedef struct JsonPathGinPathItem JsonPathGinPathItem |
typedef struct PathHashStack PathHashStack |
enum JsonPathGinNodeType |
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(), and repalloc().
Referenced by emit_jsp_gin_entries(), gin_extract_jsonb(), and gin_extract_jsonb_path().
|
static |
Definition at line 719 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 799 of file jsonb_gin.c.
References JsonPathGinNode::args, elog, JsonPathGinNode::entryIndex, ERROR, execute_jsp_gin_node(), GIN_FALSE, GIN_MAYBE, GIN_TRUE, i, JSP_GIN_AND, JSP_GIN_ENTRY, JSP_GIN_OR, JsonPathGinNode::nargs, res, 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 583 of file jsonb_gin.c.
References arg, check_stack_depth(), JsonPathItem::content, JsonPathItem::data, JsonPathItem::datalen, elog, ERROR, extract_jsp_bool_expr(), extract_jsp_path_expr(), 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, JsonPathItem::type, JsonbValue::val, and JsonPathItem::value.
Referenced by extract_jsp_bool_expr(), extract_jsp_path_expr_nodes(), and extract_jsp_query().
|
static |
Definition at line 564 of file jsonb_gin.c.
References extract_jsp_path_expr_nodes(), 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 504 of file jsonb_gin.c.
References JsonPathGinContext::add_path_item, arg, extract_jsp_bool_expr(), JsonPathGinContext::extract_nodes, jpiCurrent, jpiFilter, jspGetArg(), jspGetNext(), lappend(), next, NIL, and JsonPathItem::type.
Referenced by extract_jsp_path_expr().
|
static |
Definition at line 748 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, JsonPath::header, 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(), and root.
Referenced by gin_extract_jsonb_query(), and gin_extract_jsonb_query_path().
Datum gin_compare_jsonb | ( | PG_FUNCTION_ARGS | ) |
Definition at line 203 of file jsonb_gin.c.
References 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 929 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_POINTER, PG_GETARG_UINT16, PG_RETURN_BOOL, and res.
Datum gin_consistent_jsonb_path | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1220 of file jsonb_gin.c.
References Assert, elog, ERROR, execute_jsp_gin_node(), GIN_FALSE, i, JsonbContainsStrategyNumber, JsonbJsonpathExistsStrategyNumber, JsonbJsonpathPredicateStrategyNumber, PG_GETARG_INT32, PG_GETARG_POINTER, PG_GETARG_UINT16, PG_RETURN_BOOL, and res.
Datum gin_extract_jsonb | ( | PG_FUNCTION_ARGS | ) |
Definition at line 229 of file jsonb_gin.c.
References add_gin_entry(), GinEntries::buf, GinEntries::count, init_gin_entries(), JB_ROOT_COUNT, jbvString, JsonbIteratorInit(), JsonbIteratorNext(), make_scalar_key(), PG_GETARG_JSONB_P, PG_GETARG_POINTER, PG_RETURN_POINTER, Jsonb::root, 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 1090 of file jsonb_gin.c.
References add_gin_entry(), GinEntries::buf, GinEntries::count, elog, ERROR, PathHashStack::hash, init_gin_entries(), JB_ROOT_COUNT, JsonbHashScalarValue(), JsonbIteratorInit(), JsonbIteratorNext(), palloc(), PathHashStack::parent, pfree(), PG_GETARG_JSONB_P, PG_GETARG_POINTER, PG_RETURN_POINTER, Jsonb::root, 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 848 of file jsonb_gin.c.
References DatumGetPointer(), deconstruct_array_builtin(), DirectFunctionCall2, elog, ERROR, extract_jsp_query(), gin_extract_jsonb(), GIN_SEARCH_MODE_ALL, i, j, JGINFLAG_KEY, JsonbContainsStrategyNumber, JsonbExistsAllStrategyNumber, JsonbExistsAnyStrategyNumber, JsonbExistsStrategyNumber, JsonbJsonpathExistsStrategyNumber, JsonbJsonpathPredicateStrategyNumber, make_text_key(), palloc(), 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 1180 of file jsonb_gin.c.
References DatumGetPointer(), DirectFunctionCall2, elog, ERROR, extract_jsp_query(), 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 1013 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_POINTER, PG_GETARG_UINT16, PG_RETURN_GIN_TERNARY_VALUE, and res.
Datum gin_triconsistent_jsonb_path | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1272 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_POINTER, PG_GETARG_UINT16, PG_RETURN_GIN_TERNARY_VALUE, and res.
|
static |
Definition at line 163 of file jsonb_gin.c.
References GinEntries::allocated, GinEntries::buf, GinEntries::count, and palloc().
Referenced by gin_extract_jsonb(), and gin_extract_jsonb_path().
|
static |
Definition at line 278 of file jsonb_gin.c.
References JsonPathGinPath::items, JGINFLAG_KEY, jpiAny, jpiAnyArray, jpiAnyKey, jpiIndexArray, jpiKey, jpiRoot, jspGetString(), sort-test::key, JsonPathGinPathItem::keyName, len, make_text_key(), palloc(), JsonPathGinPathItem::parent, PointerGetDatum(), JsonPathGinPathItem::type, and JsonPathItem::type.
Referenced by extract_jsp_query().
|
static |
Definition at line 408 of file jsonb_gin.c.
References GIN_FALSE, GIN_MAYBE, GIN_TRUE, JsonPathGinPath::items, jbvString, jpiAny, jpiAnyArray, jpiIndexArray, jpiKey, JSP_GIN_OR, JsonPathGinPathItem::keyName, lappend(), JsonPathGinContext::lax, make_jsp_entry_node(), make_jsp_entry_node_scalar(), make_jsp_expr_node_binary(), JsonPathGinPathItem::parent, JsonPathGinPathItem::type, and JsonbValue::type.
Referenced by extract_jsp_query().
|
static |
Definition at line 323 of file jsonb_gin.c.
References JsonPathGinPath::hash, jbvString, jpiAnyArray, jpiIndexArray, jpiKey, jpiRoot, JsonbHashScalarValue(), jspGetString(), JsonbValue::type, JsonPathItem::type, and JsonbValue::val.
Referenced by extract_jsp_query().
|
static |
Definition at line 478 of file jsonb_gin.c.
References hash(), JsonPathGinPath::hash, JsonbHashScalarValue(), lappend(), make_jsp_entry_node(), and UInt32GetDatum().
Referenced by extract_jsp_query().
|
static |
Definition at line 353 of file jsonb_gin.c.
References generate_unaccent_rules::args, JsonPathGinNode::entryDatum, 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 364 of file jsonb_gin.c.
References make_jsp_entry_node(), and make_scalar_key().
Referenced by jsonb_ops__extract_nodes().
|
static |
Definition at line 370 of file jsonb_gin.c.
References generate_unaccent_rules::args, JsonPathGinNode::args, 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 382 of file jsonb_gin.c.
References generate_unaccent_rules::args, JsonPathGinNode::args, i, lfirst, list_length(), make_jsp_expr_node(), and type.
Referenced by extract_jsp_path_expr().
|
static |
Definition at line 395 of file jsonb_gin.c.
References JsonPathGinNode::args, make_jsp_expr_node(), and type.
Referenced by extract_jsp_bool_expr(), and jsonb_ops__extract_nodes().
|
static |
Definition at line 1364 of file jsonb_gin.c.
References Assert, elog, ERROR, jbvBool, jbvNull, jbvNumeric, jbvString, JGINFLAG_BOOL, JGINFLAG_KEY, JGINFLAG_NULL, JGINFLAG_NUM, JGINFLAG_STR, make_text_key(), numeric_normalize(), pfree(), JsonbValue::type, and JsonbValue::val.
Referenced by gin_extract_jsonb(), and make_jsp_entry_node_scalar().
|
static |
Definition at line 1326 of file jsonb_gin.c.
References DatumGetUInt32(), 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().