Re: Fix pg_dump dependency on postgres.h

From: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
To: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Fix pg_dump dependency on postgres.h
Date: 2007-11-06 17:43:30
Message-ID: 4730A7C2.5030702@sun.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Wong 2007-11-06 17:49:57 Re: Test lab
Previous Message Jeff Davis 2007-11-06 17:19:14 Re: Visibility map thoughts

Browse pgsql-patches by date

  From Date Subject
Next Message Pavel Stehule 2007-11-06 22:13:13 fulltext parser strange behave
Previous Message Alvaro Herrera 2007-11-06 16:58:05 Re: Fix pg_dump dependency on postgres.h