Re: pgsql: Remove "fmgr.h" include in cube contrib --- caused crash on a Ge

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeremy Drake <pgsql@jdrake.com>
Cc: Bruce Momjian <bruce@momjian.us>, Alvaro Herrera <alvherre@commandprompt.com>, pgsql-committers <pgsql-committers@postgresql.org>
Date: 2011-09-03T14:23:09Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Remove unnecessary #include references, per pgrminclude script.

  2. Remove "fmgr.h" include in cube contrib --- caused crash on a Gentoo

  3. Allow more include files to be compiled in their own by adding missing

  4. Add support for #elif to pgrminclude.

Jeremy Drake <pgsql@jdrake.com> writes:
> ... I'm pretty sure that what it crashed on was
> attempting to access the global external variable CurrentMemoryContext.

Ah-hah, good insight!

> The odd thing is, that the disassembly code between the working and
> non-working was the same, except for the offsets.

The code seems to be fetching a pointer to CurrentMemoryContext from a
PC-relative location; presumably that's a literal that the dynamic
linker is supposed to update at shlib load time.  I guess that pointer
is not correctly computed in the other case, or else it's fetching the
wrong pointer value.

> Still, I have no idea why adding an include would cause issues accessing
> CurrentMemoryContext.

Me either, but at least it's something to work from.  You might try
diffing the working and non-working -E output from cube.c to see if
there are any changes that obviously affect CurrentMemoryContext.

			regards, tom lane