Thread: Fix pg_dump dependency on postgres.h

Fix pg_dump dependency on postgres.h

From
Zdenek Kotala
Date:
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.

2) I moved SEQ_MAXVALUE and SEQ_MINVALUE macros from sequence.h to
postgres_config_manual.h


3) I created two new headers pg_type_fn.h and pg_proc_fn.h and I moved
all extern function definition from related headers into them. Second
possible solution could be let function definition into headers and
fence them by #ifndef FRONTED.

    Let me know your comments.

        Thanks
            Zdenek

Attachment

Re: Fix pg_dump dependency on postgres.h

From
Alvaro Herrera
Date:
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 other two changes seem to be what was discussed:

> 2) I moved SEQ_MAXVALUE and SEQ_MINVALUE macros from sequence.h to
> postgres_config_manual.h
>
> 3) I created two new headers pg_type_fn.h and pg_proc_fn.h and I moved all
> extern function definition from related headers into them.

--
Alvaro Herrera                  http://www.amazon.com/gp/registry/5ZYLFMCVHXC
One man's impedance mismatch is another man's layer of abstraction.
(Lincoln Yeoh)

Re: Fix pg_dump dependency on postgres.h

From
Zdenek Kotala
Date:
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

Re: Fix pg_dump dependency on postgres.h

From
Alvaro Herrera
Date:
Zdenek Kotala wrote:
> Alvaro Herrera wrote:

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

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

Ah, the part that I was missing was that the catalog headers were being
included by pg_dump.c.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Re: Fix pg_dump dependency on postgres.h

From
Zdenek Kotala
Date:
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
>

I found two problems there. One is that I forgot postgres.h include in
common.c. it is easy to fix. However second problem is more complicated.
dumputils.c calls ScandKeywordLookup function which is defined in
keyword.c. :(

I currently see two possible variant:

1) Put list of RESERVED keyword into dumputils and use bsearch for
lookup. It is easy to implement but it will be difficult to keep
synchronize these two list together.

2) Modify gram.y to generate parse.h which will be friendly for backend
and can be used in keyword.c. Probably add some ifdef ...

3) Put following fake into keyword.c before include "parse.h" line. It
is easiest way.

#define TYPE_IS_DECLARED 1
#define YYLTYPE_IS_DECLARED 1
#define YYLTYPE void*
#define YYSTYPE void*

    Comments or any ideas?

        Zdenek

Re: Fix pg_dump dependency on postgres.h

From
Zdenek Kotala
Date:
Zdenek Kotala 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
>>
>
> I found two problems there. One is that I forgot postgres.h include in
> common.c. it is easy to fix. However second problem is more complicated.
> dumputils.c calls ScandKeywordLookup function which is defined in
> keyword.c. :(
>

<snip>

> 3) Put following fake into keyword.c before include "parse.h" line. It
> is easiest way.
>
> #define TYPE_IS_DECLARED 1
> #define YYLTYPE_IS_DECLARED 1
> #define YYLTYPE void*
> #define YYSTYPE void*
>

New version of patch is attached. I selected variant 3 as a best
solution. Patch also fix some other postgres.h dependencyin another
tools such as pg_controldata, pg_config. The last unfixed tool is
pg_resetxlog which deserves own patch.


        With regards Zdenek
diff -rc pgsql_sugar.orig/src/backend/catalog/heap.c pgsql_sugar/src/backend/catalog/heap.c
*** pgsql_sugar.orig/src/backend/catalog/heap.c    Mon Oct 29 20:40:39 2007
--- pgsql_sugar/src/backend/catalog/heap.c    Tue Nov  6 12:47:46 2007
***************
*** 45,50 ****
--- 45,51 ----
  #include "catalog/pg_statistic.h"
  #include "catalog/pg_tablespace.h"
  #include "catalog/pg_type.h"
+ #include "catalog/pg_type_fn.h"
  #include "commands/tablecmds.h"
  #include "commands/typecmds.h"
  #include "miscadmin.h"
diff -rc pgsql_sugar.orig/src/backend/catalog/pg_aggregate.c pgsql_sugar/src/backend/catalog/pg_aggregate.c
*** pgsql_sugar.orig/src/backend/catalog/pg_aggregate.c    Mon Sep  3 02:39:14 2007
--- pgsql_sugar/src/backend/catalog/pg_aggregate.c    Tue Nov  6 12:47:46 2007
***************
*** 21,26 ****
--- 21,27 ----
  #include "catalog/pg_language.h"
  #include "catalog/pg_operator.h"
  #include "catalog/pg_proc.h"
+ #include "catalog/pg_proc_fn.h"
  #include "catalog/pg_type.h"
  #include "miscadmin.h"
  #include "parser/parse_coerce.h"
diff -rc pgsql_sugar.orig/src/backend/catalog/pg_proc.c pgsql_sugar/src/backend/catalog/pg_proc.c
*** pgsql_sugar.orig/src/backend/catalog/pg_proc.c    Mon Sep  3 02:39:14 2007
--- pgsql_sugar/src/backend/catalog/pg_proc.c    Tue Nov  6 12:47:46 2007
***************
*** 21,26 ****
--- 21,27 ----
  #include "catalog/pg_language.h"
  #include "catalog/pg_namespace.h"
  #include "catalog/pg_proc.h"
+ #include "catalog/pg_proc_fn.h"
  #include "catalog/pg_type.h"
  #include "executor/functions.h"
  #include "funcapi.h"
diff -rc pgsql_sugar.orig/src/backend/catalog/pg_type.c pgsql_sugar/src/backend/catalog/pg_type.c
*** pgsql_sugar.orig/src/backend/catalog/pg_type.c    Sat May 12 02:54:59 2007
--- pgsql_sugar/src/backend/catalog/pg_type.c    Tue Nov  6 12:47:46 2007
***************
*** 21,26 ****
--- 21,27 ----
  #include "catalog/pg_namespace.h"
  #include "catalog/pg_proc.h"
  #include "catalog/pg_type.h"
+ #include "catalog/pg_type_fn.h"
  #include "commands/typecmds.h"
  #include "miscadmin.h"
  #include "parser/scansup.h"
diff -rc pgsql_sugar.orig/src/backend/commands/functioncmds.c pgsql_sugar/src/backend/commands/functioncmds.c
*** pgsql_sugar.orig/src/backend/commands/functioncmds.c    Mon Sep  3 20:46:29 2007
--- pgsql_sugar/src/backend/commands/functioncmds.c    Tue Nov  6 12:47:46 2007
***************
*** 41,47 ****
--- 41,49 ----
  #include "catalog/pg_language.h"
  #include "catalog/pg_namespace.h"
  #include "catalog/pg_proc.h"
+ #include "catalog/pg_proc_fn.h"
  #include "catalog/pg_type.h"
+ #include "catalog/pg_type_fn.h"
  #include "commands/defrem.h"
  #include "commands/proclang.h"
  #include "miscadmin.h"
diff -rc pgsql_sugar.orig/src/backend/commands/proclang.c pgsql_sugar/src/backend/commands/proclang.c
*** pgsql_sugar.orig/src/backend/commands/proclang.c    Mon Sep  3 02:39:15 2007
--- pgsql_sugar/src/backend/commands/proclang.c    Tue Nov  6 12:47:46 2007
***************
*** 22,27 ****
--- 22,28 ----
  #include "catalog/pg_namespace.h"
  #include "catalog/pg_pltemplate.h"
  #include "catalog/pg_proc.h"
+ #include "catalog/pg_proc_fn.h"
  #include "catalog/pg_type.h"
  #include "commands/dbcommands.h"
  #include "commands/defrem.h"
diff -rc pgsql_sugar.orig/src/backend/commands/tablecmds.c pgsql_sugar/src/backend/commands/tablecmds.c
*** pgsql_sugar.orig/src/backend/commands/tablecmds.c    Fri Oct 12 20:55:12 2007
--- pgsql_sugar/src/backend/commands/tablecmds.c    Tue Nov  6 12:47:46 2007
***************
*** 32,37 ****
--- 32,38 ----
  #include "catalog/pg_tablespace.h"
  #include "catalog/pg_trigger.h"
  #include "catalog/pg_type.h"
+ #include "catalog/pg_type_fn.h"
  #include "catalog/toasting.h"
  #include "commands/cluster.h"
  #include "commands/defrem.h"
diff -rc pgsql_sugar.orig/src/backend/commands/typecmds.c pgsql_sugar/src/backend/commands/typecmds.c
*** pgsql_sugar.orig/src/backend/commands/typecmds.c    Mon Oct 29 20:40:39 2007
--- pgsql_sugar/src/backend/commands/typecmds.c    Tue Nov  6 12:47:46 2007
***************
*** 43,48 ****
--- 43,49 ----
  #include "catalog/pg_enum.h"
  #include "catalog/pg_namespace.h"
  #include "catalog/pg_type.h"
+ #include "catalog/pg_type_fn.h"
  #include "commands/defrem.h"
  #include "commands/tablecmds.h"
  #include "commands/typecmds.h"
diff -rc pgsql_sugar.orig/src/backend/parser/keywords.c pgsql_sugar/src/backend/parser/keywords.c
*** pgsql_sugar.orig/src/backend/parser/keywords.c    Mon Sep 24 03:29:29 2007
--- pgsql_sugar/src/backend/parser/keywords.c    Wed Nov 14 14:51:15 2007
***************
*** 12,23 ****
   *
   *-------------------------------------------------------------------------
   */
! #include "postgres.h"

  #include <ctype.h>

! #include "nodes/parsenodes.h"
! #include "parser/gramparse.h"    /* required before parser/parse.h! */
  #include "parser/keywords.h"
  #include "parser/parse.h"

--- 12,32 ----
   *
   *-------------------------------------------------------------------------
   */
! #include "c.h"

  #include <ctype.h>

! /* Following macros disables structures definition
!  * in parse.h which are unnecessary for this source and
!  * they cause useless dependency on another headers. It
!  * is very important for pg_dump which also share this
!  * piece of code and it cannot include postgres.h
!  */
! #define TYPE_IS_DECLARED 1
! #define YYLTYPE_IS_DECLARED 1
! #define YYLTYPE void*
! #define YYSTYPE void*
!
  #include "parser/keywords.h"
  #include "parser/parse.h"

diff -rc pgsql_sugar.orig/src/backend/utils/hash/pg_crc.c pgsql_sugar/src/backend/utils/hash/pg_crc.c
*** pgsql_sugar.orig/src/backend/utils/hash/pg_crc.c    Fri Jan  5 23:19:43 2007
--- pgsql_sugar/src/backend/utils/hash/pg_crc.c    Wed Nov 14 14:24:06 2007
***************
*** 23,29 ****
   *
   *-------------------------------------------------------------------------
   */
! #include "postgres.h"



--- 23,29 ----
   *
   *-------------------------------------------------------------------------
   */
! #include "c.h"



diff -rc pgsql_sugar.orig/src/bin/pg_config/pg_config.c pgsql_sugar/src/bin/pg_config/pg_config.c
*** pgsql_sugar.orig/src/bin/pg_config/pg_config.c    Thu May 31 17:13:04 2007
--- pgsql_sugar/src/bin/pg_config/pg_config.c    Wed Nov 14 12:41:34 2007
***************
*** 22,28 ****
   *-------------------------------------------------------------------------
   */

! #include "postgres.h"

  #include "port.h"

--- 22,28 ----
   *-------------------------------------------------------------------------
   */

! #include "postgres_fe.h"

  #include "port.h"

diff -rc pgsql_sugar.orig/src/bin/pg_controldata/pg_controldata.c pgsql_sugar/src/bin/pg_controldata/pg_controldata.c
*** pgsql_sugar.orig/src/bin/pg_controldata/pg_controldata.c    Tue Apr  3 06:14:26 2007
--- pgsql_sugar/src/bin/pg_controldata/pg_controldata.c    Wed Nov 14 12:42:14 2007
***************
*** 8,14 ****
   *
   * $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.34 2007/03/18 16:50:43 neilc Exp $
   */
! #include "postgres.h"

  #include <unistd.h>
  #include <time.h>
--- 8,14 ----
   *
   * $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.34 2007/03/18 16:50:43 neilc Exp $
   */
! #include "postgres_fe.h"

  #include <unistd.h>
  #include <time.h>
diff -rc pgsql_sugar.orig/src/bin/pg_dump/common.c pgsql_sugar/src/bin/pg_dump/common.c
*** pgsql_sugar.orig/src/bin/pg_dump/common.c    Sun Oct 28 20:08:02 2007
--- pgsql_sugar/src/bin/pg_dump/common.c    Wed Nov 14 12:43:03 2007
***************
*** 19,25 ****
  #include "postgres_fe.h"
  #include "pg_backup_archiver.h"

- #include "postgres.h"
  #include "catalog/pg_class.h"

  #include <ctype.h>
--- 19,24 ----
diff -rc pgsql_sugar.orig/src/bin/pg_dump/pg_dump.c pgsql_sugar/src/bin/pg_dump/pg_dump.c
*** pgsql_sugar.orig/src/bin/pg_dump/pg_dump.c    Sat Oct 13 22:18:41 2007
--- pgsql_sugar/src/bin/pg_dump/pg_dump.c    Wed Nov 14 14:53:39 2007
***************
*** 17,28 ****
   *-------------------------------------------------------------------------
   */

! /*
!  * Although this is not a backend module, we must include postgres.h anyway
!  * so that we can include a bunch of backend include files.  pg_dump has
!  * never pretended to be very independent of the backend anyhow ...
!  */
! #include "postgres.h"

  #include <unistd.h>

--- 17,23 ----
   *-------------------------------------------------------------------------
   */

! #include "postgres_fe.h"

  #include <unistd.h>

***************
*** 41,51 ****
  #endif

  #include "access/htup.h"
  #include "catalog/pg_class.h"
  #include "catalog/pg_proc.h"
  #include "catalog/pg_trigger.h"
  #include "catalog/pg_type.h"
- #include "commands/sequence.h"
  #include "libpq/libpq-fs.h"

  #include "pg_backup_archiver.h"
--- 36,46 ----
  #endif

  #include "access/htup.h"
+ #include "access/attnum.h"
  #include "catalog/pg_class.h"
  #include "catalog/pg_proc.h"
  #include "catalog/pg_trigger.h"
  #include "catalog/pg_type.h"
  #include "libpq/libpq-fs.h"

  #include "pg_backup_archiver.h"
diff -rc pgsql_sugar.orig/src/bin/psql/print.c pgsql_sugar/src/bin/psql/print.c
*** pgsql_sugar.orig/src/bin/psql/print.c    Fri Jan  5 23:19:49 2007
--- pgsql_sugar/src/bin/psql/print.c    Wed Nov 14 12:44:02 2007
***************
*** 8,14 ****
   * Note: we include postgres.h not postgres_fe.h so that we can include
   * catalog/pg_type.h, and thereby have access to INT4OID and similar macros.
   */
! #include "postgres.h"
  #include "print.h"
  #include "catalog/pg_type.h"

--- 8,14 ----
   * Note: we include postgres.h not postgres_fe.h so that we can include
   * catalog/pg_type.h, and thereby have access to INT4OID and similar macros.
   */
! #include "postgres_fe.h"
  #include "print.h"
  #include "catalog/pg_type.h"

diff -rc pgsql_sugar.orig/src/include/pg_config_manual.h pgsql_sugar/src/include/pg_config_manual.h
*** pgsql_sugar.orig/src/include/pg_config_manual.h    Fri Jun  8 20:23:53 2007
--- pgsql_sugar/src/include/pg_config_manual.h    Tue Nov  6 12:47:46 2007
***************
*** 197,203 ****
--- 197,214 ----
   */
  #define MAX_RANDOM_VALUE  (0x7FFFFFFF)

+ /*
+  * Set the upper and lower bounds of a sequence
+  */
+ #ifndef INT64_IS_BUSTED
+ #define SEQ_MAXVALUE    INT64CONST(0x7FFFFFFFFFFFFFFF)
+ #else                                                   /* INT64_IS_BUSTED */
+ #define SEQ_MAXVALUE    ((int64) 0x7FFFFFFF)
+ #endif   /* INT64_IS_BUSTED */

