Datum should be defined outside postgres.h

From: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Datum should be defined outside postgres.h
Date: 2007-10-25 13:51:35
Message-ID: 47209F67.5080106@sun.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I'm trying to solve one TODO item mentioned in
src/backend/utils/mmgr/mcxt.c.

----
/*
* MemoryContextSwitchTo
* Returns the current context; installs the given context.
*
* This is inlined when using GCC.
*
* TODO: investigate supporting inlining for some non-GCC compilers.
*/
----

Everything works fine with Sun Studio instead of zic and ecpg
compilation. The problem there is that palloc.h defines
CurrentMemoryContext which is declared in mcxt.c. And palloc.h is
included by postgres.h.

Unfortunately zic and ecpg break the rule which is mentioned on many
places and they include postgres.h. Linker is looking for
CurrentMemoryContext because inlined function requires it. This problem
disappears when -xO3 is enabled and SS optimizes a code. But it cannot
be use in general.

I fixed it for zic, but problem with ecpg is that it includes
nodes/primnodes.h and it requires Datum type definition which is defined
in postgres.h. :(

By my opinion Datum should be defined in separate file and all headers
which use this type should include it. (this is problem on many places
with another types). Another question is why ecpg needs it?

Any comments how to fix ecpg?

Zdenek

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2007-10-25 14:12:40 text search parser, "uri"
Previous Message Alvaro Herrera 2007-10-25 13:47:40 text search and "filenames"