Repository navigation
Expand file tree
/
Copy pathpg_stat_query_plans_parser.h
More file actions
67 lines (54 loc) · 2.12 KB
/
Copy pathpg_stat_query_plans_parser.h
File metadata and controls
67 lines (54 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef PGSTATQUERYPLANSP_H
#define PGSTATQUERYPLANSP_H
#if PG_VERSION_NUM < 140000
#define JUMBLE_SIZE 1024 /* query serialization
* buffer size */
/*
* Struct for tracking locations/lengths of constants during normalization
*/
typedef struct pgqpLocationLen
{
int location; /* start offset in query text */
int length; /* length in bytes, or -1 to ignore */
} pgqpLocationLen;
/*
* Working state for computing a query jumble and producing a normalized
* query string
*/
typedef struct pgqpJumbleState
{
/* Jumble of current query tree */
unsigned char *jumble;
/* Number of bytes used in jumble[] */
Size jumble_len;
/* Array of locations of constants that should be removed */
pgqpLocationLen *clocations;
/* Allocated length of clocations array */
int clocations_buf_size;
/* Current number of valid entries in clocations array */
int clocations_count;
/* highest Param id we've seen, in order to start normalization correctly */
int highest_extern_param_id;
} pgqpJumbleState;
void pgqpAppendJumble(pgqpJumbleState * jstate,
const unsigned char *item, Size size);
void pgqpJumbleQuery(pgqpJumbleState * jstate, Query *query);
void pgqpJumbleRangeTable(pgqpJumbleState * jstate, List *rtable);
void pgqpJumbleRowMarks(pgqpJumbleState * jstate, List *rowMarks);
void pgqpJumbleExpr(pgqpJumbleState * jstate, Node *node);
void pgqpRecordConstLocation(pgqpJumbleState * jstate, int location);
char *pgqp_gen_normquery(pgqpJumbleState * jstate, const char *query,
int query_loc, int *query_len_p);
void pgqp_fill_in_constant_lengths(pgqpJumbleState * jstate, const char *query,
int query_loc);
#elif PG_VERSION_NUM >= 190000
char *pgqp_gen_normquery(const JumbleState *jstate, const char *query,
int query_loc, int *query_len_p);
#else
char *pgqp_gen_normquery(JumbleState *jstate, const char *query,
int query_loc, int *query_len_p);
void pgqp_fill_in_constant_lengths(JumbleState *jstate, const char *query,
int query_loc);
#endif
int pgqp_comp_location(const void *a, const void *b);
#endif