+ #define SEQ_MINVALUE    (-SEQ_MAXVALUE)
+
+
  /*
   *------------------------------------------------------------------------
   * The following symbols are for enabling debugging code, not for
diff -rc pgsql_sugar.orig/src/include/postgres.h pgsql_sugar/src/include/postgres.h
*** pgsql_sugar.orig/src/include/postgres.h    Mon Oct  1 18:25:56 2007
--- pgsql_sugar/src/include/postgres.h    Tue Nov  6 12:51:45 2007
***************
*** 26,32 ****
   *        1)        variable-length datatypes (TOAST support)
   *        2)        datum type + support macros
   *        3)        exception handling definitions
-  *        4)        genbki macros used by catalog/pg_xxx.h files
   *
   *     NOTES
   *
--- 26,31 ----
***************
*** 710,730 ****
                                  const char *errorType,
                                  const char *fileName, int lineNumber);

- /* ----------------------------------------------------------------
-  *                Section 4: genbki macros used by catalog/pg_xxx.h files
-  * ----------------------------------------------------------------
-  */
- #define CATALOG(name,oid)    typedef struct CppConcat(FormData_,name)
-
- #define BKI_BOOTSTRAP
- #define BKI_SHARED_RELATION
- #define BKI_WITHOUT_OIDS
-
- /* these need to expand into some harmless, repeatable declaration */
- #define DATA(x)   extern int no_such_variable
- #define DESCR(x)  extern int no_such_variable
- #define SHDESCR(x) extern int no_such_variable
-
- typedef int4 aclitem;            /* PHONY definition for catalog use only */
-
  #endif   /* POSTGRES_H */
--- 709,712 ----
diff -rc pgsql_sugar.orig/src/include/catalog/genbki.h pgsql_sugar/src/include/catalog/genbki.h
*** pgsql_sugar.orig/src/include/catalog/genbki.h    Tue Nov  6 12:50:26 2007
--- pgsql_sugar/src/include/catalog/genbki.h    Tue Nov  6 13:19:36 2007
***************
*** 0 ****
--- 1,35 ----
+ /*-------------------------------------------------------------------------
+  *
+  * genbki.h
+  *      Primary include file for all catalog header files
+  *
+  * genbki.h contains the CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so
+  * this file can be read by both genbki.sh and the C compiler.
+  *
+  *
+  * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
+  * Portions Copyright (c) 1995, Regents of the University of California
+  *
+  * $PostgreSQL:  $
+  *
+  *-------------------------------------------------------------------------
+  */
+ #ifndef GENBKI_H
+ #define GENBKI_H
+
+ #include "c.h"
+
+ #define CATALOG(name,oid)    typedef struct CppConcat(FormData_,name)
+
+ #define BKI_BOOTSTRAP
+ #define BKI_SHARED_RELATION
+ #define BKI_WITHOUT_OIDS
+
+ /* these need to expand into some harmless, repeatable declaration */
+ #define DATA(x)   extern int no_such_variable
+ #define DESCR(x)  extern int no_such_variable
+ #define SHDESCR(x) extern int no_such_variable
+
+ typedef int4 aclitem;            /* PHONY definition for catalog use only */
+
+ #endif   /* GENBKI_H */
diff -rc pgsql_sugar.orig/src/include/catalog/pg_aggregate.h pgsql_sugar/src/include/catalog/pg_aggregate.h
*** pgsql_sugar.orig/src/include/catalog/pg_aggregate.h    Wed Oct 24 04:24:47 2007
--- pgsql_sugar/src/include/catalog/pg_aggregate.h    Tue Nov  6 12:47:46 2007
***************
*** 19,24 ****
--- 19,25 ----
  #ifndef PG_AGGREGATE_H
  #define PG_AGGREGATE_H

+ #include "catalog/genbki.h"
  #include "nodes/pg_list.h"

  /* ----------------
diff -rc pgsql_sugar.orig/src/include/catalog/pg_am.h pgsql_sugar/src/include/catalog/pg_am.h
*** pgsql_sugar.orig/src/include/catalog/pg_am.h    Sat Apr  7 00:33:43 2007
--- pgsql_sugar/src/include/catalog/pg_am.h    Tue Nov  6 12:47:46 2007
***************
*** 22,33 ****
  #ifndef PG_AM_H
  #define PG_AM_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_am definition.  cpp turns this into
--- 22,28 ----
  #ifndef PG_AM_H
  #define PG_AM_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_am definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_amop.h pgsql_sugar/src/include/catalog/pg_amop.h
*** pgsql_sugar.orig/src/include/catalog/pg_amop.h    Tue Aug 21 03:11:25 2007
--- pgsql_sugar/src/include/catalog/pg_amop.h    Tue Nov  6 12:47:46 2007
***************
*** 40,51 ****
  #ifndef PG_AMOP_H
  #define PG_AMOP_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_amop definition.  cpp turns this into
--- 40,46 ----
  #ifndef PG_AMOP_H
  #define PG_AMOP_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_amop definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_amproc.h pgsql_sugar/src/include/catalog/pg_amproc.h
*** pgsql_sugar.orig/src/include/catalog/pg_amproc.h    Mon Sep  3 03:18:33 2007
--- pgsql_sugar/src/include/catalog/pg_amproc.h    Tue Nov  6 12:47:46 2007
***************
*** 33,44 ****
  #ifndef PG_AMPROC_H
  #define PG_AMPROC_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_amproc definition.  cpp turns this into
--- 33,39 ----
  #ifndef PG_AMPROC_H
  #define PG_AMPROC_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_amproc definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_attrdef.h pgsql_sugar/src/include/catalog/pg_attrdef.h
*** pgsql_sugar.orig/src/include/catalog/pg_attrdef.h    Fri Jan  5 23:19:52 2007
--- pgsql_sugar/src/include/catalog/pg_attrdef.h    Tue Nov  6 12:47:46 2007
***************
*** 19,30 ****
  #ifndef PG_ATTRDEF_H
  #define PG_ATTRDEF_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_attrdef definition.    cpp turns this into
--- 19,25 ----
  #ifndef PG_ATTRDEF_H
  #define PG_ATTRDEF_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_attrdef definition.    cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_attribute.h pgsql_sugar/src/include/catalog/pg_attribute.h
*** pgsql_sugar.orig/src/include/catalog/pg_attribute.h    Thu Sep 20 19:56:32 2007
--- pgsql_sugar/src/include/catalog/pg_attribute.h    Tue Nov  6 12:47:46 2007
***************
*** 24,35 ****
  #ifndef PG_ATTRIBUTE_H
  #define PG_ATTRIBUTE_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_attribute definition.  cpp turns this into
--- 24,30 ----
  #ifndef PG_ATTRIBUTE_H
  #define PG_ATTRIBUTE_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_attribute definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_auth_members.h pgsql_sugar/src/include/catalog/pg_auth_members.h
*** pgsql_sugar.orig/src/include/catalog/pg_auth_members.h    Fri Jan  5 23:19:52 2007
--- pgsql_sugar/src/include/catalog/pg_auth_members.h    Wed Nov 14 14:41:07 2007
***************
*** 19,24 ****
--- 19,26 ----
  #ifndef PG_AUTH_MEMBERS_H
  #define PG_AUTH_MEMBERS_H

+ #include "catalog/genbki.h"
+
  /* ----------------
   *        pg_auth_members definition.  cpp turns this into
   *        typedef struct FormData_pg_auth_members
diff -rc pgsql_sugar.orig/src/include/catalog/pg_authid.h pgsql_sugar/src/include/catalog/pg_authid.h
*** pgsql_sugar.orig/src/include/catalog/pg_authid.h    Fri Jan  5 23:19:52 2007
--- pgsql_sugar/src/include/catalog/pg_authid.h    Tue Nov  6 12:47:46 2007
***************
*** 21,26 ****
--- 21,28 ----
  #ifndef PG_AUTHID_H
  #define PG_AUTHID_H

+ #include "catalog/genbki.h"
+
  /*
   * The CATALOG definition has to refer to the type of rolvaliduntil as
   * "timestamptz" (lower case) so that bootstrap mode recognizes it.  But
diff -rc pgsql_sugar.orig/src/include/catalog/pg_autovacuum.h pgsql_sugar/src/include/catalog/pg_autovacuum.h
*** pgsql_sugar.orig/src/include/catalog/pg_autovacuum.h    Fri Jan  5 23:19:52 2007
--- pgsql_sugar/src/include/catalog/pg_autovacuum.h    Tue Nov  6 12:47:46 2007
***************
*** 13,24 ****
  #ifndef PG_AUTOVACUUM_H
  #define PG_AUTOVACUUM_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_autovacuum definition.    cpp turns this into
--- 13,19 ----
  #ifndef PG_AUTOVACUUM_H
  #define PG_AUTOVACUUM_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_autovacuum definition.    cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_cast.h pgsql_sugar/src/include/catalog/pg_cast.h
*** pgsql_sugar.orig/src/include/catalog/pg_cast.h    Tue Aug 21 03:11:25 2007
--- pgsql_sugar/src/include/catalog/pg_cast.h    Tue Nov  6 12:47:46 2007
***************
*** 21,26 ****
--- 21,28 ----
  #ifndef PG_CAST_H
  #define PG_CAST_H

+ #include "catalog/genbki.h"
+
  #define CastRelationId    2605

  CATALOG(pg_cast,2605)
diff -rc pgsql_sugar.orig/src/include/catalog/pg_class.h pgsql_sugar/src/include/catalog/pg_class.h
*** pgsql_sugar.orig/src/include/catalog/pg_class.h    Mon Sep  3 02:39:21 2007
--- pgsql_sugar/src/include/catalog/pg_class.h    Tue Nov  6 12:47:46 2007
***************
*** 19,30 ****
  #ifndef PG_CLASS_H
  #define PG_CLASS_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_class definition.  cpp turns this into
--- 19,25 ----
  #ifndef PG_CLASS_H
  #define PG_CLASS_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_class definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_constraint.h pgsql_sugar/src/include/catalog/pg_constraint.h
*** pgsql_sugar.orig/src/include/catalog/pg_constraint.h    Wed Feb 14 02:58:58 2007
--- pgsql_sugar/src/include/catalog/pg_constraint.h    Tue Nov  6 12:47:46 2007
***************
*** 19,34 ****
  #ifndef PG_CONSTRAINT_H
  #define PG_CONSTRAINT_H

  #include "nodes/pg_list.h"

  /* ----------------
-  *        postgres.h contains the system type definitions and the
-  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
-  *        can be read by both genbki.sh and the C compiler.
-  * ----------------
-  */
-
- /* ----------------
   *        pg_constraint definition.  cpp turns this into
   *        typedef struct FormData_pg_constraint
   * ----------------
--- 19,28 ----
  #ifndef PG_CONSTRAINT_H
  #define PG_CONSTRAINT_H

+ #include "catalog/genbki.h"
  #include "nodes/pg_list.h"

  /* ----------------
   *        pg_constraint definition.  cpp turns this into
   *        typedef struct FormData_pg_constraint
   * ----------------
diff -rc pgsql_sugar.orig/src/include/catalog/pg_conversion.h pgsql_sugar/src/include/catalog/pg_conversion.h
*** pgsql_sugar.orig/src/include/catalog/pg_conversion.h    Fri Jan  5 23:19:52 2007
--- pgsql_sugar/src/include/catalog/pg_conversion.h    Tue Nov  6 12:47:46 2007
***************
*** 19,30 ****
  #ifndef PG_CONVERSION_H
  #define PG_CONVERSION_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------------------------------------------------------
   *        pg_conversion definition.
--- 19,25 ----
  #ifndef PG_CONVERSION_H
  #define PG_CONVERSION_H

! #include "catalog/genbki.h"

  /* ----------------------------------------------------------------
   *        pg_conversion definition.
diff -rc pgsql_sugar.orig/src/include/catalog/pg_database.h pgsql_sugar/src/include/catalog/pg_database.h
*** pgsql_sugar.orig/src/include/catalog/pg_database.h    Mon Sep  3 04:30:43 2007
--- pgsql_sugar/src/include/catalog/pg_database.h    Tue Nov  6 12:47:46 2007
***************
*** 19,30 ****
  #ifndef PG_DATABASE_H
  #define PG_DATABASE_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_database definition.  cpp turns this into
--- 19,25 ----
  #ifndef PG_DATABASE_H
  #define PG_DATABASE_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_database definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_depend.h pgsql_sugar/src/include/catalog/pg_depend.h
*** pgsql_sugar.orig/src/include/catalog/pg_depend.h    Fri Jan  5 23:19:52 2007
--- pgsql_sugar/src/include/catalog/pg_depend.h    Tue Nov  6 12:47:46 2007
***************
*** 19,30 ****
  #ifndef PG_DEPEND_H
  #define PG_DEPEND_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_depend definition.  cpp turns this into
--- 19,25 ----
  #ifndef PG_DEPEND_H
  #define PG_DEPEND_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_depend definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_description.h pgsql_sugar/src/include/catalog/pg_description.h
*** pgsql_sugar.orig/src/include/catalog/pg_description.h    Fri Jan  5 23:19:52 2007
--- pgsql_sugar/src/include/catalog/pg_description.h    Tue Nov  6 12:47:46 2007
***************
*** 36,47 ****
  #ifndef PG_DESCRIPTION_H
  #define PG_DESCRIPTION_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_description definition.    cpp turns this into
--- 36,42 ----
  #ifndef PG_DESCRIPTION_H
  #define PG_DESCRIPTION_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_description definition.    cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_enum.h pgsql_sugar/src/include/catalog/pg_enum.h
*** pgsql_sugar.orig/src/include/catalog/pg_enum.h    Mon Apr  2 05:49:40 2007
--- pgsql_sugar/src/include/catalog/pg_enum.h    Tue Nov  6 12:47:46 2007
***************
*** 21,36 ****
  #ifndef PG_ENUM_H
  #define PG_ENUM_H

  #include "nodes/pg_list.h"

  /* ----------------
-  *        postgres.h contains the system type definitions and the
-  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
-  *        can be read by both genbki.sh and the C compiler.
-  * ----------------
-  */
-
- /* ----------------
   *        pg_enum definition.  cpp turns this into
   *        typedef struct FormData_pg_enum
   * ----------------
--- 21,30 ----
  #ifndef PG_ENUM_H
  #define PG_ENUM_H

+ #include "catalog/genbki.h"
  #include "nodes/pg_list.h"

  /* ----------------
   *        pg_enum definition.  cpp turns this into
   *        typedef struct FormData_pg_enum
   * ----------------
diff -rc pgsql_sugar.orig/src/include/catalog/pg_index.h pgsql_sugar/src/include/catalog/pg_index.h
*** pgsql_sugar.orig/src/include/catalog/pg_index.h    Thu Sep 20 19:56:32 2007
--- pgsql_sugar/src/include/catalog/pg_index.h    Tue Nov  6 12:47:46 2007
***************
*** 19,30 ****
  #ifndef PG_INDEX_H
  #define PG_INDEX_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_index definition.  cpp turns this into
--- 19,25 ----
  #ifndef PG_INDEX_H
  #define PG_INDEX_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_index definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_inherits.h pgsql_sugar/src/include/catalog/pg_inherits.h
*** pgsql_sugar.orig/src/include/catalog/pg_inherits.h    Fri Jan  5 23:19:52 2007
--- pgsql_sugar/src/include/catalog/pg_inherits.h    Tue Nov  6 12:47:46 2007
***************
*** 19,30 ****
  #ifndef PG_INHERITS_H
  #define PG_INHERITS_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_inherits definition.  cpp turns this into
--- 19,25 ----
  #ifndef PG_INHERITS_H
  #define PG_INHERITS_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_inherits definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_language.h pgsql_sugar/src/include/catalog/pg_language.h
*** pgsql_sugar.orig/src/include/catalog/pg_language.h    Mon Sep  3 04:30:43 2007
--- pgsql_sugar/src/include/catalog/pg_language.h    Tue Nov  6 12:47:46 2007
***************
*** 19,30 ****
  #ifndef PG_LANGUAGE_H
  #define PG_LANGUAGE_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_language definition.  cpp turns this into
--- 19,25 ----
  #ifndef PG_LANGUAGE_H
  #define PG_LANGUAGE_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_language definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_largeobject.h pgsql_sugar/src/include/catalog/pg_largeobject.h
*** pgsql_sugar.orig/src/include/catalog/pg_largeobject.h    Fri Jan  5 23:19:52 2007
--- pgsql_sugar/src/include/catalog/pg_largeobject.h    Tue Nov  6 12:47:46 2007
***************
*** 19,30 ****
  #ifndef PG_LARGEOBJECT_H
  #define PG_LARGEOBJECT_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_largeobject definition.    cpp turns this into
--- 19,25 ----
  #ifndef PG_LARGEOBJECT_H
  #define PG_LARGEOBJECT_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_largeobject definition.    cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_listener.h pgsql_sugar/src/include/catalog/pg_listener.h
*** pgsql_sugar.orig/src/include/catalog/pg_listener.h    Fri Jan  5 23:19:52 2007
--- pgsql_sugar/src/include/catalog/pg_listener.h    Tue Nov  6 12:47:46 2007
***************
*** 18,29 ****
  #ifndef PG_LISTENER_H
  #define PG_LISTENER_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------------------------------------------------------
   *        pg_listener definition.
--- 18,24 ----
  #ifndef PG_LISTENER_H
  #define PG_LISTENER_H

! #include "catalog/genbki.h"

  /* ----------------------------------------------------------------
   *        pg_listener definition.
diff -rc pgsql_sugar.orig/src/include/catalog/pg_namespace.h pgsql_sugar/src/include/catalog/pg_namespace.h
*** pgsql_sugar.orig/src/include/catalog/pg_namespace.h    Mon Sep  3 04:30:43 2007
--- pgsql_sugar/src/include/catalog/pg_namespace.h    Tue Nov  6 12:47:46 2007
***************
*** 19,30 ****
  #ifndef PG_NAMESPACE_H
  #define PG_NAMESPACE_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------------------------------------------------------
   *        pg_namespace definition.
--- 19,25 ----
  #ifndef PG_NAMESPACE_H
  #define PG_NAMESPACE_H

! #include "catalog/genbki.h"

  /* ----------------------------------------------------------------
   *        pg_namespace definition.
diff -rc pgsql_sugar.orig/src/include/catalog/pg_opclass.h pgsql_sugar/src/include/catalog/pg_opclass.h
*** pgsql_sugar.orig/src/include/catalog/pg_opclass.h    Tue Aug 21 03:11:25 2007
--- pgsql_sugar/src/include/catalog/pg_opclass.h    Tue Nov  6 12:47:46 2007
***************
*** 39,50 ****
  #ifndef PG_OPCLASS_H
  #define PG_OPCLASS_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_opclass definition.    cpp turns this into
--- 39,45 ----
  #ifndef PG_OPCLASS_H
  #define PG_OPCLASS_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_opclass definition.    cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_operator.h pgsql_sugar/src/include/catalog/pg_operator.h
*** pgsql_sugar.orig/src/include/catalog/pg_operator.h    Mon Aug 27 03:39:24 2007
--- pgsql_sugar/src/include/catalog/pg_operator.h    Tue Nov  6 12:47:47 2007
***************
*** 22,37 ****
  #ifndef PG_OPERATOR_H
  #define PG_OPERATOR_H

  #include "nodes/pg_list.h"

  /* ----------------
-  *        postgres.h contains the system type definitions and the
-  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
-  *        can be read by both genbki.sh and the C compiler.
-  * ----------------
-  */
-
- /* ----------------
   *        pg_operator definition.  cpp turns this into
   *        typedef struct FormData_pg_operator
   * ----------------
--- 22,31 ----
  #ifndef PG_OPERATOR_H
  #define PG_OPERATOR_H

+ #include "catalog/genbki.h"
  #include "nodes/pg_list.h"

  /* ----------------
   *        pg_operator definition.  cpp turns this into
   *        typedef struct FormData_pg_operator
   * ----------------
diff -rc pgsql_sugar.orig/src/include/catalog/pg_opfamily.h pgsql_sugar/src/include/catalog/pg_opfamily.h
*** pgsql_sugar.orig/src/include/catalog/pg_opfamily.h    Tue Aug 21 03:11:25 2007
--- pgsql_sugar/src/include/catalog/pg_opfamily.h    Tue Nov  6 12:47:47 2007
***************
*** 19,32 ****
  #ifndef PG_OPFAMILY_H
  #define PG_OPFAMILY_H

  /* ----------------
-  *        postgres.h contains the system type definitions and the
-  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
-  *        can be read by both genbki.sh and the C compiler.
-  * ----------------
-  */
-
- /* ----------------
   *        pg_opfamily definition. cpp turns this into
   *        typedef struct FormData_pg_opfamily
   * ----------------
--- 19,26 ----
  #ifndef PG_OPFAMILY_H
  #define PG_OPFAMILY_H

+ #include "catalog/genbki.h"
  /* ----------------
   *        pg_opfamily definition. cpp turns this into
   *        typedef struct FormData_pg_opfamily
   * ----------------
diff -rc pgsql_sugar.orig/src/include/catalog/pg_pltemplate.h pgsql_sugar/src/include/catalog/pg_pltemplate.h
*** pgsql_sugar.orig/src/include/catalog/pg_pltemplate.h    Mon Mar 26 18:58:41 2007
--- pgsql_sugar/src/include/catalog/pg_pltemplate.h    Tue Nov  6 12:47:47 2007
***************
*** 19,30 ****
  #ifndef PG_PLTEMPLATE_H
  #define PG_PLTEMPLATE_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_pltemplate definition.  cpp turns this into
--- 19,25 ----
  #ifndef PG_PLTEMPLATE_H
  #define PG_PLTEMPLATE_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_pltemplate definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_proc.h pgsql_sugar/src/include/catalog/pg_proc.h
*** pgsql_sugar.orig/src/include/catalog/pg_proc.h    Wed Oct 24 04:24:47 2007
--- pgsql_sugar/src/include/catalog/pg_proc.h    Tue Nov  6 12:47:47 2007
***************
*** 23,36 ****
  #ifndef PG_PROC_H
  #define PG_PROC_H

  /* ----------------
-  *        postgres.h contains the system type definitions and the
-  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
-  *        can be read by both genbki.sh and the C compiler.
-  * ----------------
-  */
-
- /* ----------------
   *        pg_proc definition.  cpp turns this into
   *        typedef struct FormData_pg_proc
   * ----------------
--- 23,30 ----
  #ifndef PG_PROC_H
  #define PG_PROC_H

+ #include "catalog/genbki.h"
  /* ----------------
   *        pg_proc definition.  cpp turns this into
   *        typedef struct FormData_pg_proc
   * ----------------
***************
*** 4436,4465 ****
  #define PROARGMODE_INOUT    'b'


- /*
-  * prototypes for functions in pg_proc.c
-  */
- extern Oid ProcedureCreate(const char *procedureName,
-                 Oid procNamespace,
-                 bool replace,
-                 bool returnsSet,
-                 Oid returnType,
-                 Oid languageObjectId,
-                 Oid languageValidator,
-                 const char *prosrc,
-                 const char *probin,
-                 bool isAgg,
-                 bool security_definer,
-                 bool isStrict,
-                 char volatility,
-                 oidvector *parameterTypes,
-                 Datum allParameterTypes,
-                 Datum parameterModes,
-                 Datum parameterNames,
-                 Datum proconfig,
-                 float4 procost,
-                 float4 prorows);
-
- extern bool function_parse_error_transpose(const char *prosrc);
-
  #endif   /* PG_PROC_H */
