51#define JUMBLE_SIZE 1024
72 int location,
int len);
100 query_len =
strlen(query);
108 query_len =
strlen(query);
191 jstate->clocations_buf_size = 32;
194 jstate->clocations_count = 0;
195 jstate->highest_extern_param_id = 0;
196 jstate->pending_nulls = 0;
197 jstate->has_squashed_lists =
false;
198#ifdef USE_ASSERT_CHECKING
199 jstate->total_jumble_len = 0;
217 if (
jstate->pending_nulls > 0)
221 if (
jstate->has_squashed_lists)
222 jstate->highest_extern_param_id = 0;
239 unsigned char *jumble =
jstate->jumble;
252 memcpy(jumble + jumble_len, item, size);
253 jstate->jumble_len += size;
255#ifdef USE_ASSERT_CHECKING
256 jstate->total_jumble_len += size;
286#ifdef USE_ASSERT_CHECKING
291 jstate->jumble_len = jumble_len;
301 if (
jstate->pending_nulls > 0)
324 if (
jstate->pending_nulls > 0)
338 if (
jstate->pending_nulls > 0)
352 if (
jstate->pending_nulls > 0)
366 if (
jstate->pending_nulls > 0)
384 (
const unsigned char *) &
jstate->pending_nulls, 4);
385 jstate->pending_nulls = 0;
406 if (
jstate->clocations_count >=
jstate->clocations_buf_size)
408 jstate->clocations_buf_size *= 2;
411 jstate->clocations_buf_size *
414 jstate->clocations[
jstate->clocations_count].location = location;
423 jstate->clocations[
jstate->clocations_count].extern_param = extern_param;
424 jstate->clocations_count++;
521 foreach(
temp, elements)
530#define JUMBLE_NODE(item) \
531 _jumbleNode(jstate, (Node *) expr->item)
532#define JUMBLE_ELEMENTS(list, node) \
533 _jumbleElements(jstate, (List *) expr->list, node)
534#define JUMBLE_LOCATION(location) \
535 RecordConstLocation(jstate, false, expr->location, -1)
536#define JUMBLE_FIELD(item) \
538 if (sizeof(expr->item) == 8) \
539 AppendJumble64(jstate, (const unsigned char *) &(expr->item)); \
540 else if (sizeof(expr->item) == 4) \
541 AppendJumble32(jstate, (const unsigned char *) &(expr->item)); \
542 else if (sizeof(expr->item) == 2) \
543 AppendJumble16(jstate, (const unsigned char *) &(expr->item)); \
544 else if (sizeof(expr->item) == 1) \
545 AppendJumble8(jstate, (const unsigned char *) &(expr->item)); \
547 AppendJumble(jstate, (const unsigned char *) &(expr->item), sizeof(expr->item)); \
549#define JUMBLE_STRING(str) \
552 AppendJumble(jstate, (const unsigned char *) (expr->str), strlen(expr->str) + 1); \
554 AppendJumbleNull(jstate); \
557#define JUMBLE_CUSTOM(nodetype, item) \
558 _jumble##nodetype##_##item(jstate, expr, expr->item)
560#include "queryjumblefuncs.funcs.c"
566#ifdef USE_ASSERT_CHECKING
587#include "queryjumblefuncs.switch.c"
632 elog(
ERROR,
"unrecognized list node type: %d",
659 if (
aexpr->list_start > 0 &&
aexpr->list_end > 0)
663 aexpr->list_start + 1,
666 jstate->has_squashed_lists =
true;
738 elog(
ERROR,
"unrecognized node type: %d",
831 if (
jstate->clocations_count == 0)
842 if (
jstate->clocations_count > 1)
853 for (
int i = 0;
i <
jstate->clocations_count;
i++)
859 if (
i > 0 &&
locs[
i].location ==
locs[
i - 1].location)
865 if (
locs[
i].squashed)
894 if (query[loc] ==
'-')
#define Assert(condition)
#define pg_attribute_always_inline
memcpy(sums, checksumBaseOffsets, sizeof(checksumBaseOffsets))
#define palloc_object(type)
#define palloc_array(type, count)
static Datum hash_any_extended(const unsigned char *k, int keylen, uint64 seed)
static int pg_cmp_s32(int32 a, int32 b)
PGDLLIMPORT const ScanKeywordList ScanKeywords
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)
#define qsort(a, b, c, d)
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 int CompLocation(const void *a, const void *b)
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)
LocationLen * ComputeConstantLengths(const JumbleState *jstate, const char *query, int query_loc)
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)
core_yyscan_t scanner_init(const char *str, core_yy_extra_type *yyext, const ScanKeywordList *keywordlist, const uint16 *keyword_tokens)
void scanner_finish(core_yyscan_t yyscanner)
const uint16 ScanKeywordTokens[]
int core_yylex(core_YYSTYPE *yylval_param, YYLTYPE *yylloc_param, core_yyscan_t yyscanner)
bool scanner_isspace(char ch)
bool stack_is_too_deep(void)
void check_stack_depth(void)
#define FirstGenbkiObjectId