I have fixed a bug introduced by pgrminclude.  It turns out that
CppAsString2() will expand any symbol, even one that is undefined, so
pgrminclude thought that catalog/catversion was not needed.  This is
illustrated in the attached C file that outputs "1" and "y".

I have bumped the catalog version to force users to reload their
tablespaces (or use pg_upgrade) because the tablespace directory names
will not be expanded to the catalog version.

I have modified pgrminclude to skip files that use CppAsString2().

-- 
  Bruce Momjian  <br...@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +
diff --git a/src/include/catalog/catalog.h b/src/include/catalog/catalog.h
new file mode 100644
index 1e1e12d..e472e05
*** a/src/include/catalog/catalog.h
--- b/src/include/catalog/catalog.h
***************
*** 14,19 ****
--- 14,24 ----
  #ifndef CATALOG_H
  #define CATALOG_H
  
+ /*
+  *	'pgrminclude ignore' needed here because CppAsString2() does not throw
+  *	an error if the symbol is not defined.
+  */
+ #include "catalog/catversion.h"	/* pgrminclude ignore */
  #include "catalog/pg_class.h"
  #include "storage/relfilenode.h"
  #include "utils/relcache.h"
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
new file mode 100644
index f5c9797..f3c8bb4
*** a/src/include/catalog/catversion.h
--- b/src/include/catalog/catversion.h
***************
*** 53,58 ****
   */
  
  /*							yyyymmddN */
! #define CATALOG_VERSION_NO	201108051
  
  #endif
--- 53,58 ----
   */
  
  /*							yyyymmddN */
! #define CATALOG_VERSION_NO	201109071
  
  #endif
#include <stdio.h>
#include <stdlib.h>
#include "/pg/include/c.h"

#define x 1
#define x1 CppAsString2(x)
#define x2 CppAsString2(y)

int
main(int argc, char **argv)
{
        puts(x1);
        puts(x2);
        return 0;
}
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to