--- 4430,4433 ----
diff -rc pgsql_sugar.orig/src/include/catalog/pg_proc_fn.h pgsql_sugar/src/include/catalog/pg_proc_fn.h
*** pgsql_sugar.orig/src/include/catalog/pg_proc_fn.h    Tue Nov  6 12:50:37 2007
--- pgsql_sugar/src/include/catalog/pg_proc_fn.h    Tue Nov  6 13:29:18 2007
***************
*** 0 ****
--- 1,40 ----
+ /*-------------------------------------------------------------------------
+  *
+  * pg_proc_fn.h
+  *      prototypes for functions in pg_proc.c
+  *
+  * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
+  * Portions Copyright (c) 1994, Regents of the University of California
+  *
+  * $PostgreSQL:  $
+  *
+  *
+  *-------------------------------------------------------------------------
+  */
+ #ifndef PG_PROC_FN_H
+ #define PG_PROC_FN_H
+
+ extern Oid ProcedureCreate(const char *procedureName,
+                 Oid procNamespace,
+                 bool replace,
+                 bool returnsSet,
+                 Oid returnType,
+                 Oid languageObjectId,
+                 Oid languageValidator,
+                 const char *prosrc,
+                 const char *probin,
+                 bool isAgg,
+                 bool security_definer,
+                 bool isStrict,
+                 char volatility,
+                 oidvector *parameterTypes,
+                 Datum allParameterTypes,
+                 Datum parameterModes,
+                 Datum parameterNames,
+                 Datum proconfig,
+                 float4 procost,
+                 float4 prorows);
+
+ extern bool function_parse_error_transpose(const char *prosrc);
+
+ #endif   /* PG_PROC_FN_H */
diff -rc pgsql_sugar.orig/src/include/catalog/pg_rewrite.h pgsql_sugar/src/include/catalog/pg_rewrite.h
*** pgsql_sugar.orig/src/include/catalog/pg_rewrite.h    Tue Mar 20 00:38:31 2007
--- pgsql_sugar/src/include/catalog/pg_rewrite.h    Tue Nov  6 12:47:47 2007
***************
*** 22,33 ****
  #ifndef PG_REWRITE_H
  #define PG_REWRITE_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_rewrite definition.    cpp turns this into
--- 22,28 ----
  #ifndef PG_REWRITE_H
  #define PG_REWRITE_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_rewrite definition.    cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_shdepend.h pgsql_sugar/src/include/catalog/pg_shdepend.h
*** pgsql_sugar.orig/src/include/catalog/pg_shdepend.h    Fri Jan  5 23:19:53 2007
--- pgsql_sugar/src/include/catalog/pg_shdepend.h    Tue Nov  6 12:47:47 2007
***************
*** 19,30 ****
  #ifndef PG_SHDEPEND_H
  #define PG_SHDEPEND_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_shdepend definition.  cpp turns this into
--- 19,25 ----
  #ifndef PG_SHDEPEND_H
  #define PG_SHDEPEND_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_shdepend definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_shdescription.h pgsql_sugar/src/include/catalog/pg_shdescription.h
*** pgsql_sugar.orig/src/include/catalog/pg_shdescription.h    Fri Jan  5 23:19:53 2007
--- pgsql_sugar/src/include/catalog/pg_shdescription.h    Tue Nov  6 12:47:47 2007
***************
*** 29,40 ****
  #ifndef PG_SHDESCRIPTION_H
  #define PG_SHDESCRIPTION_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_shdescription definition.    cpp turns this into
--- 29,35 ----
  #ifndef PG_SHDESCRIPTION_H
  #define PG_SHDESCRIPTION_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_shdescription definition.    cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_statistic.h pgsql_sugar/src/include/catalog/pg_statistic.h
*** pgsql_sugar.orig/src/include/catalog/pg_statistic.h    Tue May  8 21:13:52 2007
--- pgsql_sugar/src/include/catalog/pg_statistic.h    Tue Nov  6 12:47:47 2007
***************
*** 19,30 ****
  #ifndef PG_STATISTIC_H
  #define PG_STATISTIC_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /*
   * Keep C compiler happy with anyarray, below.    This will need to go elsewhere
--- 19,25 ----
  #ifndef PG_STATISTIC_H
  #define PG_STATISTIC_H

! #include "catalog/genbki.h"

  /*
   * Keep C compiler happy with anyarray, below.    This will need to go elsewhere
diff -rc pgsql_sugar.orig/src/include/catalog/pg_tablespace.h pgsql_sugar/src/include/catalog/pg_tablespace.h
*** pgsql_sugar.orig/src/include/catalog/pg_tablespace.h    Fri Jan  5 23:19:53 2007
--- pgsql_sugar/src/include/catalog/pg_tablespace.h    Tue Nov  6 12:47:47 2007
***************
*** 19,30 ****
  #ifndef PG_TABLESPACE_H
  #define PG_TABLESPACE_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_tablespace definition.  cpp turns this into
--- 19,25 ----
  #ifndef PG_TABLESPACE_H
  #define PG_TABLESPACE_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_tablespace definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_trigger.h pgsql_sugar/src/include/catalog/pg_trigger.h
*** pgsql_sugar.orig/src/include/catalog/pg_trigger.h    Tue Mar 20 00:38:31 2007
--- pgsql_sugar/src/include/catalog/pg_trigger.h    Tue Nov  6 12:47:47 2007
***************
*** 19,30 ****
  #ifndef PG_TRIGGER_H
  #define PG_TRIGGER_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_trigger definition.    cpp turns this into
--- 19,25 ----
  #ifndef PG_TRIGGER_H
  #define PG_TRIGGER_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_trigger definition.    cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_ts_config.h pgsql_sugar/src/include/catalog/pg_ts_config.h
*** pgsql_sugar.orig/src/include/catalog/pg_ts_config.h    Tue Aug 21 03:11:27 2007
--- pgsql_sugar/src/include/catalog/pg_ts_config.h    Tue Nov  6 12:47:47 2007
***************
*** 21,32 ****
  #ifndef PG_TS_CONFIG_H
  #define PG_TS_CONFIG_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_ts_config definition.  cpp turns this into
--- 21,27 ----
  #ifndef PG_TS_CONFIG_H
  #define PG_TS_CONFIG_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_ts_config definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_ts_config_map.h pgsql_sugar/src/include/catalog/pg_ts_config_map.h
*** pgsql_sugar.orig/src/include/catalog/pg_ts_config_map.h    Tue Aug 21 03:11:27 2007
--- pgsql_sugar/src/include/catalog/pg_ts_config_map.h    Tue Nov  6 12:47:47 2007
***************
*** 21,32 ****
  #ifndef PG_TS_CONFIG_MAP_H
  #define PG_TS_CONFIG_MAP_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_ts_config_map definition.  cpp turns this into
--- 21,27 ----
  #ifndef PG_TS_CONFIG_MAP_H
  #define PG_TS_CONFIG_MAP_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_ts_config_map definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_ts_dict.h pgsql_sugar/src/include/catalog/pg_ts_dict.h
*** pgsql_sugar.orig/src/include/catalog/pg_ts_dict.h    Tue Aug 21 03:11:27 2007
--- pgsql_sugar/src/include/catalog/pg_ts_dict.h    Tue Nov  6 12:47:47 2007
***************
*** 21,32 ****
  #ifndef PG_TS_DICT_H
  #define PG_TS_DICT_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_ts_dict definition.  cpp turns this into
--- 21,27 ----
  #ifndef PG_TS_DICT_H
  #define PG_TS_DICT_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_ts_dict definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_ts_parser.h pgsql_sugar/src/include/catalog/pg_ts_parser.h
*** pgsql_sugar.orig/src/include/catalog/pg_ts_parser.h    Tue Aug 21 03:11:27 2007
--- pgsql_sugar/src/include/catalog/pg_ts_parser.h    Tue Nov  6 12:47:47 2007
***************
*** 21,32 ****
  #ifndef PG_TS_PARSER_H
  #define PG_TS_PARSER_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_ts_parser definition.  cpp turns this into
--- 21,27 ----
  #ifndef PG_TS_PARSER_H
  #define PG_TS_PARSER_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_ts_parser definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_ts_template.h pgsql_sugar/src/include/catalog/pg_ts_template.h
*** pgsql_sugar.orig/src/include/catalog/pg_ts_template.h    Mon Sep  3 04:30:45 2007
--- pgsql_sugar/src/include/catalog/pg_ts_template.h    Tue Nov  6 12:47:47 2007
***************
*** 21,32 ****
  #ifndef PG_TS_TEMPLATE_H
  #define PG_TS_TEMPLATE_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_ts_template definition.  cpp turns this into
--- 21,27 ----
  #ifndef PG_TS_TEMPLATE_H
  #define PG_TS_TEMPLATE_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_ts_template definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_type.h pgsql_sugar/src/include/catalog/pg_type.h
*** pgsql_sugar.orig/src/include/catalog/pg_type.h    Sun Oct 14 01:06:27 2007
--- pgsql_sugar/src/include/catalog/pg_type.h    Tue Nov  6 12:47:47 2007
***************
*** 19,34 ****
  #ifndef PG_TYPE_H
  #define PG_TYPE_H

! #include "nodes/nodes.h"

  /* ----------------
-  *        postgres.h contains the system type definitions and the
-  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
-  *        can be read by both genbki.sh and the C compiler.
-  * ----------------
-  */
-
- /* ----------------
   *        pg_type definition.  cpp turns this into
   *        typedef struct FormData_pg_type
   *
--- 19,27 ----
  #ifndef PG_TYPE_H
  #define PG_TYPE_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_type definition.  cpp turns this into
   *        typedef struct FormData_pg_type
   *
***************
*** 631,693 ****
       (typid) == ANYNONARRAYOID || \
       (typid) == ANYENUMOID)

- /*
-  * prototypes for functions in pg_type.c
-  */
- extern Oid    TypeShellMake(const char *typeName, Oid typeNamespace);

