PostgreSQL Source Code  git master
cmdtag.c File Reference
#include "postgres.h"
#include "miscadmin.h"
#include "tcop/cmdtag.h"
#include "tcop/cmdtaglist.h"
Include dependency graph for cmdtag.c:

Go to the source code of this file.

Data Structures

struct  CommandTagBehavior
 

Macros

#define PG_CMDTAG(tag, name, evtrgok, rwrok, rowcnt)   { name, evtrgok, rwrok, rowcnt },
 

Typedefs

typedef struct CommandTagBehavior CommandTagBehavior
 

Functions

void InitializeQueryCompletion (QueryCompletion *qc)
 
const char * GetCommandTagName (CommandTag commandTag)
 
bool command_tag_display_rowcount (CommandTag commandTag)
 
bool command_tag_event_trigger_ok (CommandTag commandTag)
 
bool command_tag_table_rewrite_ok (CommandTag commandTag)
 
CommandTag GetCommandTagEnum (const char *commandname)
 

Variables

const CommandTagBehavior tag_behavior [COMMAND_TAG_NEXTTAG]
 

Macro Definition Documentation

◆ PG_CMDTAG

#define PG_CMDTAG (   tag,
  name,
  evtrgok,
  rwrok,
  rowcnt 
)    { name, evtrgok, rwrok, rowcnt },

Definition at line 28 of file cmdtag.c.

Typedef Documentation

◆ CommandTagBehavior

Function Documentation

◆ command_tag_display_rowcount()

bool command_tag_display_rowcount ( CommandTag  commandTag)

Definition at line 51 of file cmdtag.c.

References CommandTagBehavior::display_rowcount.

Referenced by CopyQueryCompletion(), and EndCommand().

52 {
53  return tag_behavior[commandTag].display_rowcount;
54 }
const CommandTagBehavior tag_behavior[COMMAND_TAG_NEXTTAG]
Definition: cmdtag.c:31
const bool display_rowcount
Definition: cmdtag.c:25

◆ command_tag_event_trigger_ok()

bool command_tag_event_trigger_ok ( CommandTag  commandTag)

Definition at line 57 of file cmdtag.c.

References CommandTagBehavior::event_trigger_ok.

Referenced by CopyQueryCompletion(), EventTriggerCommonSetup(), and validate_ddl_tags().

58 {
59  return tag_behavior[commandTag].event_trigger_ok;
60 }
const bool event_trigger_ok
Definition: cmdtag.c:23
const CommandTagBehavior tag_behavior[COMMAND_TAG_NEXTTAG]
Definition: cmdtag.c:31

◆ command_tag_table_rewrite_ok()

bool command_tag_table_rewrite_ok ( CommandTag  commandTag)

Definition at line 63 of file cmdtag.c.

References CommandTagBehavior::table_rewrite_ok.

Referenced by CopyQueryCompletion(), EventTriggerCommonSetup(), and validate_table_rewrite_tags().

64 {
65  return tag_behavior[commandTag].table_rewrite_ok;
66 }
const bool table_rewrite_ok
Definition: cmdtag.c:24
const CommandTagBehavior tag_behavior[COMMAND_TAG_NEXTTAG]
Definition: cmdtag.c:31

◆ GetCommandTagEnum()

CommandTag GetCommandTagEnum ( const char *  commandname)

Definition at line 74 of file cmdtag.c.

References lengthof, CommandTagBehavior::name, pg_strcasecmp(), and tag_behavior.

Referenced by CopyQueryCompletion(), DecodeTextArrayToBitmapset(), validate_ddl_tags(), and validate_table_rewrite_tags().

75 {
76  const CommandTagBehavior *base,
77  *last,
78  *position;
79  int result;
80 
81  if (commandname == NULL || *commandname == '\0')
82  return CMDTAG_UNKNOWN;
83 
84  base = tag_behavior;
85  last = tag_behavior + lengthof(tag_behavior) - 1;
86  while (last >= base)
87  {
88  position = base + ((last - base) >> 1);
89  result = pg_strcasecmp(commandname, position->name);
90  if (result == 0)
91  return (CommandTag) (position - tag_behavior);
92  else if (result < 0)
93  last = position - 1;
94  else
95  base = position + 1;
96  }
97  return CMDTAG_UNKNOWN;
98 }
CommandTag
Definition: cmdtag.h:20
const char * name
Definition: cmdtag.c:22
int pg_strcasecmp(const char *s1, const char *s2)
Definition: pgstrcasecmp.c:36
#define lengthof(array)
Definition: c.h:668
const CommandTagBehavior tag_behavior[COMMAND_TAG_NEXTTAG]
Definition: cmdtag.c:31

◆ GetCommandTagName()

const char* GetCommandTagName ( CommandTag  commandTag)

◆ InitializeQueryCompletion()

void InitializeQueryCompletion ( QueryCompletion qc)

Definition at line 38 of file cmdtag.c.

References QueryCompletion::commandTag, and QueryCompletion::nprocessed.

Referenced by _SPI_execute_plan(), CopyQueryCompletion(), FillPortalStore(), and PortalRun().

39 {
40  qc->commandTag = CMDTAG_UNKNOWN;
41  qc->nprocessed = 0;
42 }
uint64 nprocessed
Definition: cmdtag.h:31
CommandTag commandTag
Definition: cmdtag.h:30

Variable Documentation

◆ tag_behavior

Definition at line 31 of file cmdtag.c.

Referenced by GetCommandTagEnum().