I tried to write a trigger using C++. This requires to include the
following header-files:

extern "C" {
#include <postgres.h>
#include <executor/spi.h>
#include <commands/trigger.h>
#include <fmgr.h>

Unfortunately some of the included headers define some structs and
functions where a few identifiers are C++ keywords.
The compiler-directive 'extern "C"' does not help here, it just tells
the compiler not to mangle C-identifiers. 'extern "C"' does not rename
C++ keywords into something else. Therefore AFAIK, if someone wants to
include those headers files into a C++ program, the identifiers causing
problems have to be renamed manually.

For instance, Postgresql version 8.2.3
    List  *using;    /* USING clause, if any (list of String) */
'using' is a C++ keyword

    Oid   typeid;    /* type identified by OID */
'typeid' is a C++ keyword

    TypeName   *typename;
'typename' is a C++ keyword

extern char *quote_qualified_identifier(const char *namespace,
'namespace' is a C++ keyword

Is there any convention how to rename such identifiers? If I would
rename those identifiers (I simply would add an underscore to each of
them), would such a patch be accepted and adopted onto one of the next

Regards, Jacob

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at


Reply via email to