- extern Oid TypeCreate(Oid newTypeOid,
-            const char *typeName,
-            Oid typeNamespace,
-            Oid relationOid,
-            char relationKind,
-            int16 internalSize,
-            char typeType,
-            char typDelim,
-            Oid inputProcedure,
-            Oid outputProcedure,
-            Oid receiveProcedure,
-            Oid sendProcedure,
-            Oid typmodinProcedure,
-            Oid typmodoutProcedure,
-            Oid analyzeProcedure,
-            Oid elementType,
-            bool isImplicitArray,
-            Oid arrayType,
-            Oid baseType,
-            const char *defaultTypeValue,
-            char *defaultTypeBin,
-            bool passedByValue,
-            char alignment,
-            char storage,
-            int32 typeMod,
-            int32 typNDims,
-            bool typeNotNull);
-
- extern void GenerateTypeDependencies(Oid typeNamespace,
-                          Oid typeObjectId,
-                          Oid relationOid,
-                          char relationKind,
-                          Oid owner,
-                          Oid inputProcedure,
-                          Oid outputProcedure,
-                          Oid receiveProcedure,
-                          Oid sendProcedure,
-                             Oid typmodinProcedure,
-                             Oid typmodoutProcedure,
-                          Oid analyzeProcedure,
-                          Oid elementType,
-                          bool isImplicitArray,
-                          Oid baseType,
-                          Node *defaultExpr,
-                          bool rebuild);
-
- extern void TypeRename(Oid typeOid, const char *newTypeName,
-                        Oid typeNamespace);
-
- extern char *makeArrayTypeName(const char *typeName, Oid typeNamespace);
-
- extern bool moveArrayTypeName(Oid typeOid, const char *typeName,
-                               Oid typeNamespace);
-
  #endif   /* PG_TYPE_H */
--- 624,628 ----
diff -rc pgsql_sugar.orig/src/include/catalog/pg_type_fn.h pgsql_sugar/src/include/catalog/pg_type_fn.h
*** pgsql_sugar.orig/src/include/catalog/pg_type_fn.h    Tue Nov  6 12:50:50 2007
--- pgsql_sugar/src/include/catalog/pg_type_fn.h    Tue Nov  6 13:23:16 2007
***************
*** 0 ****
--- 1,77 ----
+ /*-------------------------------------------------------------------------
+  *
+  * pg_type_fn.h
+  *      prototypes for functions in pg_type.c
+  *
+  *
+  * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
+  * Portions Copyright (c) 1994, Regents of the University of California
+  *
+  * $PostgreSQL: $
+  *
+  *
+  *-------------------------------------------------------------------------
+  */
+ #ifndef PG_TYPE_FN_H
+ #define PG_TYPE_FN_H
+
+ #include "nodes/nodes.h"
+
+ extern Oid    TypeShellMake(const char *typeName, Oid typeNamespace);
+
+ extern Oid TypeCreate(Oid newTypeOid,
+                  const char *typeName,
+                  Oid typeNamespace,
+                  Oid relationOid,
+                  char relationKind,
+                  int16 internalSize,
+                  char typeType,
+                  char typDelim,
+                  Oid inputProcedure,
+                  Oid outputProcedure,
+                  Oid receiveProcedure,
+                  Oid sendProcedure,
+                  Oid typmodinProcedure,
+                  Oid typmodoutProcedure,
+                  Oid analyzeProcedure,
+                  Oid elementType,
+                  bool isImplicitArray,
+                  Oid arrayType,
+                  Oid baseType,
+                  const char *defaultTypeValue,
+                  char *defaultTypeBin,
+                  bool passedByValue,
+                  char alignment,
+                  char storage,
+                  int32 typeMod,
+                  int32 typNDims,
+                  bool typeNotNull);
+
+ extern void GenerateTypeDependencies(Oid typeNamespace,
+                                                Oid typeObjectId,
+                                                Oid relationOid,
+                                                char relationKind,
+                                                Oid owner,
+                                                Oid inputProcedure,
+                                                Oid outputProcedure,
+                                                Oid receiveProcedure,
+                                                Oid sendProcedure,
+                                                Oid typmodinProcedure,
+                                                Oid typmodoutProcedure,
+                                                Oid analyzeProcedure,
+                                                Oid elementType,
+                                                bool isImplicitArray,
+                                                Oid baseType,
+                                                Node *defaultExpr,
+                                                bool rebuild);
+
+ extern void TypeRename(Oid typeOid, const char *newTypeName,
+                                          Oid typeNamespace);
+
+ extern char *makeArrayTypeName(const char *typeName, Oid typeNamespace);
+
+ extern bool moveArrayTypeName(Oid typeOid, const char *typeName,
+                                                         Oid typeNamespace);
+
+
+ #endif   /* PG_TYPE_FN_H */
diff -rc pgsql_sugar.orig/src/include/commands/sequence.h pgsql_sugar/src/include/commands/sequence.h
*** pgsql_sugar.orig/src/include/commands/sequence.h    Fri Jan  5 23:19:54 2007
--- pgsql_sugar/src/include/commands/sequence.h    Tue Nov  6 12:47:47 2007
***************
*** 94,106 ****
  extern void seq_redo(XLogRecPtr lsn, XLogRecord *rptr);
  extern void seq_desc(StringInfo buf, uint8 xl_info, char *rec);

- /* Set the upper and lower bounds of a sequence */
- #ifndef INT64_IS_BUSTED
- #define SEQ_MAXVALUE    INT64CONST(0x7FFFFFFFFFFFFFFF)
- #else                            /* INT64_IS_BUSTED */
- #define SEQ_MAXVALUE    ((int64) 0x7FFFFFFF)
- #endif   /* INT64_IS_BUSTED */
-
- #define SEQ_MINVALUE    (-SEQ_MAXVALUE)
-
  #endif   /* SEQUENCE_H */
--- 94,97 ----
diff -rc pgsql_sugar.orig/src/pl/plpgsql/src/pl_comp.c pgsql_sugar/src/pl/plpgsql/src/pl_comp.c
*** pgsql_sugar.orig/src/pl/plpgsql/src/pl_comp.c    Mon Jul 16 19:01:10 2007
--- pgsql_sugar/src/pl/plpgsql/src/pl_comp.c    Tue Nov  6 12:47:47 2007
***************
*** 25,30 ****
--- 25,31 ----
  #include "catalog/pg_attribute.h"
  #include "catalog/pg_class.h"
  #include "catalog/pg_proc.h"
+ #include "catalog/pg_proc_fn.h"
  #include "catalog/pg_type.h"
  #include "funcapi.h"
  #include "nodes/makefuncs.h"

Re: Fix pg_dump dependency on postgres.h

From
Alvaro Herrera
Date:
Zdenek Kotala wrote:
> Zdenek Kotala 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
>>>
>> I found two problems there. One is that I forgot postgres.h include in
>> common.c. it is easy to fix. However second problem is more complicated.
>> dumputils.c calls ScandKeywordLookup function which is defined in
>> keyword.c. :(
>
> <snip>
>
>> 3) Put following fake into keyword.c before include "parse.h" line. It is
>> easiest way.
>> #define TYPE_IS_DECLARED 1
>> #define YYLTYPE_IS_DECLARED 1
>> #define YYLTYPE void*
>> #define YYSTYPE void*
>
> New version of patch is attached. I selected variant 3 as a best solution.
> Patch also fix some other postgres.h dependencyin another tools such as
> pg_controldata, pg_config. The last unfixed tool is pg_resetxlog which
> deserves own patch.

Humm, but YYLTYPE is defined in gramparse.h (and as a different type)
...  Also, I see that if you define YYLTYPE then you don't need
YYLTYPE_IS_DECLARED as well.  Also I don't see any TYPE_IS_DECLARED
here.  What I'm thinking is that this patch is not very portable :-(

--
Alvaro Herrera       Valdivia, Chile   ICBM: S 39º 49' 18.1", W 73º 13' 56.4"
"Llegará una época en la que una investigación diligente y prolongada sacará
a la luz cosas que hoy están ocultas" (Séneca, siglo I)

Re: Fix pg_dump dependency on postgres.h

From
Zdenek Kotala
Date:
Alvaro Herrera wrote:
> Zdenek Kotala wrote:
>> Zdenek Kotala 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
>>>>
>>> I found two problems there. One is that I forgot postgres.h include in
>>> common.c. it is easy to fix. However second problem is more complicated.
>>> dumputils.c calls ScandKeywordLookup function which is defined in
>>> keyword.c. :(
>> <snip>
>>
>>> 3) Put following fake into keyword.c before include "parse.h" line. It is
>>> easiest way.
>>> #define TYPE_IS_DECLARED 1
>>> #define YYLTYPE_IS_DECLARED 1
>>> #define YYLTYPE void*
>>> #define YYSTYPE void*
>> New version of patch is attached. I selected variant 3 as a best solution.
>> Patch also fix some other postgres.h dependencyin another tools such as
>> pg_controldata, pg_config. The last unfixed tool is pg_resetxlog which
>> deserves own patch.
>
> Humm, but YYLTYPE is defined in gramparse.h (and as a different type)
> ...  Also, I see that if you define YYLTYPE then you don't need
> YYLTYPE_IS_DECLARED as well.  Also I don't see any TYPE_IS_DECLARED
> here.  What I'm thinking is that this patch is not very portable :-(

Thanks you for your comments.

You are right, define YYLTYPE and YYSTYPE is enough to skip
union/structure definition.  I think, data type is not important for
this purpose, but use int instead of void* seem good idea. It will be
synchronized with gramparse.h.

What do you mean "not very portable"? What could be problem there?

        Zdenek


Re: Fix pg_dump dependency on postgres.h

From
Alvaro Herrera
Date:
Zdenek Kotala wrote:
> Alvaro Herrera wrote:

>>>> 3) Put following fake into keyword.c before include "parse.h" line. It
>>>> is easiest way.
>>>> #define TYPE_IS_DECLARED 1
>>>> #define YYLTYPE_IS_DECLARED 1
>>>> #define YYLTYPE void*
>>>> #define YYSTYPE void*
>>> New version of patch is attached. I selected variant 3 as a best
>>> solution. Patch also fix some other postgres.h dependencyin another tools
>>> such as pg_controldata, pg_config. The last unfixed tool is pg_resetxlog
>>> which deserves own patch.
>> Humm, but YYLTYPE is defined in gramparse.h (and as a different type)
>> ...  Also, I see that if you define YYLTYPE then you don't need
>> YYLTYPE_IS_DECLARED as well.  Also I don't see any TYPE_IS_DECLARED
>> here.  What I'm thinking is that this patch is not very portable :-(
>
> Thanks you for your comments.
>
> You are right, define YYLTYPE and YYSTYPE is enough to skip union/structure
> definition.  I think, data type is not important for this purpose, but use
> int instead of void* seem good idea. It will be synchronized with
> gramparse.h.
>
> What do you mean "not very portable"? What could be problem there?

I'm not sure.  My point is that it seems your parse.h requires
TYPE_IS_DECLARED, but mine doesn't.  What else could be lurking in there
that requires a specific fix?  In order to avoid that, it would be
better if there was a solution to the problem along the lines of #2 you
proposed.

--
Alvaro Herrera                          Developer, http://www.PostgreSQL.org/
"No renuncies a nada. No te aferres a nada."

Re: Fix pg_dump dependency on postgres.h

From
Zdenek Kotala
Date:
Alvaro Herrera wrote:
> Zdenek Kotala wrote:
>> Alvaro Herrera wrote:
>
>>>>> 3) Put following fake into keyword.c before include "parse.h" line. It
>>>>> is easiest way.
>>>>> #define TYPE_IS_DECLARED 1
>>>>> #define YYLTYPE_IS_DECLARED 1
>>>>> #define YYLTYPE void*
>>>>> #define YYSTYPE void*
>>>> New version of patch is attached. I selected variant 3 as a best
>>>> solution. Patch also fix some other postgres.h dependencyin another tools
>>>> such as pg_controldata, pg_config. The last unfixed tool is pg_resetxlog
>>>> which deserves own patch.
>>> Humm, but YYLTYPE is defined in gramparse.h (and as a different type)
>>> ...  Also, I see that if you define YYLTYPE then you don't need
>>> YYLTYPE_IS_DECLARED as well.  Also I don't see any TYPE_IS_DECLARED
>>> here.  What I'm thinking is that this patch is not very portable :-(
>> Thanks you for your comments.
>>
>> You are right, define YYLTYPE and YYSTYPE is enough to skip union/structure
>> definition.  I think, data type is not important for this purpose, but use
>> int instead of void* seem good idea. It will be synchronized with
>> gramparse.h.
>>
>> What do you mean "not very portable"? What could be problem there?
>
> I'm not sure.  My point is that it seems your parse.h requires
> TYPE_IS_DECLARED, but mine doesn't.  What else could be lurking in there
> that requires a specific fix?  In order to avoid that, it would be
> better if there was a solution to the problem along the lines of #2 you
> proposed.
>

