On sön, 2011-04-24 at 12:25 -0400, Tom Lane wrote:
> This file is in fundamental violation of the first commandment of
> Postgres #includes, which is "thou shalt have no other gods before c.h".
> We need to put postgres.h *before* the Python.h include.  I don't know
> what issues led to the current arrangement but it is fraught with
> portability gotchas.  In particular it's just about guaranteed to fail
> on platforms where <stdio.h> reacts to _FILE_OFFSET_BITS --- plpython.c
> is going to get compiled expecting a different stdio library than the
> rest of the backend.

Here is where this happened:

commit ab6ee1f9fc7039b1e8d8ebf939da3fd55e73efad
Author: Joe Conway <m...@joeconway.com>
Date:   Thu Aug 5 03:10:29 2004 +0000

    Move include for Python.h above postgres.h to eliminate compiler warning.

diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c
index 76ea031..07eed86 100644
--- a/src/pl/plpython/plpython.c
+++ b/src/pl/plpython/plpython.c
@@ -29,11 +29,12 @@
  * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  *
  * IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.52 2004/08/04 21:34:29 
tgl Exp $
+ * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.53 2004/08/05 03:10:29 
joe Exp $
  *
  *********************************************************************
  */
 
+#include <Python.h>
 #include "postgres.h"
 
 /* system stuff */
@@ -54,7 +55,6 @@
 #include "utils/syscache.h"
 #include "utils/typcache.h"
 
-#include <Python.h>
 #include <compile.h>
 #include <eval.h>
 

If you switch it back around, you indeed get a bunch of annoying
warnings.  This will need some playing around it get right.



-- 
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