diff options
| author | Michael Paquier | 2023-01-21 02:48:37 +0000 |
|---|---|---|
| committer | Michael Paquier | 2023-01-21 02:48:37 +0000 |
| commit | 8eba3e3f020843a7641121e778e161b58ec2e490 (patch) | |
| tree | 8736c44bf6ad786f6c55ca30bd44762e41bd54b3 /src/include/utils | |
| parent | 557890920dd03b5a7839e81deeb6099bd43f3b29 (diff) | |
Move queryjumble.c code to src/backend/nodes/
This will ease a follow-up move that will generate automatically this
code. The C file is renamed, for consistency with the node-related
files whose code are generated by gen_node_support.pl:
- queryjumble.c -> queryjumblefuncs.c
- utils/queryjumble.h -> nodes/queryjumble.h
Per a suggestion from Peter Eisentraut.
Reviewed-by: Peter Eisentraut
Discussion: https://postgr.es/m/Y5BHOUhX3zTH/ig6@paquier.xyz
Diffstat (limited to 'src/include/utils')
| -rw-r--r-- | src/include/utils/queryjumble.h | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/src/include/utils/queryjumble.h b/src/include/utils/queryjumble.h deleted file mode 100644 index d372801410..0000000000 --- a/src/include/utils/queryjumble.h +++ /dev/null @@ -1,86 +0,0 @@ -/*------------------------------------------------------------------------- - * - * queryjumble.h - * Query normalization and fingerprinting. - * - * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group - * Portions Copyright (c) 1994, Regents of the University of California - * - * IDENTIFICATION - * src/include/utils/queryjumble.h - * - *------------------------------------------------------------------------- - */ -#ifndef QUERYJUBLE_H -#define QUERYJUBLE_H - -#include "nodes/parsenodes.h" - -/* - * Struct for tracking locations/lengths of constants during normalization - */ -typedef struct LocationLen -{ - int location; /* start offset in query text */ - int length; /* length in bytes, or -1 to ignore */ -} LocationLen; - -/* - * Working state for computing a query jumble and producing a normalized - * query string - */ -typedef struct JumbleState -{ - /* 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 */ - LocationLen *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; -} JumbleState; - -/* Values for the compute_query_id GUC */ -enum ComputeQueryIdType -{ - COMPUTE_QUERY_ID_OFF, - COMPUTE_QUERY_ID_ON, - COMPUTE_QUERY_ID_AUTO, - COMPUTE_QUERY_ID_REGRESS -}; - -/* GUC parameters */ -extern PGDLLIMPORT int compute_query_id; - - -extern const char *CleanQuerytext(const char *query, int *location, int *len); -extern JumbleState *JumbleQuery(Query *query, const char *querytext); -extern void EnableQueryId(void); - -extern PGDLLIMPORT bool query_id_enabled; - -/* - * Returns whether query identifier computation has been enabled, either - * directly in the GUC or by a module when the setting is 'auto'. - */ -static inline bool -IsQueryIdEnabled(void) -{ - if (compute_query_id == COMPUTE_QUERY_ID_OFF) - return false; - if (compute_query_id == COMPUTE_QUERY_ID_ON) - return true; - return query_id_enabled; -} - -#endif /* QUERYJUMBLE_H */ |