TYPE_IS_DECLARED was my mistake. It should be YYSTYPE_IS_DECLARED. It
works because YYSTYPE is also defined and #ifdef checks both. Copy and
paste :( error. Sorry for confusion. I'm going to send new version.


        Zdenek


Re: Fix pg_dump dependency on postgres.h

From
Tom Lane
Date:
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> Zdenek Kotala wrote:
>> What do you mean "not very portable"? What could be problem there?

> I'm not sure.  My point is that it seems your parse.h requires
> TYPE_IS_DECLARED, but mine doesn't.  What else could be lurking in there
> that requires a specific fix?

The "portability" axis of concern here is portability across different
versions of bison.  ATM I believe we work with everything from 1.875 up,
and I'd be loath to give that up.

I concur with Alvaro that this feels like a kluge rather than a
permanent solution.

            regards, tom lane

Re: Fix pg_dump dependency on postgres.h

From
Zdenek Kotala
Date:
Tom Lane wrote:
> Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
>> Zdenek Kotala wrote:
>>> What do you mean "not very portable"? What could be problem there?
>
>> I'm not sure.  My point is that it seems your parse.h requires
>> TYPE_IS_DECLARED, but mine doesn't.  What else could be lurking in there
>> that requires a specific fix?
>
> The "portability" axis of concern here is portability across different
> versions of bison.  ATM I believe we work with everything from 1.875 up,
> and I'd be loath to give that up.
>
> I concur with Alvaro that this feels like a kluge rather than a
> permanent solution.
>

But, if you look into gramparse.h it also redefine YYLTYPE for own
purpose. It is similar mechanism. However YYSTYPE definition generates
different storage for base_yylval. It could be problem with some
compiler/linker. :(

Unfortunately, I don't see any solution with modification gram.y (I'm
not bison hunter).

Another solution is what ecpg does. It has own modified copy of
keyword.c. But it will require to keep it synchronized. Or if we put
parentheses around all columns we don't need keyword.c. It also fix a
problem with old dump file when we introduce new keyword in the future.

        Zdenek


Re: Fix pg_dump dependency on postgres.h

From
Tom Lane
Date:
Zdenek Kotala <Zdenek.Kotala@Sun.COM> writes:
> TYPE_IS_DECLARED was my mistake. It should be YYSTYPE_IS_DECLARED. It
> works because YYSTYPE is also defined and #ifdef checks both. Copy and
> paste :( error. Sorry for confusion. I'm going to send new version.

[ after further review... ]

It looks to me like the intended use of YYSTYPE_IS_DECLARED is to
denote the case where the user has supplied a typedef, not macro,
definition of YYSTYPE.  So defining YYSTYPE as a macro and setting
YYSTYPE_IS_DECLARED as well really seems incorrect.

The real question with all this is that while the Bison manual clearly
says that you can #define YYSTYPE, there is not anything suggesting
that you can or should do that when using %union; they are presented as
two different ways of defining the type.  So I find it a bit surprising
that the #if is there at all in parse.h.  Nonetheless it is there in
all versions from 1.875 to 2.3, and in the 2.3 manual it says

     Unless `YYSTYPE' is already defined as a macro, the output header
     declares `YYSTYPE'.

So apparently the Bison guys do intend to carry that behavior forward.

AFAICT, therefore, the proposed patch should only define YYSTYPE and
not anything else (there's no need to be afraid of YYLTYPE at present).

            regards, tom lane

Re: Fix pg_dump dependency on postgres.h

From
Zdenek Kotala
Date:
Tom Lane wrote:

<snip>
>
> AFAICT, therefore, the proposed patch should only define YYSTYPE and
> not anything else (there's no need to be afraid of YYLTYPE at present).

Thank your for Your and Alvaro's comments. I attached updated patch
version only with YYSTYPE definition.

        Thanks Zdenek
diff -rc pgsql_sugar.orig/src/backend/catalog/heap.c pgsql_sugar/src/backend/catalog/heap.c
*** pgsql_sugar.orig/src/backend/catalog/heap.c    Mon Oct 29 20:40:39 2007
--- pgsql_sugar/src/backend/catalog/heap.c    Tue Nov  6 12:47:46 2007
***************
*** 45,50 ****
--- 45,51 ----
  #include "catalog/pg_statistic.h"
  #include "catalog/pg_tablespace.h"
  #include "catalog/pg_type.h"
+ #include "catalog/pg_type_fn.h"
  #include "commands/tablecmds.h"
  #include "commands/typecmds.h"
  #include "miscadmin.h"
diff -rc pgsql_sugar.orig/src/backend/catalog/pg_aggregate.c pgsql_sugar/src/backend/catalog/pg_aggregate.c
*** pgsql_sugar.orig/src/backend/catalog/pg_aggregate.c    Mon Sep  3 02:39:14 2007
--- pgsql_sugar/src/backend/catalog/pg_aggregate.c    Tue Nov  6 12:47:46 2007
***************
*** 21,26 ****
--- 21,27 ----
  #include "catalog/pg_language.h"
  #include "catalog/pg_operator.h"
  #include "catalog/pg_proc.h"
+ #include "catalog/pg_proc_fn.h"
  #include "catalog/pg_type.h"
  #include "miscadmin.h"
  #include "parser/parse_coerce.h"
diff -rc pgsql_sugar.orig/src/backend/catalog/pg_proc.c pgsql_sugar/src/backend/catalog/pg_proc.c
*** pgsql_sugar.orig/src/backend/catalog/pg_proc.c    Mon Sep  3 02:39:14 2007
--- pgsql_sugar/src/backend/catalog/pg_proc.c    Tue Nov  6 12:47:46 2007
***************
*** 21,26 ****
--- 21,27 ----
  #include "catalog/pg_language.h"
  #include "catalog/pg_namespace.h"
  #include "catalog/pg_proc.h"
+ #include "catalog/pg_proc_fn.h"
  #include "catalog/pg_type.h"
  #include "executor/functions.h"
  #include "funcapi.h"
diff -rc pgsql_sugar.orig/src/backend/catalog/pg_type.c pgsql_sugar/src/backend/catalog/pg_type.c
*** pgsql_sugar.orig/src/backend/catalog/pg_type.c    Sat May 12 02:54:59 2007
--- pgsql_sugar/src/backend/catalog/pg_type.c    Tue Nov  6 12:47:46 2007
***************
*** 21,26 ****
--- 21,27 ----
  #include "catalog/pg_namespace.h"
  #include "catalog/pg_proc.h"
  #include "catalog/pg_type.h"
+ #include "catalog/pg_type_fn.h"
  #include "commands/typecmds.h"
  #include "miscadmin.h"
  #include "parser/scansup.h"
diff -rc pgsql_sugar.orig/src/backend/commands/functioncmds.c pgsql_sugar/src/backend/commands/functioncmds.c
*** pgsql_sugar.orig/src/backend/commands/functioncmds.c    Mon Sep  3 20:46:29 2007
--- pgsql_sugar/src/backend/commands/functioncmds.c    Tue Nov  6 12:47:46 2007
***************
*** 41,47 ****
--- 41,49 ----
  #include "catalog/pg_language.h"
  #include "catalog/pg_namespace.h"
  #include "catalog/pg_proc.h"
+ #include "catalog/pg_proc_fn.h"
  #include "catalog/pg_type.h"
+ #include "catalog/pg_type_fn.h"
  #include "commands/defrem.h"
  #include "commands/proclang.h"
  #include "miscadmin.h"
diff -rc pgsql_sugar.orig/src/backend/commands/proclang.c pgsql_sugar/src/backend/commands/proclang.c
*** pgsql_sugar.orig/src/backend/commands/proclang.c    Mon Sep  3 02:39:15 2007
--- pgsql_sugar/src/backend/commands/proclang.c    Tue Nov  6 12:47:46 2007
***************
*** 22,27 ****
--- 22,28 ----
  #include "catalog/pg_namespace.h"
  #include "catalog/pg_pltemplate.h"
  #include "catalog/pg_proc.h"
+ #include "catalog/pg_proc_fn.h"
  #include "catalog/pg_type.h"
  #include "commands/dbcommands.h"
  #include "commands/defrem.h"
diff -rc pgsql_sugar.orig/src/backend/commands/tablecmds.c pgsql_sugar/src/backend/commands/tablecmds.c
*** pgsql_sugar.orig/src/backend/commands/tablecmds.c    Fri Oct 12 20:55:12 2007
--- pgsql_sugar/src/backend/commands/tablecmds.c    Tue Nov  6 12:47:46 2007
***************
*** 32,37 ****
--- 32,38 ----
  #include "catalog/pg_tablespace.h"
  #include "catalog/pg_trigger.h"
  #include "catalog/pg_type.h"
+ #include "catalog/pg_type_fn.h"
  #include "catalog/toasting.h"
  #include "commands/cluster.h"
  #include "commands/defrem.h"
diff -rc pgsql_sugar.orig/src/backend/commands/typecmds.c pgsql_sugar/src/backend/commands/typecmds.c
*** pgsql_sugar.orig/src/backend/commands/typecmds.c    Mon Oct 29 20:40:39 2007
--- pgsql_sugar/src/backend/commands/typecmds.c    Tue Nov  6 12:47:46 2007
***************
*** 43,48 ****
--- 43,49 ----
  #include "catalog/pg_enum.h"
  #include "catalog/pg_namespace.h"
  #include "catalog/pg_type.h"
+ #include "catalog/pg_type_fn.h"
  #include "commands/defrem.h"
  #include "commands/tablecmds.h"
  #include "commands/typecmds.h"
diff -rc pgsql_sugar.orig/src/backend/parser/keywords.c pgsql_sugar/src/backend/parser/keywords.c
*** pgsql_sugar.orig/src/backend/parser/keywords.c    Mon Sep 24 03:29:29 2007
--- pgsql_sugar/src/backend/parser/keywords.c    Wed Nov 14 20:20:44 2007
***************
*** 12,23 ****
   *
   *-------------------------------------------------------------------------
   */
! #include "postgres.h"

  #include <ctype.h>

! #include "nodes/parsenodes.h"
! #include "parser/gramparse.h"    /* required before parser/parse.h! */
  #include "parser/keywords.h"
  #include "parser/parse.h"

--- 12,29 ----
   *
   *-------------------------------------------------------------------------
   */
! #include "c.h"

  #include <ctype.h>

! /* Following macro disables YYSTYPE union definition
!  * in parse.h which is unnecessary for this source and
!  * it cause useless dependency on another headers. It
!  * is very important for pg_dump which also share this
!  * piece of code and it cannot include postgres.h
!  */
! #define YYSTYPE int
!
  #include "parser/keywords.h"
  #include "parser/parse.h"

diff -rc pgsql_sugar.orig/src/backend/utils/hash/pg_crc.c pgsql_sugar/src/backend/utils/hash/pg_crc.c
*** pgsql_sugar.orig/src/backend/utils/hash/pg_crc.c    Fri Jan  5 23:19:43 2007
--- pgsql_sugar/src/backend/utils/hash/pg_crc.c    Wed Nov 14 14:24:06 2007
***************
*** 23,29 ****
   *
   *-------------------------------------------------------------------------
   */
! #include "postgres.h"



--- 23,29 ----
   *
   *-------------------------------------------------------------------------
   */
! #include "c.h"



diff -rc pgsql_sugar.orig/src/bin/pg_config/pg_config.c pgsql_sugar/src/bin/pg_config/pg_config.c
*** pgsql_sugar.orig/src/bin/pg_config/pg_config.c    Thu May 31 17:13:04 2007
--- pgsql_sugar/src/bin/pg_config/pg_config.c    Wed Nov 14 12:41:34 2007
***************
*** 22,28 ****
   *-------------------------------------------------------------------------
   */

! #include "postgres.h"

  #include "port.h"

--- 22,28 ----
   *-------------------------------------------------------------------------
   */

! #include "postgres_fe.h"

  #include "port.h"

diff -rc pgsql_sugar.orig/src/bin/pg_controldata/pg_controldata.c pgsql_sugar/src/bin/pg_controldata/pg_controldata.c
*** pgsql_sugar.orig/src/bin/pg_controldata/pg_controldata.c    Tue Apr  3 06:14:26 2007
--- pgsql_sugar/src/bin/pg_controldata/pg_controldata.c    Wed Nov 14 12:42:14 2007
***************
*** 8,14 ****
   *
   * $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.34 2007/03/18 16:50:43 neilc Exp $
   */
! #include "postgres.h"

  #include <unistd.h>
  #include <time.h>
--- 8,14 ----
   *
   * $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.34 2007/03/18 16:50:43 neilc Exp $
   */
! #include "postgres_fe.h"

  #include <unistd.h>
  #include <time.h>
diff -rc pgsql_sugar.orig/src/bin/pg_dump/common.c pgsql_sugar/src/bin/pg_dump/common.c
*** pgsql_sugar.orig/src/bin/pg_dump/common.c    Sun Oct 28 20:08:02 2007
--- pgsql_sugar/src/bin/pg_dump/common.c    Wed Nov 14 12:43:03 2007
***************
*** 19,25 ****
  #include "postgres_fe.h"
  #include "pg_backup_archiver.h"

- #include "postgres.h"
  #include "catalog/pg_class.h"

  #include <ctype.h>
--- 19,24 ----
diff -rc pgsql_sugar.orig/src/bin/pg_dump/pg_dump.c pgsql_sugar/src/bin/pg_dump/pg_dump.c
*** pgsql_sugar.orig/src/bin/pg_dump/pg_dump.c    Sat Oct 13 22:18:41 2007
--- pgsql_sugar/src/bin/pg_dump/pg_dump.c    Wed Nov 14 14:53:39 2007
***************
*** 17,28 ****
   *-------------------------------------------------------------------------
   */

! /*
!  * Although this is not a backend module, we must include postgres.h anyway
!  * so that we can include a bunch of backend include files.  pg_dump has
!  * never pretended to be very independent of the backend anyhow ...
!  */
! #include "postgres.h"

  #include <unistd.h>

--- 17,23 ----
   *-------------------------------------------------------------------------
   */

! #include "postgres_fe.h"

  #include <unistd.h>

***************
*** 41,51 ****
  #endif

  #include "access/htup.h"
  #include "catalog/pg_class.h"
  #include "catalog/pg_proc.h"
  #include "catalog/pg_trigger.h"
  #include "catalog/pg_type.h"
- #include "commands/sequence.h"
  #include "libpq/libpq-fs.h"

  #include "pg_backup_archiver.h"
--- 36,46 ----
  #endif

  #include "access/htup.h"
+ #include "access/attnum.h"
  #include "catalog/pg_class.h"
  #include "catalog/pg_proc.h"
  #include "catalog/pg_trigger.h"
  #include "catalog/pg_type.h"
  #include "libpq/libpq-fs.h"

  #include "pg_backup_archiver.h"
diff -rc pgsql_sugar.orig/src/bin/psql/print.c pgsql_sugar/src/bin/psql/print.c
*** pgsql_sugar.orig/src/bin/psql/print.c    Fri Jan  5 23:19:49 2007
--- pgsql_sugar/src/bin/psql/print.c    Wed Nov 14 12:44:02 2007
***************
*** 8,14 ****
   * Note: we include postgres.h not postgres_fe.h so that we can include
   * catalog/pg_type.h, and thereby have access to INT4OID and similar macros.
   */
! #include "postgres.h"
  #include "print.h"
  #include "catalog/pg_type.h"

--- 8,14 ----
   * Note: we include postgres.h not postgres_fe.h so that we can include
   * catalog/pg_type.h, and thereby have access to INT4OID and similar macros.
   */
! #include "postgres_fe.h"
  #include "print.h"
  #include "catalog/pg_type.h"

diff -rc pgsql_sugar.orig/src/include/pg_config_manual.h pgsql_sugar/src/include/pg_config_manual.h
*** pgsql_sugar.orig/src/include/pg_config_manual.h    Fri Jun  8 20:23:53 2007
--- pgsql_sugar/src/include/pg_config_manual.h    Tue Nov  6 12:47:46 2007
***************
*** 197,203 ****
--- 197,214 ----
   */
  #define MAX_RANDOM_VALUE  (0x7FFFFFFF)

+ /*
+  * Set the upper and lower bounds of a sequence
+  */
+ #ifndef INT64_IS_BUSTED
+ #define SEQ_MAXVALUE    INT64CONST(0x7FFFFFFFFFFFFFFF)
+ #else                                                   /* INT64_IS_BUSTED */
+ #define SEQ_MAXVALUE    ((int64) 0x7FFFFFFF)
+ #endif   /* INT64_IS_BUSTED */

+ #define SEQ_MINVALUE    (-SEQ_MAXVALUE)
+
+
  /*
   *------------------------------------------------------------------------
   * The following symbols are for enabling debugging code, not for
diff -rc pgsql_sugar.orig/src/include/postgres.h pgsql_sugar/src/include/postgres.h
*** pgsql_sugar.orig/src/include/postgres.h    Mon Oct  1 18:25:56 2007
--- pgsql_sugar/src/include/postgres.h    Tue Nov  6 12:51:45 2007
***************
*** 26,32 ****
   *        1)        variable-length datatypes (TOAST support)
   *        2)        datum type + support macros
   *        3)        exception handling definitions
-  *        4)        genbki macros used by catalog/pg_xxx.h files
   *
   *     NOTES
   *
--- 26,31 ----
***************
*** 710,730 ****
                                  const char *errorType,
                                  const char *fileName, int lineNumber);

- /* ----------------------------------------------------------------
-  *                Section 4: genbki macros used by catalog/pg_xxx.h files
-  * ----------------------------------------------------------------
-  */
- #define CATALOG(name,oid)    typedef struct CppConcat(FormData_,name)
-
- #define BKI_BOOTSTRAP
- #define BKI_SHARED_RELATION
- #define BKI_WITHOUT_OIDS
-
- /* these need to expand into some harmless, repeatable declaration */
- #define DATA(x)   extern int no_such_variable
- #define DESCR(x)  extern int no_such_variable
- #define SHDESCR(x) extern int no_such_variable
-
- typedef int4 aclitem;            /* PHONY definition for catalog use only */
-
  #endif   /* POSTGRES_H */
--- 709,712 ----
diff -rc pgsql_sugar.orig/src/include/catalog/genbki.h pgsql_sugar/src/include/catalog/genbki.h
*** pgsql_sugar.orig/src/include/catalog/genbki.h    Tue Nov  6 12:50:26 2007
--- pgsql_sugar/src/include/catalog/genbki.h    Tue Nov  6 13:19:36 2007
***************
*** 0 ****
--- 1,35 ----
+ /*-------------------------------------------------------------------------
+  *
+  * genbki.h
+  *      Primary include file for all catalog header files
+  *
+  * genbki.h contains the CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so
+  * this file can be read by both genbki.sh and the C compiler.
+  *
+  *
+  * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
+  * Portions Copyright (c) 1995, Regents of the University of California
+  *
+  * $PostgreSQL:  $
+  *
+  *-------------------------------------------------------------------------
+  */
+ #ifndef GENBKI_H
+ #define GENBKI_H
+
+ #include "c.h"
+
+ #define CATALOG(name,oid)    typedef struct CppConcat(FormData_,name)
+
+ #define BKI_BOOTSTRAP
+ #define BKI_SHARED_RELATION
+ #define BKI_WITHOUT_OIDS
+
+ /* these need to expand into some harmless, repeatable declaration */
+ #define DATA(x)   extern int no_such_variable
+ #define DESCR(x)  extern int no_such_variable
+ #define SHDESCR(x) extern int no_such_variable
+
+ typedef int4 aclitem;            /* PHONY definition for catalog use only */
+
+ #endif   /* GENBKI_H */
diff -rc pgsql_sugar.orig/src/include/catalog/pg_aggregate.h pgsql_sugar/src/include/catalog/pg_aggregate.h
*** pgsql_sugar.orig/src/include/catalog/pg_aggregate.h    Wed Oct 24 04:24:47 2007
--- pgsql_sugar/src/include/catalog/pg_aggregate.h    Tue Nov  6 12:47:46 2007
***************
*** 19,24 ****
--- 19,25 ----
  #ifndef PG_AGGREGATE_H
  #define PG_AGGREGATE_H

+ #include "catalog/genbki.h"
  #include "nodes/pg_list.h"

  /* ----------------
diff -rc pgsql_sugar.orig/src/include/catalog/pg_am.h pgsql_sugar/src/include/catalog/pg_am.h
*** pgsql_sugar.orig/src/include/catalog/pg_am.h    Sat Apr  7 00:33:43 2007
--- pgsql_sugar/src/include/catalog/pg_am.h    Tue Nov  6 12:47:46 2007
***************
*** 22,33 ****
  #ifndef PG_AM_H
  #define PG_AM_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_am definition.  cpp turns this into
--- 22,28 ----
  #ifndef PG_AM_H
  #define PG_AM_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_am definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_amop.h pgsql_sugar/src/include/catalog/pg_amop.h
*** pgsql_sugar.orig/src/include/catalog/pg_amop.h    Tue Aug 21 03:11:25 2007
--- pgsql_sugar/src/include/catalog/pg_amop.h    Tue Nov  6 12:47:46 2007
***************
*** 40,51 ****
  #ifndef PG_AMOP_H
  #define PG_AMOP_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_amop definition.  cpp turns this into
--- 40,46 ----
  #ifndef PG_AMOP_H
  #define PG_AMOP_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_amop definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_amproc.h pgsql_sugar/src/include/catalog/pg_amproc.h
*** pgsql_sugar.orig/src/include/catalog/pg_amproc.h    Mon Sep  3 03:18:33 2007
--- pgsql_sugar/src/include/catalog/pg_amproc.h    Tue Nov  6 12:47:46 2007
***************
*** 33,44 ****
  #ifndef PG_AMPROC_H
  #define PG_AMPROC_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_amproc definition.  cpp turns this into
--- 33,39 ----
  #ifndef PG_AMPROC_H
  #define PG_AMPROC_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_amproc definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_attrdef.h pgsql_sugar/src/include/catalog/pg_attrdef.h
*** pgsql_sugar.orig/src/include/catalog/pg_attrdef.h    Fri Jan  5 23:19:52 2007
--- pgsql_sugar/src/include/catalog/pg_attrdef.h    Tue Nov  6 12:47:46 2007
***************
*** 19,30 ****
  #ifndef PG_ATTRDEF_H
  #define PG_ATTRDEF_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_attrdef definition.    cpp turns this into
--- 19,25 ----
  #ifndef PG_ATTRDEF_H
  #define PG_ATTRDEF_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_attrdef definition.    cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_attribute.h pgsql_sugar/src/include/catalog/pg_attribute.h
*** pgsql_sugar.orig/src/include/catalog/pg_attribute.h    Thu Sep 20 19:56:32 2007
--- pgsql_sugar/src/include/catalog/pg_attribute.h    Tue Nov  6 12:47:46 2007
***************
*** 24,35 ****
  #ifndef PG_ATTRIBUTE_H
  #define PG_ATTRIBUTE_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_attribute definition.  cpp turns this into
--- 24,30 ----
  #ifndef PG_ATTRIBUTE_H
  #define PG_ATTRIBUTE_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_attribute definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_auth_members.h pgsql_sugar/src/include/catalog/pg_auth_members.h
*** pgsql_sugar.orig/src/include/catalog/pg_auth_members.h    Fri Jan  5 23:19:52 2007
--- pgsql_sugar/src/include/catalog/pg_auth_members.h    Wed Nov 14 14:41:07 2007
***************
*** 19,24 ****
--- 19,26 ----
  #ifndef PG_AUTH_MEMBERS_H
  #define PG_AUTH_MEMBERS_H

+ #include "catalog/genbki.h"
+
  /* ----------------
   *        pg_auth_members definition.  cpp turns this into
   *        typedef struct FormData_pg_auth_members
diff -rc pgsql_sugar.orig/src/include/catalog/pg_authid.h pgsql_sugar/src/include/catalog/pg_authid.h
*** pgsql_sugar.orig/src/include/catalog/pg_authid.h    Fri Jan  5 23:19:52 2007
--- pgsql_sugar/src/include/catalog/pg_authid.h    Tue Nov  6 12:47:46 2007
***************
*** 21,26 ****
--- 21,28 ----
  #ifndef PG_AUTHID_H
  #define PG_AUTHID_H

+ #include "catalog/genbki.h"
+
  /*
   * The CATALOG definition has to refer to the type of rolvaliduntil as
   * "timestamptz" (lower case) so that bootstrap mode recognizes it.  But
diff -rc pgsql_sugar.orig/src/include/catalog/pg_autovacuum.h pgsql_sugar/src/include/catalog/pg_autovacuum.h
*** pgsql_sugar.orig/src/include/catalog/pg_autovacuum.h    Fri Jan  5 23:19:52 2007
--- pgsql_sugar/src/include/catalog/pg_autovacuum.h    Tue Nov  6 12:47:46 2007
***************
*** 13,24 ****
  #ifndef PG_AUTOVACUUM_H
  #define PG_AUTOVACUUM_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_autovacuum definition.    cpp turns this into
--- 13,19 ----
  #ifndef PG_AUTOVACUUM_H
  #define PG_AUTOVACUUM_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_autovacuum definition.    cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_cast.h pgsql_sugar/src/include/catalog/pg_cast.h
*** pgsql_sugar.orig/src/include/catalog/pg_cast.h    Tue Aug 21 03:11:25 2007
--- pgsql_sugar/src/include/catalog/pg_cast.h    Tue Nov  6 12:47:46 2007
***************
*** 21,26 ****
--- 21,28 ----
  #ifndef PG_CAST_H
  #define PG_CAST_H

+ #include "catalog/genbki.h"
+
  #define CastRelationId    2605

  CATALOG(pg_cast,2605)
diff -rc pgsql_sugar.orig/src/include/catalog/pg_class.h pgsql_sugar/src/include/catalog/pg_class.h
*** pgsql_sugar.orig/src/include/catalog/pg_class.h    Mon Sep  3 02:39:21 2007
--- pgsql_sugar/src/include/catalog/pg_class.h    Tue Nov  6 12:47:46 2007
***************
*** 19,30 ****
  #ifndef PG_CLASS_H
  #define PG_CLASS_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_class definition.  cpp turns this into
--- 19,25 ----
  #ifndef PG_CLASS_H
  #define PG_CLASS_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_class definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_constraint.h pgsql_sugar/src/include/catalog/pg_constraint.h
*** pgsql_sugar.orig/src/include/catalog/pg_constraint.h    Wed Feb 14 02:58:58 2007
--- pgsql_sugar/src/include/catalog/pg_constraint.h    Tue Nov  6 12:47:46 2007
***************
*** 19,34 ****
  #ifndef PG_CONSTRAINT_H
  #define PG_CONSTRAINT_H

  #include "nodes/pg_list.h"

  /* ----------------
-  *        postgres.h contains the system type definitions and the
-  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
-  *        can be read by both genbki.sh and the C compiler.
-  * ----------------
-  */
-
- /* ----------------
   *        pg_constraint definition.  cpp turns this into
   *        typedef struct FormData_pg_constraint
   * ----------------
--- 19,28 ----
  #ifndef PG_CONSTRAINT_H
  #define PG_CONSTRAINT_H

+ #include "catalog/genbki.h"
  #include "nodes/pg_list.h"

  /* ----------------
   *        pg_constraint definition.  cpp turns this into
   *        typedef struct FormData_pg_constraint
   * ----------------
diff -rc pgsql_sugar.orig/src/include/catalog/pg_conversion.h pgsql_sugar/src/include/catalog/pg_conversion.h
*** pgsql_sugar.orig/src/include/catalog/pg_conversion.h    Fri Jan  5 23:19:52 2007
--- pgsql_sugar/src/include/catalog/pg_conversion.h    Tue Nov  6 12:47:46 2007
***************
*** 19,30 ****
  #ifndef PG_CONVERSION_H
  #define PG_CONVERSION_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------------------------------------------------------
   *        pg_conversion definition.
--- 19,25 ----
  #ifndef PG_CONVERSION_H
  #define PG_CONVERSION_H

! #include "catalog/genbki.h"

  /* ----------------------------------------------------------------
   *        pg_conversion definition.
diff -rc pgsql_sugar.orig/src/include/catalog/pg_database.h pgsql_sugar/src/include/catalog/pg_database.h
*** pgsql_sugar.orig/src/include/catalog/pg_database.h    Mon Sep  3 04:30:43 2007
--- pgsql_sugar/src/include/catalog/pg_database.h    Tue Nov  6 12:47:46 2007
***************
*** 19,30 ****
  #ifndef PG_DATABASE_H
  #define PG_DATABASE_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_database definition.  cpp turns this into
--- 19,25 ----
  #ifndef PG_DATABASE_H
  #define PG_DATABASE_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_database definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_depend.h pgsql_sugar/src/include/catalog/pg_depend.h
*** pgsql_sugar.orig/src/include/catalog/pg_depend.h    Fri Jan  5 23:19:52 2007
--- pgsql_sugar/src/include/catalog/pg_depend.h    Tue Nov  6 12:47:46 2007
***************
*** 19,30 ****
  #ifndef PG_DEPEND_H
  #define PG_DEPEND_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_depend definition.  cpp turns this into
--- 19,25 ----
  #ifndef PG_DEPEND_H
  #define PG_DEPEND_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_depend definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_description.h pgsql_sugar/src/include/catalog/pg_description.h
*** pgsql_sugar.orig/src/include/catalog/pg_description.h    Fri Jan  5 23:19:52 2007
--- pgsql_sugar/src/include/catalog/pg_description.h    Tue Nov  6 12:47:46 2007
***************
*** 36,47 ****
  #ifndef PG_DESCRIPTION_H
  #define PG_DESCRIPTION_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_description definition.    cpp turns this into
--- 36,42 ----
  #ifndef PG_DESCRIPTION_H
  #define PG_DESCRIPTION_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_description definition.    cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_enum.h pgsql_sugar/src/include/catalog/pg_enum.h
*** pgsql_sugar.orig/src/include/catalog/pg_enum.h    Mon Apr  2 05:49:40 2007
--- pgsql_sugar/src/include/catalog/pg_enum.h    Tue Nov  6 12:47:46 2007
***************
*** 21,36 ****
  #ifndef PG_ENUM_H
  #define PG_ENUM_H

  #include "nodes/pg_list.h"

  /* ----------------
-  *        postgres.h contains the system type definitions and the
-  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
-  *        can be read by both genbki.sh and the C compiler.
-  * ----------------
-  */
-
- /* ----------------
   *        pg_enum definition.  cpp turns this into
   *        typedef struct FormData_pg_enum
   * ----------------
--- 21,30 ----
  #ifndef PG_ENUM_H
  #define PG_ENUM_H

+ #include "catalog/genbki.h"
  #include "nodes/pg_list.h"

  /* ----------------
   *        pg_enum definition.  cpp turns this into
   *        typedef struct FormData_pg_enum
   * ----------------
diff -rc pgsql_sugar.orig/src/include/catalog/pg_index.h pgsql_sugar/src/include/catalog/pg_index.h
*** pgsql_sugar.orig/src/include/catalog/pg_index.h    Thu Sep 20 19:56:32 2007
--- pgsql_sugar/src/include/catalog/pg_index.h    Tue Nov  6 12:47:46 2007
***************
*** 19,30 ****
  #ifndef PG_INDEX_H
  #define PG_INDEX_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_index definition.  cpp turns this into
--- 19,25 ----
  #ifndef PG_INDEX_H
  #define PG_INDEX_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_index definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_inherits.h pgsql_sugar/src/include/catalog/pg_inherits.h
*** pgsql_sugar.orig/src/include/catalog/pg_inherits.h    Fri Jan  5 23:19:52 2007
--- pgsql_sugar/src/include/catalog/pg_inherits.h    Tue Nov  6 12:47:46 2007
***************
*** 19,30 ****
  #ifndef PG_INHERITS_H
  #define PG_INHERITS_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_inherits definition.  cpp turns this into
--- 19,25 ----
  #ifndef PG_INHERITS_H
  #define PG_INHERITS_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_inherits definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_language.h pgsql_sugar/src/include/catalog/pg_language.h
*** pgsql_sugar.orig/src/include/catalog/pg_language.h    Mon Sep  3 04:30:43 2007
--- pgsql_sugar/src/include/catalog/pg_language.h    Tue Nov  6 12:47:46 2007
***************
*** 19,30 ****
  #ifndef PG_LANGUAGE_H
  #define PG_LANGUAGE_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_language definition.  cpp turns this into
--- 19,25 ----
  #ifndef PG_LANGUAGE_H
  #define PG_LANGUAGE_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_language definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_largeobject.h pgsql_sugar/src/include/catalog/pg_largeobject.h
*** pgsql_sugar.orig/src/include/catalog/pg_largeobject.h    Fri Jan  5 23:19:52 2007
--- pgsql_sugar/src/include/catalog/pg_largeobject.h    Tue Nov  6 12:47:46 2007
***************
*** 19,30 ****
  #ifndef PG_LARGEOBJECT_H
  #define PG_LARGEOBJECT_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_largeobject definition.    cpp turns this into
--- 19,25 ----
  #ifndef PG_LARGEOBJECT_H
  #define PG_LARGEOBJECT_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_largeobject definition.    cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_listener.h pgsql_sugar/src/include/catalog/pg_listener.h
*** pgsql_sugar.orig/src/include/catalog/pg_listener.h    Fri Jan  5 23:19:52 2007
--- pgsql_sugar/src/include/catalog/pg_listener.h    Tue Nov  6 12:47:46 2007
***************
*** 18,29 ****
  #ifndef PG_LISTENER_H
  #define PG_LISTENER_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------------------------------------------------------
   *        pg_listener definition.
--- 18,24 ----
  #ifndef PG_LISTENER_H
  #define PG_LISTENER_H

! #include "catalog/genbki.h"

  /* ----------------------------------------------------------------
   *        pg_listener definition.
diff -rc pgsql_sugar.orig/src/include/catalog/pg_namespace.h pgsql_sugar/src/include/catalog/pg_namespace.h
*** pgsql_sugar.orig/src/include/catalog/pg_namespace.h    Mon Sep  3 04:30:43 2007
--- pgsql_sugar/src/include/catalog/pg_namespace.h    Tue Nov  6 12:47:46 2007
***************
*** 19,30 ****
  #ifndef PG_NAMESPACE_H
  #define PG_NAMESPACE_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------------------------------------------------------
   *        pg_namespace definition.
--- 19,25 ----
  #ifndef PG_NAMESPACE_H
  #define PG_NAMESPACE_H

! #include "catalog/genbki.h"

  /* ----------------------------------------------------------------
   *        pg_namespace definition.
diff -rc pgsql_sugar.orig/src/include/catalog/pg_opclass.h pgsql_sugar/src/include/catalog/pg_opclass.h
*** pgsql_sugar.orig/src/include/catalog/pg_opclass.h    Tue Aug 21 03:11:25 2007
--- pgsql_sugar/src/include/catalog/pg_opclass.h    Tue Nov  6 12:47:46 2007
***************
*** 39,50 ****
  #ifndef PG_OPCLASS_H
  #define PG_OPCLASS_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_opclass definition.    cpp turns this into
--- 39,45 ----
  #ifndef PG_OPCLASS_H
  #define PG_OPCLASS_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_opclass definition.    cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_operator.h pgsql_sugar/src/include/catalog/pg_operator.h
*** pgsql_sugar.orig/src/include/catalog/pg_operator.h    Mon Aug 27 03:39:24 2007
--- pgsql_sugar/src/include/catalog/pg_operator.h    Tue Nov  6 12:47:47 2007
***************
*** 22,37 ****
  #ifndef PG_OPERATOR_H
  #define PG_OPERATOR_H

  #include "nodes/pg_list.h"

  /* ----------------
-  *        postgres.h contains the system type definitions and the
-  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
-  *        can be read by both genbki.sh and the C compiler.
-  * ----------------
-  */
-
- /* ----------------
   *        pg_operator definition.  cpp turns this into
   *        typedef struct FormData_pg_operator
   * ----------------
--- 22,31 ----
  #ifndef PG_OPERATOR_H
  #define PG_OPERATOR_H

+ #include "catalog/genbki.h"
  #include "nodes/pg_list.h"

  /* ----------------
   *        pg_operator definition.  cpp turns this into
   *        typedef struct FormData_pg_operator
   * ----------------
diff -rc pgsql_sugar.orig/src/include/catalog/pg_opfamily.h pgsql_sugar/src/include/catalog/pg_opfamily.h
*** pgsql_sugar.orig/src/include/catalog/pg_opfamily.h    Tue Aug 21 03:11:25 2007
--- pgsql_sugar/src/include/catalog/pg_opfamily.h    Tue Nov  6 12:47:47 2007
***************
*** 19,32 ****
  #ifndef PG_OPFAMILY_H
  #define PG_OPFAMILY_H

  /* ----------------
-  *        postgres.h contains the system type definitions and the
-  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
-  *        can be read by both genbki.sh and the C compiler.
-  * ----------------
-  */
-
- /* ----------------
   *        pg_opfamily definition. cpp turns this into
   *        typedef struct FormData_pg_opfamily
   * ----------------
--- 19,26 ----
  #ifndef PG_OPFAMILY_H
  #define PG_OPFAMILY_H

+ #include "catalog/genbki.h"
  /* ----------------
   *        pg_opfamily definition. cpp turns this into
   *        typedef struct FormData_pg_opfamily
   * ----------------
diff -rc pgsql_sugar.orig/src/include/catalog/pg_pltemplate.h pgsql_sugar/src/include/catalog/pg_pltemplate.h
*** pgsql_sugar.orig/src/include/catalog/pg_pltemplate.h    Mon Mar 26 18:58:41 2007
--- pgsql_sugar/src/include/catalog/pg_pltemplate.h    Tue Nov  6 12:47:47 2007
***************
*** 19,30 ****
  #ifndef PG_PLTEMPLATE_H
  #define PG_PLTEMPLATE_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_pltemplate definition.  cpp turns this into
--- 19,25 ----
  #ifndef PG_PLTEMPLATE_H
  #define PG_PLTEMPLATE_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_pltemplate definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_proc.h pgsql_sugar/src/include/catalog/pg_proc.h
*** pgsql_sugar.orig/src/include/catalog/pg_proc.h    Wed Oct 24 04:24:47 2007
--- pgsql_sugar/src/include/catalog/pg_proc.h    Tue Nov  6 12:47:47 2007
***************
*** 23,36 ****
  #ifndef PG_PROC_H
  #define PG_PROC_H

  /* ----------------
-  *        postgres.h contains the system type definitions and the
-  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
-  *        can be read by both genbki.sh and the C compiler.
-  * ----------------
-  */
-
- /* ----------------
   *        pg_proc definition.  cpp turns this into
   *        typedef struct FormData_pg_proc
   * ----------------
--- 23,30 ----
  #ifndef PG_PROC_H
  #define PG_PROC_H

+ #include "catalog/genbki.h"
  /* ----------------
   *        pg_proc definition.  cpp turns this into
   *        typedef struct FormData_pg_proc
   * ----------------
***************
*** 4436,4465 ****
  #define PROARGMODE_INOUT    'b'


- /*
-  * prototypes for functions in pg_proc.c
-  */
- extern Oid ProcedureCreate(const char *procedureName,
-                 Oid procNamespace,
-                 bool replace,
-                 bool returnsSet,
-                 Oid returnType,
-                 Oid languageObjectId,
-                 Oid languageValidator,
-                 const char *prosrc,
-                 const char *probin,
-                 bool isAgg,
-                 bool security_definer,
-                 bool isStrict,
-                 char volatility,
-                 oidvector *parameterTypes,
-                 Datum allParameterTypes,
-                 Datum parameterModes,
-                 Datum parameterNames,
-                 Datum proconfig,
-                 float4 procost,
-                 float4 prorows);
-
- extern bool function_parse_error_transpose(const char *prosrc);
-
  #endif   /* PG_PROC_H */
--- 4430,4433 ----
diff -rc pgsql_sugar.orig/src/include/catalog/pg_proc_fn.h pgsql_sugar/src/include/catalog/pg_proc_fn.h
*** pgsql_sugar.orig/src/include/catalog/pg_proc_fn.h    Tue Nov  6 12:50:37 2007
--- pgsql_sugar/src/include/catalog/pg_proc_fn.h    Tue Nov  6 13:29:18 2007
***************
*** 0 ****
--- 1,40 ----
+ /*-------------------------------------------------------------------------
+  *
+  * pg_proc_fn.h
+  *      prototypes for functions in pg_proc.c
+  *
+  * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
+  * Portions Copyright (c) 1994, Regents of the University of California
+  *
+  * $PostgreSQL:  $
+  *
+  *
+  *-------------------------------------------------------------------------
+  */
+ #ifndef PG_PROC_FN_H
+ #define PG_PROC_FN_H
+
+ extern Oid ProcedureCreate(const char *procedureName,
+                 Oid procNamespace,
+                 bool replace,
+                 bool returnsSet,
+                 Oid returnType,
+                 Oid languageObjectId,
+                 Oid languageValidator,
+                 const char *prosrc,
+                 const char *probin,
+                 bool isAgg,
+                 bool security_definer,
+                 bool isStrict,
+                 char volatility,
+                 oidvector *parameterTypes,
+                 Datum allParameterTypes,
+                 Datum parameterModes,
+                 Datum parameterNames,
+                 Datum proconfig,
+                 float4 procost,
+                 float4 prorows);
+
+ extern bool function_parse_error_transpose(const char *prosrc);
+
+ #endif   /* PG_PROC_FN_H */
diff -rc pgsql_sugar.orig/src/include/catalog/pg_rewrite.h pgsql_sugar/src/include/catalog/pg_rewrite.h
*** pgsql_sugar.orig/src/include/catalog/pg_rewrite.h    Tue Mar 20 00:38:31 2007
--- pgsql_sugar/src/include/catalog/pg_rewrite.h    Tue Nov  6 12:47:47 2007
***************
*** 22,33 ****
  #ifndef PG_REWRITE_H
  #define PG_REWRITE_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_rewrite definition.    cpp turns this into
--- 22,28 ----
  #ifndef PG_REWRITE_H
  #define PG_REWRITE_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_rewrite definition.    cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_shdepend.h pgsql_sugar/src/include/catalog/pg_shdepend.h
*** pgsql_sugar.orig/src/include/catalog/pg_shdepend.h    Fri Jan  5 23:19:53 2007
--- pgsql_sugar/src/include/catalog/pg_shdepend.h    Tue Nov  6 12:47:47 2007
***************
*** 19,30 ****
  #ifndef PG_SHDEPEND_H
  #define PG_SHDEPEND_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_shdepend definition.  cpp turns this into
--- 19,25 ----
  #ifndef PG_SHDEPEND_H
  #define PG_SHDEPEND_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_shdepend definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_shdescription.h pgsql_sugar/src/include/catalog/pg_shdescription.h
*** pgsql_sugar.orig/src/include/catalog/pg_shdescription.h    Fri Jan  5 23:19:53 2007
--- pgsql_sugar/src/include/catalog/pg_shdescription.h    Tue Nov  6 12:47:47 2007
***************
*** 29,40 ****
  #ifndef PG_SHDESCRIPTION_H
  #define PG_SHDESCRIPTION_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_shdescription definition.    cpp turns this into
--- 29,35 ----
  #ifndef PG_SHDESCRIPTION_H
  #define PG_SHDESCRIPTION_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_shdescription definition.    cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_statistic.h pgsql_sugar/src/include/catalog/pg_statistic.h
*** pgsql_sugar.orig/src/include/catalog/pg_statistic.h    Tue May  8 21:13:52 2007
--- pgsql_sugar/src/include/catalog/pg_statistic.h    Tue Nov  6 12:47:47 2007
***************
*** 19,30 ****
  #ifndef PG_STATISTIC_H
  #define PG_STATISTIC_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /*
   * Keep C compiler happy with anyarray, below.    This will need to go elsewhere
--- 19,25 ----
  #ifndef PG_STATISTIC_H
  #define PG_STATISTIC_H

! #include "catalog/genbki.h"

  /*
   * Keep C compiler happy with anyarray, below.    This will need to go elsewhere
diff -rc pgsql_sugar.orig/src/include/catalog/pg_tablespace.h pgsql_sugar/src/include/catalog/pg_tablespace.h
*** pgsql_sugar.orig/src/include/catalog/pg_tablespace.h    Fri Jan  5 23:19:53 2007
--- pgsql_sugar/src/include/catalog/pg_tablespace.h    Tue Nov  6 12:47:47 2007
***************
*** 19,30 ****
  #ifndef PG_TABLESPACE_H
  #define PG_TABLESPACE_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_tablespace definition.  cpp turns this into
--- 19,25 ----
  #ifndef PG_TABLESPACE_H
  #define PG_TABLESPACE_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_tablespace definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_trigger.h pgsql_sugar/src/include/catalog/pg_trigger.h
*** pgsql_sugar.orig/src/include/catalog/pg_trigger.h    Tue Mar 20 00:38:31 2007
--- pgsql_sugar/src/include/catalog/pg_trigger.h    Tue Nov  6 12:47:47 2007
***************
*** 19,30 ****
  #ifndef PG_TRIGGER_H
  #define PG_TRIGGER_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_trigger definition.    cpp turns this into
--- 19,25 ----
  #ifndef PG_TRIGGER_H
  #define PG_TRIGGER_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_trigger definition.    cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_ts_config.h pgsql_sugar/src/include/catalog/pg_ts_config.h
*** pgsql_sugar.orig/src/include/catalog/pg_ts_config.h    Tue Aug 21 03:11:27 2007
--- pgsql_sugar/src/include/catalog/pg_ts_config.h    Tue Nov  6 12:47:47 2007
***************
*** 21,32 ****
  #ifndef PG_TS_CONFIG_H
  #define PG_TS_CONFIG_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_ts_config definition.  cpp turns this into
--- 21,27 ----
  #ifndef PG_TS_CONFIG_H
  #define PG_TS_CONFIG_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_ts_config definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_ts_config_map.h pgsql_sugar/src/include/catalog/pg_ts_config_map.h
*** pgsql_sugar.orig/src/include/catalog/pg_ts_config_map.h    Tue Aug 21 03:11:27 2007
--- pgsql_sugar/src/include/catalog/pg_ts_config_map.h    Tue Nov  6 12:47:47 2007
***************
*** 21,32 ****
  #ifndef PG_TS_CONFIG_MAP_H
  #define PG_TS_CONFIG_MAP_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_ts_config_map definition.  cpp turns this into
--- 21,27 ----
  #ifndef PG_TS_CONFIG_MAP_H
  #define PG_TS_CONFIG_MAP_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_ts_config_map definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_ts_dict.h pgsql_sugar/src/include/catalog/pg_ts_dict.h
*** pgsql_sugar.orig/src/include/catalog/pg_ts_dict.h    Tue Aug 21 03:11:27 2007
--- pgsql_sugar/src/include/catalog/pg_ts_dict.h    Tue Nov  6 12:47:47 2007
***************
*** 21,32 ****
  #ifndef PG_TS_DICT_H
  #define PG_TS_DICT_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_ts_dict definition.  cpp turns this into
--- 21,27 ----
  #ifndef PG_TS_DICT_H
  #define PG_TS_DICT_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_ts_dict definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_ts_parser.h pgsql_sugar/src/include/catalog/pg_ts_parser.h
*** pgsql_sugar.orig/src/include/catalog/pg_ts_parser.h    Tue Aug 21 03:11:27 2007
--- pgsql_sugar/src/include/catalog/pg_ts_parser.h    Tue Nov  6 12:47:47 2007
***************
*** 21,32 ****
  #ifndef PG_TS_PARSER_H
  #define PG_TS_PARSER_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_ts_parser definition.  cpp turns this into
--- 21,27 ----
  #ifndef PG_TS_PARSER_H
  #define PG_TS_PARSER_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_ts_parser definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_ts_template.h pgsql_sugar/src/include/catalog/pg_ts_template.h
*** pgsql_sugar.orig/src/include/catalog/pg_ts_template.h    Mon Sep  3 04:30:45 2007
--- pgsql_sugar/src/include/catalog/pg_ts_template.h    Tue Nov  6 12:47:47 2007
***************
*** 21,32 ****
  #ifndef PG_TS_TEMPLATE_H
  #define PG_TS_TEMPLATE_H

! /* ----------------
!  *        postgres.h contains the system type definitions and the
!  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
!  *        can be read by both genbki.sh and the C compiler.
!  * ----------------
!  */

  /* ----------------
   *        pg_ts_template definition.  cpp turns this into
--- 21,27 ----
  #ifndef PG_TS_TEMPLATE_H
  #define PG_TS_TEMPLATE_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_ts_template definition.  cpp turns this into
diff -rc pgsql_sugar.orig/src/include/catalog/pg_type.h pgsql_sugar/src/include/catalog/pg_type.h
*** pgsql_sugar.orig/src/include/catalog/pg_type.h    Sun Oct 14 01:06:27 2007
--- pgsql_sugar/src/include/catalog/pg_type.h    Tue Nov  6 12:47:47 2007
***************
*** 19,34 ****
  #ifndef PG_TYPE_H
  #define PG_TYPE_H

! #include "nodes/nodes.h"

  /* ----------------
-  *        postgres.h contains the system type definitions and the
-  *        CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
-  *        can be read by both genbki.sh and the C compiler.
-  * ----------------
-  */
-
- /* ----------------
   *        pg_type definition.  cpp turns this into
   *        typedef struct FormData_pg_type
   *
--- 19,27 ----
  #ifndef PG_TYPE_H
  #define PG_TYPE_H

! #include "catalog/genbki.h"

  /* ----------------
   *        pg_type definition.  cpp turns this into
   *        typedef struct FormData_pg_type
   *
***************
*** 631,693 ****
       (typid) == ANYNONARRAYOID || \
       (typid) == ANYENUMOID)

- /*
-  * prototypes for functions in pg_type.c
-  */
- extern Oid    TypeShellMake(const char *typeName, Oid typeNamespace);

- extern Oid TypeCreate(Oid newTypeOid,
-            const char *typeName,
-            Oid typeNamespace,
-            Oid relationOid,
-            char relationKind,
-            int16 internalSize,
-            char typeType,
-            char typDelim,
-            Oid inputProcedure,
-            Oid outputProcedure,
-            Oid receiveProcedure,
-            Oid sendProcedure,
-            Oid typmodinProcedure,
-            Oid typmodoutProcedure,
-            Oid analyzeProcedure,
-            Oid elementType,
-            bool isImplicitArray,
-            Oid arrayType,
-            Oid baseType,
-            const char *defaultTypeValue,
-            char *defaultTypeBin,
-            bool passedByValue,
-            char alignment,
-            char storage,
-            int32 typeMod,
-            int32 typNDims,
-            bool typeNotNull);
-
- extern void GenerateTypeDependencies(Oid typeNamespace,
-                          Oid typeObjectId,
-                          Oid relationOid,
-                          char relationKind,
-                          Oid owner,
-                          Oid inputProcedure,
-                          Oid outputProcedure,
-                          Oid receiveProcedure,
-                          Oid sendProcedure,
-                             Oid typmodinProcedure,
-                             Oid typmodoutProcedure,
-                          Oid analyzeProcedure,
-                          Oid elementType,
-                          bool isImplicitArray,
-                          Oid baseType,
-                          Node *defaultExpr,
-                          bool rebuild);
-
- extern void TypeRename(Oid typeOid, const char *newTypeName,
-                        Oid typeNamespace);
-
- extern char *makeArrayTypeName(const char *typeName, Oid typeNamespace);
-
- extern bool moveArrayTypeName(Oid typeOid, const char *typeName,
-                               Oid typeNamespace);
-
  #endif   /* PG_TYPE_H */
--- 624,628 ----
diff -rc pgsql_sugar.orig/src/include/catalog/pg_type_fn.h pgsql_sugar/src/include/catalog/pg_type_fn.h
*** pgsql_sugar.orig/src/include/catalog/pg_type_fn.h    Tue Nov  6 12:50:50 2007
--- pgsql_sugar/src/include/catalog/pg_type_fn.h    Tue Nov  6 13:23:16 2007
***************
*** 0 ****
--- 1,77 ----
+ /*-------------------------------------------------------------------------
+  *
+  * pg_type_fn.h
+  *      prototypes for functions in pg_type.c
+  *
+  *
+  * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
+  * Portions Copyright (c) 1994, Regents of the University of California
+  *
+  * $PostgreSQL: $
+  *
+  *
+  *-------------------------------------------------------------------------
+  */
+ #ifndef PG_TYPE_FN_H
+ #define PG_TYPE_FN_H
+
+ #include "nodes/nodes.h"
+
+ extern Oid    TypeShellMake(const char *typeName, Oid typeNamespace);
+
+ extern Oid TypeCreate(Oid newTypeOid,
+                  const char *typeName,
+                  Oid typeNamespace,
+                  Oid relationOid,
+                  char relationKind,
+                  int16 internalSize,
+                  char typeType,
+                  char typDelim,
+                  Oid inputProcedure,
+                  Oid outputProcedure,
+                  Oid receiveProcedure,
+                  Oid sendProcedure,
+                  Oid typmodinProcedure,
+                  Oid typmodoutProcedure,
+                  Oid analyzeProcedure,
+                  Oid elementType,
+                  bool isImplicitArray,
+                  Oid arrayType,
+                  Oid baseType,
+                  const char *defaultTypeValue,
+                  char *defaultTypeBin,
+                  bool passedByValue,
+                  char alignment,
+                  char storage,
+                  int32 typeMod,
+                  int32 typNDims,
+                  bool typeNotNull);
+
+ extern void GenerateTypeDependencies(Oid typeNamespace,
+                                                Oid typeObjectId,
+                                                Oid relationOid,
+                                                char relationKind,
+                                                Oid owner,
+                                                Oid inputProcedure,
+                                                Oid outputProcedure,
+                                                Oid receiveProcedure,
+                                                Oid sendProcedure,
+                                                Oid typmodinProcedure,
+                                                Oid typmodoutProcedure,
+                                                Oid analyzeProcedure,
+                                                Oid elementType,
+                                                bool isImplicitArray,
+                                                Oid baseType,
+                                                Node *defaultExpr,
+                                                bool rebuild);
+
+ extern void TypeRename(Oid typeOid, const char *newTypeName,
+                                          Oid typeNamespace);
+
+ extern char *makeArrayTypeName(const char *typeName, Oid typeNamespace);
+
+ extern bool moveArrayTypeName(Oid typeOid, const char *typeName,
+                                                         Oid typeNamespace);
+
+
+ #endif   /* PG_TYPE_FN_H */
diff -rc pgsql_sugar.orig/src/include/commands/sequence.h pgsql_sugar/src/include/commands/sequence.h
*** pgsql_sugar.orig/src/include/commands/sequence.h    Fri Jan  5 23:19:54 2007
--- pgsql_sugar/src/include/commands/sequence.h    Tue Nov  6 12:47:47 2007
***************
*** 94,106 ****
  extern void seq_redo(XLogRecPtr lsn, XLogRecord *rptr);
  extern void seq_desc(StringInfo buf, uint8 xl_info, char *rec);

- /* Set the upper and lower bounds of a sequence */
- #ifndef INT64_IS_BUSTED
- #define SEQ_MAXVALUE    INT64CONST(0x7FFFFFFFFFFFFFFF)
- #else                            /* INT64_IS_BUSTED */
- #define SEQ_MAXVALUE    ((int64) 0x7FFFFFFF)
- #endif   /* INT64_IS_BUSTED */
-
- #define SEQ_MINVALUE    (-SEQ_MAXVALUE)
-
  #endif   /* SEQUENCE_H */
--- 94,97 ----
diff -rc pgsql_sugar.orig/src/pl/plpgsql/src/pl_comp.c pgsql_sugar/src/pl/plpgsql/src/pl_comp.c
*** pgsql_sugar.orig/src/pl/plpgsql/src/pl_comp.c    Mon Jul 16 19:01:10 2007
--- pgsql_sugar/src/pl/plpgsql/src/pl_comp.c    Tue Nov  6 12:47:47 2007
***************
*** 25,30 ****
--- 25,31 ----
  #include "catalog/pg_attribute.h"
  #include "catalog/pg_class.h"
  #include "catalog/pg_proc.h"
+ #include "catalog/pg_proc_fn.h"
  #include "catalog/pg_type.h"
  #include "funcapi.h"
  #include "nodes/makefuncs.h"

Re: Fix pg_dump dependency on postgres.h

From
Bruce Momjian
Date:
This has been saved for the 8.4 release:

    http://momjian.postgresql.org/cgi-bin/pgpatches_hold

---------------------------------------------------------------------------

Zdenek Kotala wrote:
> Tom Lane wrote:
>
> <snip>
> >
> > AFAICT, therefore, the proposed patch should only define YYSTYPE and
> > not anything else (there's no need to be afraid of YYLTYPE at present).
>
> Thank your for Your and Alvaro's comments. I attached updated patch
> version only with YYSTYPE definition.
>
>         Thanks Zdenek


>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://postgres.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

Re: Fix pg_dump dependency on postgres.h

From
Alvaro Herrera
Date:
Bruce Momjian wrote:
>
> This has been saved for the 8.4 release:
>
>     http://momjian.postgresql.org/cgi-bin/pgpatches_hold

Huh, I think the point is to be able to build 8.3 at all on certain
Solaris releases.  I think it qualifies as a portability fix.


> ---------------------------------------------------------------------------
>
> Zdenek Kotala wrote:
> > Tom Lane wrote:
> >
> > <snip>
> > >
> > > AFAICT, therefore, the proposed patch should only define YYSTYPE and
> > > not anything else (there's no need to be afraid of YYLTYPE at present).
> >
> > Thank your for Your and Alvaro's comments. I attached updated patch
> > version only with YYSTYPE definition.


--
Alvaro Herrera       Valdivia, Chile   ICBM: S 39º 49' 18.1", W 73º 13' 56.4"
"No es bueno caminar con un hombre muerto"

Re: Fix pg_dump dependency on postgres.h

From
Bruce Momjian
Date:
Alvaro Herrera wrote:
> Bruce Momjian wrote:
> >
> > This has been saved for the 8.4 release:
> >
> >     http://momjian.postgresql.org/cgi-bin/pgpatches_hold
>
> Huh, I think the point is to be able to build 8.3 at all on certain
> Solaris releases.  I think it qualifies as a portability fix.

I thought this was just cleanup.  Why does Solaris need it?  I don't
remember it has been so long.  I see it referenced here:

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

Is this some Sun bug or an optimization that is causing the problem.

The fact that this patch is not in beta3 has me worried about putting it
in with no beta before RC1.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://postgres.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

Re: Fix pg_dump dependency on postgres.h

From
Tom Lane
Date:
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> Huh, I think the point is to be able to build 8.3 at all on certain
> Solaris releases.  I think it qualifies as a portability fix.

(a) it wasn't "to build at all", it was to allow "inline" to be enabled
on Sun Studio's compiler, which apparently is too dumb to not generate
copies of an unreferenced inline function.

(b) portability fix or not, this ain't going into 8.3.  It's *far* too
invasive for this late stage of the cycle.

            regards, tom lane

Re: Fix pg_dump dependency on postgres.h

From
Bruce Momjian
Date:
Tom Lane wrote:
> Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> > Huh, I think the point is to be able to build 8.3 at all on certain
> > Solaris releases.  I think it qualifies as a portability fix.
>
> (a) it wasn't "to build at all", it was to allow "inline" to be enabled
> on Sun Studio's compiler, which apparently is too dumb to not generate
> copies of an unreferenced inline function.
>
> (b) portability fix or not, this ain't going into 8.3.  It's *far* too
> invasive for this late stage of the cycle.

Yea, that was my analysis too.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://postgres.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

Re: Fix pg_dump dependency on postgres.h

From
Alvaro Herrera
Date:
Bruce Momjian wrote:
> Tom Lane wrote:
> > Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> > > Huh, I think the point is to be able to build 8.3 at all on certain
> > > Solaris releases.  I think it qualifies as a portability fix.
> >
> > (a) it wasn't "to build at all", it was to allow "inline" to be enabled
> > on Sun Studio's compiler, which apparently is too dumb to not generate
> > copies of an unreferenced inline function.
> >
> > (b) portability fix or not, this ain't going into 8.3.  It's *far* too
> > invasive for this late stage of the cycle.
>
> Yea, that was my analysis too.

Oh, right, I misremembered that it was only to allow inline.

--
Alvaro Herrera                 http://www.amazon.com/gp/registry/DXLWNGRJD34J
"En las profundidades de nuestro inconsciente hay una obsesiva necesidad
de un universo lógico y coherente. Pero el universo real se halla siempre
un paso más allá de la lógica" (Irulan)

Re: Fix pg_dump dependency on postgres.h

From
Zdenek Kotala
Date:
Bruce Momjian wrote:
> Tom Lane wrote:
>> Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
>>> Huh, I think the point is to be able to build 8.3 at all on certain
>>> Solaris releases.  I think it qualifies as a portability fix.
>> (a) it wasn't "to build at all", it was to allow "inline" to be enabled
>> on Sun Studio's compiler, which apparently is too dumb to not generate
>> copies of an unreferenced inline function.
>>
>> (b) portability fix or not, this ain't going into 8.3.  It's *far* too
>> invasive for this late stage of the cycle.
>
> Yea, that was my analysis too.
>

Yes, I agree with Bruce and Tom. It is more invasive then I expected.
And specially in context when pg_resetxlog needs to be also fixed and
this fix seems more complicated then pg_dump fix :(.

        Zdenek

Re: Fix pg_dump dependency on postgres.h

From
Bruce Momjian
Date:
Zdenek Kotala wrote:
> Bruce Momjian wrote:
> > Tom Lane wrote:
> >> Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> >>> Huh, I think the point is to be able to build 8.3 at all on certain
> >>> Solaris releases.  I think it qualifies as a portability fix.
> >> (a) it wasn't "to build at all", it was to allow "inline" to be enabled
> >> on Sun Studio's compiler, which apparently is too dumb to not generate
> >> copies of an unreferenced inline function.
> >>
> >> (b) portability fix or not, this ain't going into 8.3.  It's *far* too
> >> invasive for this late stage of the cycle.
> >
> > Yea, that was my analysis too.
> >
>
> Yes, I agree with Bruce and Tom. It is more invasive then I expected.
> And specially in context when pg_resetxlog needs to be also fixed and
> this fix seems more complicated then pg_dump fix :(.

The good news is that we will have it ready for 8.4.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://postgres.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

Re: Fix pg_dump dependency on postgres.h

From
Zdenek Kotala
Date:
Tom Lane napsal(a):

> (a) it wasn't "to build at all", it was to allow "inline" to be enabled
> on Sun Studio's compiler, which apparently is too dumb to not generate
> copies of an unreferenced inline function.

I don't think that you have right. inline is just optimizer hint and Sun Studio
  performs inline optimization from level 3 (-xO3). In lower level it generates
it as local function. And on other side GCC (3.4.3) performs inconsistent
optimization on -O0 level which is by my opinion also for discussion see
following case:

---------------------------------
#include <stdio.h>

static inline int test_1(int a)
{
         return a*a;
}

static inline int test_2(int p)
{
         return p*p;
}


static int test_3(int p)
{
         return p*p;
}

int main()
{

         int a = 3;
         printf("%i\n", test_1(a));
         return 0;
}


bash-3.2$ nm ./a.out | grep test
[58]    | 134548680|        15|FUNC |LOCL |0    |13     |test_1
[57]    | 134548592|        15|FUNC |LOCL |0    |13     |test_3


---------------------------------

Why test_3 is not removed as unused function, but test_2 is? By my opinion it is
inconsistent. GCC removes test_3 on -O2 level. And why  -fkeep-inline-functions
does not work? It seems to me that somebody modify gcc to fix similar problems
as postgreSQL has in the source code.

        Zdenek

Re: Fix pg_dump dependency on postgres.h

From
Tom Lane
Date:
Zdenek Kotala <Zdenek.Kotala@Sun.COM> writes:
> Thank your for Your and Alvaro's comments. I attached updated patch
> version only with YYSTYPE definition.

Applied with minor revisions.  I fixed pg_conversion.h as well; the only
remaining special inclusions in the catalog header files are of
pg_list.h.  For the moment that header doesn't seem to be a problem
for client-side code to include, but someday we may want to do more
cleanup here.

The immediate remaining problem is that pg_resetxlog.c still includes
a bunch of backend-only headers, which as far as I understand still
blocks your build requirements.  I poked at this a little bit, but
didn't see any easy solution ...

            regards, tom lane

Re: Fix pg_dump dependency on postgres.h

From
Zdenek Kotala
Date:
Tom Lane napsal(a):
> Zdenek Kotala <Zdenek.Kotala@Sun.COM> writes:
>> Thank your for Your and Alvaro's comments. I attached updated patch
>> version only with YYSTYPE definition.
>
> Applied with minor revisions.  I fixed pg_conversion.h as well; the only
> remaining special inclusions in the catalog header files are of
> pg_list.h.  For the moment that header doesn't seem to be a problem
> for client-side code to include, but someday we may want to do more
> cleanup here.

Thanks.

> The immediate remaining problem is that pg_resetxlog.c still includes
> a bunch of backend-only headers, which as far as I understand still
> blocks your build requirements.  I poked at this a little bit, but
> didn't see any easy solution ...

Yes, I know about it. When I tried to solved it in November, I found some
unnecessary includes and also there are some not well placed structures and so
on. I also sent one fix which probably lost in black hole of patch queue:

See http://archives.postgresql.org/pgsql-patches/2007-10/msg00197.php

There are big work on pg_resetxlog.c and I will look on it. It probably will
require a cleanup in headers files.

        Zdenek