From 2f9661311b83dc481fc19f6e3bda015392010a40 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Mon, 2 Mar 2020 18:19:51 -0300 Subject: Represent command completion tags as structs The backend was using strings to represent command tags and doing string comparisons in multiple places, but that's slow and unhelpful. Create a new command list with a supporting structure to use instead; this is stored in a tag-list-file that can be tailored to specific purposes with a caller-definable C macro, similar to what we do for WAL resource managers. The first first such uses are a new CommandTag enum and a CommandTagBehavior struct. Replace numerous occurrences of char *completionTag with a QueryCompletion struct so that the code no longer stores information about completed queries in a cstring. Only at the last moment, in EndCommand(), does this get converted to a string. EventTriggerCacheItem no longer holds an array of palloc’d tag strings in sorted order, but rather just a Bitmapset over the CommandTags. Author: Mark Dilger, with unsolicited help from Álvaro Herrera Reviewed-by: John Naylor, Tom Lane Discussion: https://postgr.es/m/981A9DB4-3F0C-4DA5-88AD-CB9CFF4D6CAD@enterprisedb.com --- contrib/sepgsql/hooks.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'contrib/sepgsql/hooks.c') diff --git a/contrib/sepgsql/hooks.c b/contrib/sepgsql/hooks.c index 997a64c87e2..853b5b04ab8 100644 --- a/contrib/sepgsql/hooks.c +++ b/contrib/sepgsql/hooks.c @@ -317,7 +317,7 @@ sepgsql_utility_command(PlannedStmt *pstmt, ParamListInfo params, QueryEnvironment *queryEnv, DestReceiver *dest, - char *completionTag) + QueryCompletion *qc) { Node *parsetree = pstmt->utilityStmt; sepgsql_context_info_t saved_context_info = sepgsql_context_info; @@ -380,11 +380,11 @@ sepgsql_utility_command(PlannedStmt *pstmt, if (next_ProcessUtility_hook) (*next_ProcessUtility_hook) (pstmt, queryString, context, params, queryEnv, - dest, completionTag); + dest, qc); else standard_ProcessUtility(pstmt, queryString, context, params, queryEnv, - dest, completionTag); + dest, qc); } PG_FINALLY(); { -- cgit v1.2.3