PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "common/hashfn.h"
#include "miscadmin.h"
#include "parser/scansup.h"
#include "utils/queryjumble.h"
Go to the source code of this file.
Macros | |
#define | JUMBLE_SIZE 1024 /* query serialization buffer size */ |
#define | APP_JUMB(item) AppendJumble(jstate, (const unsigned char *) &(item), sizeof(item)) |
#define | APP_JUMB_STRING(str) AppendJumble(jstate, (const unsigned char *) (str), strlen(str) + 1) |
Functions | |
static uint64 | compute_utility_query_id (const char *str, int query_location, int query_len) |
static void | AppendJumble (JumbleState *jstate, const unsigned char *item, Size size) |
static void | JumbleQueryInternal (JumbleState *jstate, Query *query) |
static void | JumbleRangeTable (JumbleState *jstate, List *rtable) |
static void | JumbleRowMarks (JumbleState *jstate, List *rowMarks) |
static void | JumbleExpr (JumbleState *jstate, Node *node) |
static void | RecordConstLocation (JumbleState *jstate, int location) |
const char * | CleanQuerytext (const char *query, int *location, int *len) |
JumbleState * | JumbleQuery (Query *query, const char *querytext) |
void | EnableQueryId (void) |
Variables | |
int | compute_query_id = COMPUTE_QUERY_ID_AUTO |
bool | query_id_enabled = false |
#define APP_JUMB | ( | item | ) | AppendJumble(jstate, (const unsigned char *) &(item), sizeof(item)) |
Definition at line 225 of file queryjumble.c.
#define APP_JUMB_STRING | ( | str | ) | AppendJumble(jstate, (const unsigned char *) (str), strlen(str) + 1) |
Definition at line 227 of file queryjumble.c.
#define JUMBLE_SIZE 1024 /* query serialization buffer size */ |
Definition at line 40 of file queryjumble.c.
|
static |
Definition at line 189 of file queryjumble.c.
References DatumGetUInt64, hash_any_extended(), JumbleState::jumble, JumbleState::jumble_len, JUMBLE_SIZE, and Min.
const char* CleanQuerytext | ( | const char * | query, |
int * | location, | ||
int * | len | ||
) |
Definition at line 62 of file queryjumble.c.
References Assert(), len, and scanner_isspace().
Referenced by compute_utility_query_id(), and pgss_store().
|
static |
Definition at line 160 of file queryjumble.c.
References CleanQuerytext(), DatumGetUInt64, and hash_any_extended().
Referenced by JumbleQuery().
void EnableQueryId | ( | void | ) |
Definition at line 150 of file queryjumble.c.
References compute_query_id, COMPUTE_QUERY_ID_OFF, and query_id_enabled.
Referenced by _PG_init().
|
static |
Definition at line 359 of file queryjumble.c.
References JsonConstructorExpr::absent_on_null, OnConflictExpr::action, Aggref::aggdirectargs, Aggref::aggdistinct, Aggref::aggfilter, WindowFunc::aggfilter, Aggref::aggfnoid, GroupingFunc::agglevelsup, Aggref::aggorder, SetOperationStmt::all, APP_JUMB, APP_JUMB_STRING, OnConflictExpr::arbiterElems, OnConflictExpr::arbiterWhere, NamedArgExpr::arg, FieldSelect::arg, FieldStore::arg, RelabelType::arg, CoerceViaIO::arg, ArrayCoerceExpr::arg, ConvertRowtypeExpr::arg, CollateExpr::arg, CaseExpr::arg, NullTest::arg, BooleanTest::arg, CoerceToDomain::arg, NamedArgExpr::argnumber, generate_unaccent_rules::args, TableSampleClause::args, Aggref::args, WindowFunc::args, FuncExpr::args, OpExpr::args, ScalarArrayOpExpr::args, BoolExpr::args, CaseExpr::args, MinMaxExpr::args, XmlExpr::args, JsonConstructorExpr::args, BoolExpr::boolop, BooleanTest::booltesttype, JsonBehavior::btype, castNode, check_stack_depth(), JsonConstructorExpr::coercion, TableFunc::colexprs, CollateExpr::collOid, TableFunc::colvalexprs, OnConflictExpr::constraint, GroupingSet::content, CommonTableExpr::ctematerialized, CommonTableExpr::ctename, CommonTableExpr::ctequery, CurrentOfExpr::cursor_name, CurrentOfExpr::cursor_param, CurrentOfExpr::cvarno, JsonBehavior::default_expr, CaseExpr::defresult, TableFunc::docexpr, ArrayCoerceExpr::elemexpr, elog, WindowClause::endOffset, SortGroupClause::eqop, OnConflictExpr::exclRelIndex, OnConflictExpr::exclRelTlist, JsonIsPredicate::expr, InferenceElem::expr, TargetEntry::expr, FieldSelect::fieldnum, format, JsonReturning::format, JsonValueExpr::format, JsonIsPredicate::format, JsonValueExpr::formatted_expr, JsonExpr::formatted_expr, WindowClause::frameOptions, FromExpr::fromlist, JsonConstructorExpr::func, RangeTblFunction::funcexpr, FuncExpr::funcid, TableFunc::functype, JumbleState::highest_extern_param_id, InferenceElem::infercollid, InferenceElem::inferopclass, JoinExpr::isNatural, JsonIsPredicate::item_type, JoinExpr::jointype, JumbleQueryInternal(), SetOperationStmt::larg, JoinExpr::larg, RowCompareExpr::largs, lfirst, lfirst_int, lfirst_node, XmlExpr::named_args, FieldStore::newvals, nodeTag, SortGroupClause::nulls_first, NullTest::nulltesttype, JsonExpr::on_empty, JsonExpr::on_error, OnConflictExpr::onConflictSet, OnConflictExpr::onConflictWhere, SetOperationStmt::op, MinMaxExpr::op, SQLValueFunction::op, XmlExpr::op, JsonExpr::op, OpExpr::opno, ScalarArrayOpExpr::opno, WindowClause::orderClause, PARAM_EXTERN, Param::paramid, Param::paramkind, Param::paramtype, WindowClause::partitionClause, JsonExpr::passing_names, JsonExpr::passing_values, JsonExpr::path_spec, JoinExpr::quals, FromExpr::quals, SetOperationStmt::rarg, JoinExpr::rarg, RowCompareExpr::rargs, JsonValueExpr::raw_expr, RowCompareExpr::rctype, RecordConstLocation(), SubscriptingRef::refassgnexpr, SubscriptingRef::refexpr, SubscriptingRef::reflowerindexpr, GroupingFunc::refs, SubscriptingRef::refupperindexpr, TableSampleClause::repeatable, TargetEntry::resno, TargetEntry::ressortgroupref, RelabelType::resulttype, CoerceViaIO::resulttype, ArrayCoerceExpr::resulttype, ConvertRowtypeExpr::resulttype, CoerceToDomain::resulttype, JsonConstructorExpr::returning, TableFunc::rowexpr, RangeTblRef::rtindex, JoinExpr::rtindex, NextValueExpr::seqid, SortGroupClause::sortop, WindowClause::startOffset, SubLink::subLinkId, SubLink::subLinkType, SubLink::subselect, T_Aggref, T_ArrayCoerceExpr, T_ArrayExpr, T_BooleanTest, T_BoolExpr, T_CaseExpr, T_CaseTestExpr, T_CoalesceExpr, T_CoerceToDomain, T_CoerceToDomainValue, T_CoerceViaIO, T_CollateExpr, T_CommonTableExpr, T_Const, T_ConvertRowtypeExpr, T_CurrentOfExpr, T_DistinctExpr, T_FieldSelect, T_FieldStore, T_FromExpr, T_FuncExpr, T_GroupingFunc, T_GroupingSet, T_InferenceElem, T_IntList, T_JoinExpr, T_JsonConstructorExpr, T_JsonExpr, T_JsonFormat, T_JsonIsPredicate, T_JsonReturning, T_JsonValueExpr, T_List, T_MinMaxExpr, T_NamedArgExpr, T_NextValueExpr, T_NullIfExpr, T_NullTest, T_OnConflictExpr, T_OpExpr, T_Param, T_RangeTblFunction, T_RangeTblRef, T_RelabelType, T_RowCompareExpr, T_RowExpr, T_ScalarArrayOpExpr, T_SetOperationStmt, T_SetToDefault, T_SortGroupClause, T_SQLValueFunction, T_SubLink, T_SubscriptingRef, T_TableFunc, T_TableSampleClause, T_TargetEntry, T_Var, T_WindowClause, T_WindowFunc, T_XmlExpr, SubLink::testexpr, SortGroupClause::tleSortGroupRef, TableSampleClause::tsmhandler, Node::type, JsonConstructorExpr::type, CaseTestExpr::typeId, CoerceToDomainValue::typeId, SetToDefault::typeId, NextValueExpr::typeId, JsonReturning::typid, SQLValueFunction::typmod, JsonReturning::typmod, JsonConstructorExpr::unique, JsonIsPredicate::unique_keys, ScalarArrayOpExpr::useOr, Var::varattno, Var::varlevelsup, Var::varno, WARNING, WindowFunc::winfnoid, WindowClause::winref, and WindowFunc::winref.
Referenced by JumbleQueryInternal(), and JumbleRangeTable().
JumbleState* JumbleQuery | ( | Query * | query, |
const char * | querytext | ||
) |
Definition at line 101 of file queryjumble.c.
References Assert(), JumbleState::clocations, JumbleState::clocations_buf_size, JumbleState::clocations_count, compute_utility_query_id(), DatumGetUInt64, hash_any_extended(), JumbleState::highest_extern_param_id, IsQueryIdEnabled(), JumbleState::jumble, JumbleState::jumble_len, JUMBLE_SIZE, JumbleQueryInternal(), palloc(), Query::queryId, Query::stmt_len, Query::stmt_location, and Query::utilityStmt.
Referenced by ExplainQuery(), parse_analyze_fixedparams(), parse_analyze_varparams(), and parse_analyze_withcb().
|
static |
Definition at line 240 of file queryjumble.c.
References APP_JUMB, Assert(), Query::commandType, Query::cteList, Query::distinctClause, Query::groupClause, Query::groupDistinct, Query::groupingSets, Query::havingQual, IsA, Query::jointree, JumbleExpr(), JumbleRangeTable(), JumbleRowMarks(), Query::limitCount, Query::limitOffset, Query::limitOption, Query::onConflict, Query::returningList, Query::rowMarks, Query::rtable, Query::setOperations, Query::sortClause, Query::targetList, Query::utilityStmt, and Query::windowClause.
Referenced by JumbleExpr(), JumbleQuery(), and JumbleRangeTable().
|
static |
Definition at line 271 of file queryjumble.c.
References APP_JUMB, APP_JUMB_STRING, RangeTblEntry::ctelevelsup, RangeTblEntry::ctename, elog, RangeTblEntry::enrname, ERROR, RangeTblEntry::functions, RangeTblEntry::inh, RangeTblEntry::jointype, JumbleExpr(), JumbleQueryInternal(), lfirst_node, RangeTblEntry::relid, RTE_CTE, RTE_FUNCTION, RTE_JOIN, RTE_NAMEDTUPLESTORE, RTE_RELATION, RTE_RESULT, RTE_SUBQUERY, RTE_TABLEFUNC, RTE_VALUES, RangeTblEntry::rtekind, RangeTblEntry::subquery, RangeTblEntry::tablefunc, RangeTblEntry::tablesample, and RangeTblEntry::values_lists.
Referenced by JumbleQueryInternal().
|
static |
Definition at line 327 of file queryjumble.c.
References APP_JUMB, lfirst_node, RowMarkClause::pushedDown, RowMarkClause::rti, RowMarkClause::strength, and RowMarkClause::waitPolicy.
Referenced by JumbleQueryInternal().
|
static |
Definition at line 911 of file queryjumble.c.
References JumbleState::clocations, JumbleState::clocations_buf_size, JumbleState::clocations_count, LocationLen::length, LocationLen::location, and repalloc().
Referenced by JumbleExpr().
int compute_query_id = COMPUTE_QUERY_ID_AUTO |
Definition at line 43 of file queryjumble.c.
Referenced by EnableQueryId(), ExplainOnePlan(), and IsQueryIdEnabled().
Definition at line 46 of file queryjumble.c.
Referenced by EnableQueryId(), and IsQueryIdEnabled().