Hi, I just found out that tcop/dest.h is included in executor/spi.h, and it contains many things that aren't needed for compiling SPI programs/ libraries. By way of example I compiled the whole of contrib with the attached patch and it works fine. Notice that the only thing I'm doing is taking the forward declaration of Portal into a separate file, portalforw.h -- that's the only definition that's really needed by SPI programs. (It also allows PL/php to compile without having to patch PHP nor PostgreSQL sources).
Note that since tcop/dest.h now includes portalforw.h, anybody who currently needs the Portal definition is still getting it. The only thing I'm doing is un-export the rest of tcop/dest.h from executor/spi.h. So instead of changing the names of the CommandDest enum, I'm hiding it from external view. Note that executor/spi.h does not follow the convention that #includes should be alphabetically ordered. I did not change that in this patch in order to show that this change is really minimal. Does anybody object to committing this patch to current CVS HEAD? (Comments about a better position/name for the new file are welcome.) -- Alvaro Herrera http://www.amazon.com/gp/registry/DXLWNGRJD34J "The only difference is that Saddam would kill you on private, where the Americans will kill you in public" (Mohammad Saleh, 39, a building contractor)
Index: executor/spi.h =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/include/executor/spi.h,v retrieving revision 1.53 diff -c -r1.53 spi.h *** executor/spi.h 15 Oct 2005 02:49:44 -0000 1.53 --- executor/spi.h 2 Nov 2005 10:32:33 -0000 *************** *** 28,34 **** #include "tcop/pquery.h" #include "tcop/tcopprot.h" #include "tcop/utility.h" ! #include "tcop/dest.h" #include "nodes/params.h" #include "utils/builtins.h" #include "utils/datum.h" --- 28,34 ---- #include "tcop/pquery.h" #include "tcop/tcopprot.h" #include "tcop/utility.h" ! #include "executor/portalforw.h" #include "nodes/params.h" #include "utils/builtins.h" #include "utils/datum.h" Index: tcop/dest.h =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/include/tcop/dest.h,v retrieving revision 1.47 diff -c -r1.47 dest.h *** tcop/dest.h 15 Oct 2005 02:49:46 -0000 1.47 --- tcop/dest.h 2 Nov 2005 10:18:40 -0000 *************** *** 62,67 **** --- 62,68 ---- #define DEST_H #include "executor/tuptable.h" + #include "executor/portalforw.h" /* buffer size to use for command completion tags */ *************** *** 117,126 **** extern DestReceiver *None_Receiver; /* permanent receiver for None */ - /* This is a forward reference to utils/portal.h */ - - typedef struct PortalData *Portal; - /* The primary destination management functions */ extern void BeginCommand(const char *commandTag, CommandDest dest); --- 118,123 ----
/*------------------------------------------------------------------------- * * portalforw.h * * $PostgreSQL$ * *------------------------------------------------------------------------- */ #ifndef PORTALFORW_H #define PORTALFORW_H /* This is a forward reference to utils/portal.h */ typedef struct PortalData *Portal; #endif /* PORTALFORW_H */
---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend