49#define JUMBLE_SIZE 1024
70 int location,
int len);
88 int query_location = *location;
92 if (query_location >= 0)
94 Assert(query_location <= strlen(query));
95 query += query_location;
98 query_len = strlen(query);
100 Assert(query_len <= strlen(query));
106 query_len = strlen(query);
120 query++, query_location++, query_len--;
124 *location = query_location;
196#ifdef USE_ASSERT_CHECKING
197 jstate->total_jumble_len = 0;
237 unsigned char *jumble = jstate->
jumble;
250 memcpy(jumble + jumble_len, item, size);
253#ifdef USE_ASSERT_CHECKING
254 jstate->total_jumble_len += size;
275 memcpy(jumble, &start_hash,
sizeof(start_hash));
276 jumble_len =
sizeof(start_hash);
279 memcpy(jumble + jumble_len, item, part_size);
280 jumble_len += part_size;
284#ifdef USE_ASSERT_CHECKING
285 jstate->total_jumble_len += part_size;
478 foreach(temp, func->
args)
519 foreach(temp, elements)
528#define JUMBLE_NODE(item) \
529 _jumbleNode(jstate, (Node *) expr->item)
530#define JUMBLE_ELEMENTS(list, node) \
531 _jumbleElements(jstate, (List *) expr->list, node)
532#define JUMBLE_LOCATION(location) \
533 RecordConstLocation(jstate, false, expr->location, -1)
534#define JUMBLE_FIELD(item) \
536 if (sizeof(expr->item) == 8) \
537 AppendJumble64(jstate, (const unsigned char *) &(expr->item)); \
538 else if (sizeof(expr->item) == 4) \
539 AppendJumble32(jstate, (const unsigned char *) &(expr->item)); \
540 else if (sizeof(expr->item) == 2) \
541 AppendJumble16(jstate, (const unsigned char *) &(expr->item)); \
542 else if (sizeof(expr->item) == 1) \
543 AppendJumble8(jstate, (const unsigned char *) &(expr->item)); \
545 AppendJumble(jstate, (const unsigned char *) &(expr->item), sizeof(expr->item)); \
547#define JUMBLE_STRING(str) \
550 AppendJumble(jstate, (const unsigned char *) (expr->str), strlen(expr->str) + 1); \
552 AppendJumbleNull(jstate); \
555#define JUMBLE_CUSTOM(nodetype, item) \
556 _jumble##nodetype##_##item(jstate, expr, expr->item)
558#include "queryjumblefuncs.funcs.c"
564#ifdef USE_ASSERT_CHECKING
565 Size prev_jumble_len = jstate->total_jumble_len;
585#include "queryjumblefuncs.switch.c"
602 Assert(jstate->total_jumble_len > prev_jumble_len);
630 elog(
ERROR,
"unrecognized list node type: %d",
649 bool normalize_list =
false;
663 normalize_list =
true;
736 elog(
ERROR,
"unrecognized node type: %d",
#define pg_attribute_always_inline
static Datum hash_any_extended(const unsigned char *k, int keylen, uint64 seed)
Assert(PointerIsAligned(start, uint64))
void * repalloc(void *pointer, Size size)
#define IsA(nodeptr, _type_)
#define castNode(_type_, nodeptr)
static int list_length(const List *l)
#define foreach_current_index(var_or_cell)
static int64 DatumGetInt64(Datum X)
static bool IsQueryIdEnabled(void)
#define JUMBLE_NODE(item)
JumbleState * JumbleQuery(Query *query)
static void _jumbleNode(JumbleState *jstate, Node *node)
static void _jumbleVariableSetStmt(JumbleState *jstate, Node *node)
static bool IsSquashableConstantList(List *elements)
static bool IsSquashableConstant(Node *element)
static pg_attribute_always_inline void AppendJumbleInternal(JumbleState *jstate, const unsigned char *item, Size size)
static pg_attribute_always_inline void AppendJumbleNull(JumbleState *jstate)
static pg_noinline void AppendJumble8(JumbleState *jstate, const unsigned char *value)
#define JUMBLE_LOCATION(location)
static void _jumbleParam(JumbleState *jstate, Node *node)
const char * CleanQuerytext(const char *query, int *location, int *len)
static void _jumbleList(JumbleState *jstate, Node *node)
static void FlushPendingNulls(JumbleState *jstate)
static void RecordConstLocation(JumbleState *jstate, bool extern_param, int location, int len)
#define JUMBLE_STRING(str)
static pg_noinline void AppendJumble32(JumbleState *jstate, const unsigned char *value)
static pg_noinline void AppendJumble64(JumbleState *jstate, const unsigned char *value)
static void _jumbleA_Const(JumbleState *jstate, Node *node)
static void AppendJumble(JumbleState *jstate, const unsigned char *value, Size size)
static void _jumbleElements(JumbleState *jstate, List *elements, Node *node)
static pg_noinline void AppendJumble16(JumbleState *jstate, const unsigned char *value)
static int64 DoJumble(JumbleState *jstate, Node *node)
static void _jumbleRangeTblEntry_eref(JumbleState *jstate, RangeTblEntry *rte, Alias *expr)
static JumbleState * InitJumble(void)
#define JUMBLE_FIELD(item)
static chr element(struct vars *v, const chr *startp, const chr *endp)
bool scanner_isspace(char ch)
bool stack_is_too_deep(void)
void check_stack_depth(void)
unsigned int pending_nulls
int highest_extern_param_id
#define FirstGenbkiObjectId