44#define JUMBLE_SIZE 1024
64 int location,
bool squashed);
81 int query_location = *location;
85 if (query_location >= 0)
87 Assert(query_location <= strlen(query));
88 query += query_location;
91 query_len = strlen(query);
93 Assert(query_len <= strlen(query));
99 query_len = strlen(query);
113 query++, query_location++, query_len--;
117 *location = query_location;
188#ifdef USE_ASSERT_CHECKING
189 jstate->total_jumble_len = 0;
225 unsigned char *jumble = jstate->
jumble;
238 memcpy(jumble + jumble_len, item, size);
241#ifdef USE_ASSERT_CHECKING
242 jstate->total_jumble_len += size;
263 memcpy(jumble, &start_hash,
sizeof(start_hash));
264 jumble_len =
sizeof(start_hash);
267 memcpy(jumble + jumble_len, item, part_size);
268 jumble_len += part_size;
272#ifdef USE_ASSERT_CHECKING
273 jstate->total_jumble_len += part_size;
436 foreach(temp, func->
args)
475 foreach(temp, elements)
482 *lastExpr =
llast(elements);
487#define JUMBLE_NODE(item) \
488 _jumbleNode(jstate, (Node *) expr->item)
489#define JUMBLE_ELEMENTS(list) \
490 _jumbleElements(jstate, (List *) expr->list)
491#define JUMBLE_LOCATION(location) \
492 RecordConstLocation(jstate, expr->location, false)
493#define JUMBLE_FIELD(item) \
495 if (sizeof(expr->item) == 8) \
496 AppendJumble64(jstate, (const unsigned char *) &(expr->item)); \
497 else if (sizeof(expr->item) == 4) \
498 AppendJumble32(jstate, (const unsigned char *) &(expr->item)); \
499 else if (sizeof(expr->item) == 2) \
500 AppendJumble16(jstate, (const unsigned char *) &(expr->item)); \
501 else if (sizeof(expr->item) == 1) \
502 AppendJumble8(jstate, (const unsigned char *) &(expr->item)); \
504 AppendJumble(jstate, (const unsigned char *) &(expr->item), sizeof(expr->item)); \
506#define JUMBLE_STRING(str) \
509 AppendJumble(jstate, (const unsigned char *) (expr->str), strlen(expr->str) + 1); \
511 AppendJumbleNull(jstate); \
514#define JUMBLE_CUSTOM(nodetype, item) \
515 _jumble##nodetype##_##item(jstate, expr, expr->item)
517#include "queryjumblefuncs.funcs.c"
559#ifdef USE_ASSERT_CHECKING
560 Size prev_jumble_len = jstate->total_jumble_len;
580#include "queryjumblefuncs.switch.c"
617 Assert(jstate->total_jumble_len > prev_jumble_len);
645 elog(
ERROR,
"unrecognized list node type: %d",
678 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)
int exprLocation(const Node *expr)
#define IsA(nodeptr, _type_)
static int list_length(const List *l)
static uint64 DatumGetUInt64(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 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 bool IsSquashableConst(Node *element)
const char * CleanQuerytext(const char *query, int *location, int *len)
static uint64 DoJumble(JumbleState *jstate, Node *node)
static void _jumbleList(JumbleState *jstate, Node *node)
static void FlushPendingNulls(JumbleState *jstate)
static void RecordConstLocation(JumbleState *jstate, int location, bool squashed)
static void _jumbleElements(JumbleState *jstate, List *elements)
#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 pg_noinline void AppendJumble16(JumbleState *jstate, const unsigned char *value)
static void _jumbleRangeTblEntry_eref(JumbleState *jstate, RangeTblEntry *rte, Alias *expr)
static bool IsSquashableConstList(List *elements, Node **firstExpr, Node **lastExpr)
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)
void check_stack_depth(void)
unsigned int pending_nulls
int highest_extern_param_id
#define FirstGenbkiObjectId