Re: Fix pg_dump dependency on postgres.h - Mailing list pgsql-patches

From Zdenek Kotala
Subject Re: Fix pg_dump dependency on postgres.h
Date
Msg-id 4730A7C2.5030702@sun.com
Whole thread Raw
In response to Re: Fix pg_dump dependency on postgres.h  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: Fix pg_dump dependency on postgres.h
List pgsql-patches
Alvaro Herrera wrote:
> Zdenek Kotala wrote:
>> Attached patch removes pg_dump dependency on postgres.h. The main reason
>> for that was discussed there:
>>
>> http://archives.postgresql.org/pgsql-hackers/2007-10/msg01261.php
>>
>> This fix contains several steps:
>>
>> 1) I removed sugar word from postgres.h and put them closer to consumer
>> :-). I created include/catalog/genbki.h which contains sugar words - macros
>> for correct catalog data processing. All catalogs file now include this
>> header.
>
> What's the point of this?  I don't see what difference it makes from the
> current situation.  In particular I don't see it being included in any
> new place.

The problem is that postgres.h include palloc.h which contains extern
declaration of MemoryContext global variable. It is not correct for
tools as pg_dump is. Because it does not use palloc. When I enabled
inline functions and start compiling postgres with sunstudio, linking
phase failed on pg_dump because MemoryContext is not allocated. It is
background of problem.

pg_dump.c needs some macros which are defined into catalogs header. But
it should not include postgres.h where is defined "sugar words" for
catalog data. It is the reason why I moved these macros to the separate
header and include this header from all catalog header.

It was discussed there:

http://archives.postgresql.org/pgsql-hackers/2007-10/msg01277.php

        Zdenek

pgsql-patches by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Fix pg_dump dependency on postgres.h
Next
From: Alvaro Herrera
Date:
Subject: Re: Fix pg_dump dependency on postgres.h