Re: Portal->commandTag as an enum - Mailing list pgsql-hackers

From John Naylor
Subject Re: Portal->commandTag as an enum
Date
Msg-id CACPNZCvSsdvQifqDkVLRb5jC2_yd3xu1OH+kAHWKXc5m7UsPsw@mail.gmail.com
Whole thread Raw
In response to Re: Portal->commandTag as an enum  (John Naylor <john.naylor@2ndquadrant.com>)
Responses Re: Portal->commandTag as an enum
List pgsql-hackers
Thinking about this some more, would it be possible to treat these
like we do parser/kwlist.h? Something like this:

commandtag_list.h:
PG_COMMANDTAG(ALTER_ACCESS_METHOD, "ALTER ACCESS METHOD", true, false,
false, false)
...

then, just:

#define PG_COMMANDTAG(taglabel, tagname, event_trigger, table_rewrite,
display_rowcount, display_oid) label,

typedef enum CommandTag
{
#include "commandtag_list.h"
}

#undef PG_COMMANDTAG

...and then:

#define PG_COMMANDTAG(taglabel, tagname, event_trigger, table_rewrite,
display_rowcount, display_oid) \
{ tagname, event_trigger, table_rewrite, display_rowcount, display_oid },

const CommandTagBehavior tag_behavior[] =
{
#include "commandtag_list.h"
}

#undef PG_COMMANDTAG

I'm hand-waving a bit, and it doesn't have the flexibility of a .dat
file, but it's a whole lot simpler.

-- 
John Naylor                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: [Patch] Make pg_checksums skip foreign tablespace directories
Next
From: Peter Eisentraut
Date:
Subject: Re: backend type in log_line_prefix?