mirror of
https://github.com/postgres/postgres.git
synced 2026-03-21 18:10:25 -04:00
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
45 lines
1.2 KiB
C
45 lines
1.2 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* pquery.h
|
|
* prototypes for pquery.c.
|
|
*
|
|
*
|
|
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* src/include/tcop/pquery.h
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef PQUERY_H
|
|
#define PQUERY_H
|
|
|
|
#include "nodes/parsenodes.h"
|
|
#include "utils/portal.h"
|
|
|
|
|
|
extern PGDLLIMPORT Portal ActivePortal;
|
|
|
|
|
|
extern PortalStrategy ChoosePortalStrategy(List *stmts);
|
|
|
|
extern List *FetchPortalTargetList(Portal portal);
|
|
|
|
extern List *FetchStatementTargetList(Node *stmt);
|
|
|
|
extern void PortalStart(Portal portal, ParamListInfo params,
|
|
int eflags, Snapshot snapshot);
|
|
|
|
extern void PortalSetResultFormat(Portal portal, int nFormats,
|
|
int16 *formats);
|
|
|
|
extern bool PortalRun(Portal portal, long count, bool isTopLevel,
|
|
bool run_once, DestReceiver *dest, DestReceiver *altdest,
|
|
QueryCompletion *qc);
|
|
|
|
extern uint64 PortalRunFetch(Portal portal,
|
|
FetchDirection fdirection,
|
|
long count,
|
|
DestReceiver *dest);
|
|
|
|
#endif /* PQUERY_H */
|