I want to write a function that takes the raw parsetree and rewrites it 
according to my rules, then produce new raw parsetrees.

I will call this function inside backend/tcop/postgres.c . I wrote an header 
file called my_rewriter.h and include this inside postgres.c.

my_writer.h looks like:

#include "nodes/pg_list.h"
#include "nodes/nodes.h"

typedef struct my_Projection
    char *relname;
    List attnames;
    char *result_relname;

} my_Projection;


extern void  my_analyze(Node *parsetree);
extern void my_rewrite(List *parsetree_list);


Then I wrote a C file called my_writer.c, and do the implementation of 
my_analyze(Node *parsetree) and my_rewrite(List *parsetree_list) functions.  I 
need Node and List structures here, but when I include the necessary header 
files (#include "nodes/pg_list.h", #include "nodes/nodes.h"), I got errors at 
compile time like:

../../../src/include/nodes/nodes.h:359: error: syntax error before ‘Node’
../../../src/include/nodes/nodes.h:398: error: syntax error before ‘equal’
../../../src/include/nodes/nodes.h:398: warning: type defaults to ‘int’ in 
declaration of ‘equal’
../../../src/include/nodes/nodes.h:398: warning: data definition has no type or 
storage class

So, I think there is a problem with the Makefiles but I do not know what. I 
added the object file my_writer.o  to the Makefile inside  
backend/parser/Makefile and configured again, but it did not work, what else 
should I do?



Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

Reply via email to