From ea8785f3d8739dbff04fb2da450e851425eb8ef8 Mon Sep 17 00:00:00 2001 From: John Naylor Date: Sun, 4 Mar 2018 03:09:56 +0700 Subject: [PATCH] Remove symbols from catalog headers When we removed the catalog data from the headers, the OID symbols were left behind. Since we don't want them to be separate from the data they refer to, genbki.pl now copies them from the metadata in the .dat files to new pg_*_d.h headers which are now included by the relevant header file. This required an analog of FindDefinedSymbol() that retrieves the symbol from the data. Since we had to build this mechanism anyway, take this opportunity to generate the Anum_* and Natts_* compiler constants, so we don't have to maintain those by hand. Since the new generated headers can be included separately from the static catalog header, we can now arrange to have client code include these instead. To make certain macros visible to client code, introduce the EXPOSE_TO_CLIENT_CODE symbol, which is never defined, and just prevents the compiler from seeing them where they are. Catalog.pm knows to save these lines so they can be copied to the definition headers, where both client and server code can see them. Once clients migrate to using the *_d headers, it will be possible to get rid of the pg_*_fn.h headers which only exist to quarantine code away from clients. That is left for future work, however. This patch does not change the way #define symbols for pg_proc entries are built. It's not clear that it would be worth the work to write them to pg_proc_d.h instead of utils/fmgroids.h, and would likely result in duplication of code. --- src/backend/Makefile | 21 ++-- src/backend/catalog/.gitignore | 1 + src/backend/catalog/Catalog.pm | 77 +++++++++++---- src/backend/catalog/Makefile | 49 ++++++---- src/backend/catalog/README | 8 +- src/backend/catalog/genbki.pl | 91 +++++++++++++----- src/backend/utils/Gen_fmgrtab.pl | 2 +- src/backend/utils/Makefile | 6 +- src/common/Makefile | 2 + src/include/Makefile | 2 +- src/include/catalog/.gitignore | 1 + src/include/catalog/genbki.h | 13 ++- src/include/catalog/pg_aggregate.h | 32 +------ src/include/catalog/pg_am.h | 17 +--- src/include/catalog/pg_amop.h | 25 ++--- src/include/catalog/pg_amproc.h | 12 +-- src/include/catalog/pg_attrdef.h | 11 +-- src/include/catalog/pg_attribute.h | 32 +------ src/include/catalog/pg_auth_members.h | 11 +-- src/include/catalog/pg_authid.h | 26 +---- src/include/catalog/pg_cast.h | 18 ++-- src/include/catalog/pg_class.h | 44 +-------- src/include/catalog/pg_collation.h | 21 +--- src/include/catalog/pg_constraint.h | 33 +------ src/include/catalog/pg_conversion.h | 15 +-- src/include/catalog/pg_database.h | 22 +---- src/include/catalog/pg_db_role_setting.h | 10 +- src/include/catalog/pg_default_acl.h | 14 +-- src/include/catalog/pg_depend.h | 15 +-- src/include/catalog/pg_description.h | 11 +-- src/include/catalog/pg_enum.h | 10 +- src/include/catalog/pg_event_trigger.h | 13 +-- src/include/catalog/pg_extension.h | 15 +-- src/include/catalog/pg_foreign_data_wrapper.h | 14 +-- src/include/catalog/pg_foreign_server.h | 15 +-- src/include/catalog/pg_foreign_table.h | 11 +-- src/include/catalog/pg_index.h | 26 +---- src/include/catalog/pg_inherits.h | 10 +- src/include/catalog/pg_init_privs.h | 12 +-- src/include/catalog/pg_language.h | 19 +--- src/include/catalog/pg_largeobject.h | 10 +- src/include/catalog/pg_largeobject_metadata.h | 9 +- src/include/catalog/pg_namespace.h | 15 +-- src/include/catalog/pg_opclass.h | 26 +---- src/include/catalog/pg_operator.h | 72 +------------- src/include/catalog/pg_opfamily.h | 24 +---- src/include/catalog/pg_partitioned_table.h | 15 +-- src/include/catalog/pg_pltemplate.h | 15 +-- src/include/catalog/pg_policy.h | 19 +--- src/include/catalog/pg_proc.h | 37 +------ src/include/catalog/pg_publication.h | 15 +-- src/include/catalog/pg_publication_rel.h | 11 +-- src/include/catalog/pg_range.h | 13 +-- src/include/catalog/pg_replication_origin.h | 9 +- src/include/catalog/pg_rewrite.h | 14 +-- src/include/catalog/pg_seclabel.h | 12 +-- src/include/catalog/pg_sequence.h | 16 ++-- src/include/catalog/pg_shdepend.h | 15 +-- src/include/catalog/pg_shdescription.h | 10 +- src/include/catalog/pg_shseclabel.h | 13 +-- src/include/catalog/pg_statistic.h | 33 +------ src/include/catalog/pg_statistic_ext.h | 15 +-- src/include/catalog/pg_subscription.h | 16 +--- src/include/catalog/pg_subscription_rel.h | 13 +-- src/include/catalog/pg_tablespace.h | 15 +-- src/include/catalog/pg_transform.h | 17 ++-- src/include/catalog/pg_trigger.h | 24 +---- src/include/catalog/pg_ts_config.h | 11 +-- src/include/catalog/pg_ts_config_map.h | 11 +-- src/include/catalog/pg_ts_dict.h | 12 +-- src/include/catalog/pg_ts_parser.h | 14 +-- src/include/catalog/pg_ts_template.h | 11 +-- src/include/catalog/pg_type.h | 133 +------------------------- src/include/catalog/pg_user_mapping.h | 11 +-- src/interfaces/ecpg/ecpglib/pg_type.h | 65 +------------ src/tools/msvc/Solution.pm | 24 +++-- src/tools/msvc/clean.bat | 2 + src/tools/pgindent/pgindent | 8 +- 78 files changed, 341 insertions(+), 1251 deletions(-) diff --git a/src/backend/Makefile b/src/backend/Makefile index 2fadcea..ef00b38 100644 --- a/src/backend/Makefile +++ b/src/backend/Makefile @@ -51,7 +51,7 @@ endif ########################################################################## -all: submake-libpgport submake-schemapg postgres $(POSTGRES_IMP) +all: submake-libpgport submake-catalog-headers postgres $(POSTGRES_IMP) ifneq ($(PORTNAME), cygwin) ifneq ($(PORTNAME), win32) @@ -149,12 +149,10 @@ utils/probes.h: utils/probes.d $(MAKE) -C utils probes.h # run this unconditionally to avoid needing to know its dependencies here: -catalog/schemapg.h: | submake-schemapg +submake-catalog-headers: + $(MAKE) -C catalog distprep builddir-headers -submake-schemapg: - $(MAKE) -C catalog schemapg.h - -.PHONY: submake-schemapg +.PHONY: submake-catalog-headers # Make symlinks for these headers in the include directory. That way # we can cut down on the -I options. Also, a symlink is automatically @@ -169,18 +167,13 @@ submake-schemapg: .PHONY: generated-headers -generated-headers: $(top_builddir)/src/include/parser/gram.h $(top_builddir)/src/include/catalog/schemapg.h $(top_builddir)/src/include/storage/lwlocknames.h $(top_builddir)/src/include/utils/errcodes.h $(top_builddir)/src/include/utils/fmgroids.h $(top_builddir)/src/include/utils/fmgrprotos.h $(top_builddir)/src/include/utils/probes.h +generated-headers: $(top_builddir)/src/include/parser/gram.h $(top_builddir)/src/include/storage/lwlocknames.h $(top_builddir)/src/include/utils/errcodes.h $(top_builddir)/src/include/utils/fmgroids.h $(top_builddir)/src/include/utils/fmgrprotos.h $(top_builddir)/src/include/utils/probes.h submake-catalog-headers $(top_builddir)/src/include/parser/gram.h: parser/gram.h prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \ cd '$(dir $@)' && rm -f $(notdir $@) && \ $(LN_S) "$$prereqdir/$(notdir $<)" . -$(top_builddir)/src/include/catalog/schemapg.h: catalog/schemapg.h - prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \ - cd '$(dir $@)' && rm -f $(notdir $@) && \ - $(LN_S) "$$prereqdir/$(notdir $<)" . - $(top_builddir)/src/include/storage/lwlocknames.h: storage/lmgr/lwlocknames.h prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \ cd '$(dir $@)' && rm -f $(notdir $@) && \ @@ -216,7 +209,7 @@ utils/probes.o: utils/probes.d $(SUBDIROBJS) distprep: $(MAKE) -C parser gram.c gram.h scan.c $(MAKE) -C bootstrap bootparse.c bootscanner.c - $(MAKE) -C catalog schemapg.h postgres.bki postgres.description postgres.shdescription + $(MAKE) -C catalog distprep $(MAKE) -C replication repl_gram.c repl_scanner.c syncrep_gram.c syncrep_scanner.c $(MAKE) -C storage/lmgr lwlocknames.h $(MAKE) -C utils fmgrtab.c fmgroids.h fmgrprotos.h errcodes.h @@ -308,6 +301,7 @@ endif clean: rm -f $(LOCALOBJS) postgres$(X) $(POSTGRES_IMP) \ $(top_builddir)/src/include/parser/gram.h \ + $(top_builddir)/src/include/catalog/pg_*_d.h \ $(top_builddir)/src/include/catalog/schemapg.h \ $(top_builddir)/src/include/storage/lwlocknames.h \ $(top_builddir)/src/include/utils/fmgroids.h \ @@ -329,6 +323,7 @@ maintainer-clean: distclean parser/gram.c \ parser/gram.h \ parser/scan.c \ + catalog/pg_*_d.h \ catalog/schemapg.h \ catalog/postgres.bki \ catalog/postgres.description \ diff --git a/src/backend/catalog/.gitignore b/src/backend/catalog/.gitignore index 557af3c..1044a1c 100644 --- a/src/backend/catalog/.gitignore +++ b/src/backend/catalog/.gitignore @@ -2,3 +2,4 @@ /postgres.description /postgres.shdescription /schemapg.h +/pg_*_d.h diff --git a/src/backend/catalog/Catalog.pm b/src/backend/catalog/Catalog.pm index dc6e0d3..1ec79c9 100644 --- a/src/backend/catalog/Catalog.pm +++ b/src/backend/catalog/Catalog.pm @@ -36,10 +36,12 @@ sub ParseHeader my %catalog; my $declaring_attributes = 0; my $is_varlen = 0; + my $is_client_code = 0; $catalog{columns} = []; $catalog{toasting} = []; $catalog{indexing} = []; + $catalog{client_code} = []; open(my $ifh, '<', $input_file) || die "$input_file: $!"; @@ -47,24 +49,39 @@ sub ParseHeader while (<$ifh>) { - # Strip C-style comments. - s;/\*(.|\n)*\*/;;g; - if (m;/\*;) + # Set appropriate flag when we're in certain code sections. + if (/^#/) { - - # handle multi-line comments properly. - my $next_line = <$ifh>; - die "$input_file: ends within C-style comment\n" - if !defined $next_line; - $_ .= $next_line; - redo; + $is_varlen = 1 if /^#ifdef\s+CATALOG_VARLEN/; + if (/^#ifdef\s+EXPOSE_TO_CLIENT_CODE/) + { + $is_client_code = 1; + next; + } + next if !$is_client_code; } - # Strip useless whitespace and trailing semicolons. - chomp; - s/^\s+//; - s/;\s*$//; - s/\s+/ /g; + if (!$is_client_code) + { + # Strip C-style comments. + s;/\*(.|\n)*\*/;;g; + if (m;/\*;) + { + + # handle multi-line comments properly. + my $next_line = <$ifh>; + die "$input_file: ends within C-style comment\n" + if !defined $next_line; + $_ .= $next_line; + redo; + } + + # Strip useless whitespace and trailing semicolons. + chomp; + s/^\s+//; + s/;\s*$//; + s/\s+/ /g; + } # Push the data into the appropriate data structure. if (/^DECLARE_TOAST\(\s*(\w+),\s*(\d+),\s*(\d+)\)/) @@ -102,14 +119,20 @@ sub ParseHeader $catalog{schema_macro} = /BKI_SCHEMA_MACRO/ ? 1 : 0; $declaring_attributes = 1; } - elsif ($declaring_attributes) + elsif ($is_client_code) { - next if (/^{|^$/); - if (/^#/) + if (/^#endif/) { - $is_varlen = 1 if /^#ifdef\s+CATALOG_VARLEN/; - next; + $is_client_code = 0; + } + else + { + push @{ $catalog{client_code} }, $_; } + } + elsif ($declaring_attributes) + { + next if (/^{|^$/); if (/^}/) { $declaring_attributes = 0; @@ -345,4 +368,18 @@ sub FindDefinedSymbol die "$catalog_header: not found in any include directory\n"; } +# Similar to FindDefinedSymbol, but looks in the bootstrap metadata. +sub FindDefinedSymbolFromData +{ + my ($data, $symbol) = @_; + foreach my $row (@{ $data }) + { + if ($row->{oid_symbol} eq $symbol) + { + return $row->{oid}; + } + die "no definition found for $symbol\n"; + } +} + 1; diff --git a/src/backend/catalog/Makefile b/src/backend/catalog/Makefile index 23858b8..9b87f85 100644 --- a/src/backend/catalog/Makefile +++ b/src/backend/catalog/Makefile @@ -2,6 +2,9 @@ # # Makefile for backend/catalog # +# Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group +# Portions Copyright (c) 1994, Regents of the University of California +# # src/backend/catalog/Makefile # #------------------------------------------------------------------------- @@ -22,13 +25,9 @@ BKIFILES = postgres.bki postgres.description postgres.shdescription include $(top_srcdir)/src/backend/common.mk -all: $(BKIFILES) schemapg.h - # Note: there are some undocumented dependencies on the ordering in which -# the catalog header files are assembled into postgres.bki. In particular, -# indexing.h had better be last, and toasting.h just before it. - -POSTGRES_BKI_SRCS = $(addprefix $(top_srcdir)/src/include/catalog/,\ +# the catalog header files are assembled into postgres.bki. +CATALOG_HEADERS := \ pg_proc.h pg_type.h pg_attribute.h pg_class.h \ pg_attrdef.h pg_constraint.h pg_inherits.h pg_index.h pg_operator.h \ pg_opfamily.h pg_opclass.h pg_am.h pg_amop.h pg_amproc.h \ @@ -46,8 +45,20 @@ POSTGRES_BKI_SRCS = $(addprefix $(top_srcdir)/src/include/catalog/,\ pg_collation.h pg_partitioned_table.h pg_range.h pg_transform.h \ pg_sequence.h pg_publication.h pg_publication_rel.h pg_subscription.h \ pg_subscription_rel.h \ - toasting.h indexing.h \ - ) + +GENERATED_HEADERS := $(CATALOG_HEADERS:%.h=%_d.h) schemapg.h + +distprep: $(BKIFILES) $(GENERATED_HEADERS) + +.PHONY: builddir-headers + +builddir-headers: $(addprefix $(top_builddir)/src/include/catalog/, $(GENERATED_HEADERS)) + +all: distprep builddir-headers + +# In the list of headers used to assemble postgres.bki, indexing.h needs +# be last, and toasting.h just before it. +POSTGRES_BKI_SRCS := $(addprefix $(top_srcdir)/src/include/catalog/, $(CATALOG_HEADERS) toasting.h indexing.h) POSTGRES_BKI_DATA = $(addprefix $(top_srcdir)/src/include/catalog/,\ pg_aggregate.dat pg_am.dat pg_amop.dat pg_amproc.dat pg_authid.dat \ @@ -61,15 +72,10 @@ POSTGRES_BKI_DATA = $(addprefix $(top_srcdir)/src/include/catalog/,\ # location of Catalog.pm catalogdir = $(top_srcdir)/src/backend/catalog -# locations of headers that genbki.pl needs to read -pg_includes = -I$(top_srcdir)/src/include/catalog -I$(top_builddir)/src/include/catalog - # see explanation in ../parser/Makefile postgres.description: postgres.bki ; - postgres.shdescription: postgres.bki ; - -schemapg.h: postgres.bki ; +$(GENERATED_HEADERS): postgres.bki ; # Technically, this should depend on Makefile.global, but then # postgres.bki would need to be rebuilt after every configure run, @@ -78,7 +84,18 @@ schemapg.h: postgres.bki ; # changes. postgres.bki: genbki.pl Catalog.pm $(POSTGRES_BKI_SRCS) $(POSTGRES_BKI_DATA) $(top_srcdir)/configure $(top_srcdir)/src/include/catalog/duplicate_oids cd $(top_srcdir)/src/include/catalog && $(PERL) ./duplicate_oids - $(PERL) -I $(catalogdir) $< $(pg_includes) --set-version=$(MAJORVERSION) $(POSTGRES_BKI_SRCS) + $(PERL) -I $(catalogdir) $< --set-version=$(MAJORVERSION) $(POSTGRES_BKI_SRCS) + +# see explanation in src/backend/Makefile +$(top_builddir)/src/include/catalog/%_d.h: %_d.h + prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \ + cd '$(dir $@)' && rm -f $(notdir $@) && \ + $(LN_S) "$$prereqdir/$(notdir $<)" . + +$(top_builddir)/src/include/catalog/schemapg.h: schemapg.h + prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \ + cd '$(dir $@)' && rm -f $(notdir $@) && \ + $(LN_S) "$$prereqdir/$(notdir $<)" . .PHONY: install-data install-data: $(BKIFILES) installdirs @@ -96,7 +113,7 @@ installdirs: uninstall-data: rm -f $(addprefix '$(DESTDIR)$(datadir)'/, $(BKIFILES) system_views.sql information_schema.sql sql_features.txt) -# postgres.bki, postgres.description, postgres.shdescription, and schemapg.h +# postgres.bki, postgres.description, postgres.shdescription, and the generated headers # are in the distribution tarball, so they are not cleaned here. clean: diff --git a/src/backend/catalog/README b/src/backend/catalog/README index c177ba0..84e6e07 100644 --- a/src/backend/catalog/README +++ b/src/backend/catalog/README @@ -111,7 +111,7 @@ catalogs if at all possible; generally, only tables that must be written to in order to create a table should be bootstrapped. - Certain BOOTSTRAP tables must be at the start of the Makefile -POSTGRES_BKI_SRCS variable, as these cannot be created through the standard +CATALOG_HEADERS variable, as these cannot be created through the standard heap_create_with_catalog process, because it needs these tables to exist already. The list of files this currently includes is: pg_proc.h pg_type.h pg_attribute.h pg_class.h @@ -121,6 +121,12 @@ the tables are in place, and toasting.h should probably be next-to-last (or at least after all the tables that need toast tables). There are reputedly some other order dependencies in the .bki list, too. +-Client code should not include the catalog headers directly. Instead, it +should include the corresponding generated pg_*_d.h header. If you want +macros or other code in the catalog headers to be visible to clients, use +the undefined macro EXPOSE_TO_CLIENT_CODE to instruct genbki.pl to copy +that section to the pg_*_d.h header. + ----------------------------------------------------------------- When munging the .c files, you should be aware of certain conventions: diff --git a/src/backend/catalog/genbki.pl b/src/backend/catalog/genbki.pl index 027dd95..9f67a24 100644 --- a/src/backend/catalog/genbki.pl +++ b/src/backend/catalog/genbki.pl @@ -20,7 +20,6 @@ use strict; use warnings; my @input_files; -my @include_path; my $output_path = ''; my $major_version; @@ -36,10 +35,6 @@ while (@ARGV) { $output_path = length($arg) > 2 ? substr($arg, 2) : shift @ARGV; } - elsif ($arg =~ /^-I/) - { - push @include_path, length($arg) > 2 ? substr($arg, 2) : shift @ARGV; - } elsif ($arg =~ /^--set-version=(.*)$/) { $major_version = $1; @@ -53,8 +48,7 @@ while (@ARGV) } # Sanity check arguments. -die "No input files.\n" if !@input_files; -die "No include path; you must specify -I at least once.\n" if !@include_path; +die "No input files.\n" if !@input_files; die "--set-version must be specified.\n" if !defined $major_version; # Make sure output_path ends in a slash. @@ -78,21 +72,6 @@ my $shdescrfile = $output_path . 'postgres.shdescription'; open my $shdescr, '>', $shdescrfile . $tmpext or die "can't open $shdescrfile$tmpext: $!"; -# Fetch some special data that we will substitute into the output file. -# CAUTION: be wary about what symbols you substitute into the .bki file here! -# It's okay to substitute things that are expected to be really constant -# within a given Postgres release, such as fixed OIDs. Do not substitute -# anything that could depend on platform or configuration. (The right place -# to handle those sorts of things is in initdb.c's bootstrap_template1().) -# NB: make sure that the files used here are known to be part of the .bki -# file's dependencies by src/backend/catalog/Makefile. -my $BOOTSTRAP_SUPERUSERID = - Catalog::FindDefinedSymbol('pg_authid.h', \@include_path, - 'BOOTSTRAP_SUPERUSERID'); -my $PG_CATALOG_NAMESPACE = - Catalog::FindDefinedSymbol('pg_namespace.h', \@include_path, - 'PG_CATALOG_NAMESPACE'); - # Read all the files into internal data structures. Not all catalogs # will have a data file. my @catnames; @@ -131,6 +110,17 @@ foreach my $header (@input_files) } } +# Fetch some special data that we will substitute into the output file. +# CAUTION: be wary about what symbols you substitute into the .bki file here! +# It's okay to substitute things that are expected to be really constant +# within a given Postgres release, such as fixed OIDs. Do not substitute +# anything that could depend on platform or configuration. (The right place +# to handle those sorts of things is in initdb.c's bootstrap_template1().) +my $BOOTSTRAP_SUPERUSERID + = Catalog::FindDefinedSymbolFromData($catalog_data{pg_authid}, 'BOOTSTRAP_SUPERUSERID'); +my $PG_CATALOG_NAMESPACE + = Catalog::FindDefinedSymbolFromData($catalog_data{pg_namespace}, 'PG_CATALOG_NAMESPACE'); + # Generate postgres.bki, postgres.description, and postgres.shdescription # version marker for .bki file @@ -146,6 +136,35 @@ my %types; foreach my $catname (@catnames) { + # Create one definition header with macro definitions for each catalog. + my $def_file = $output_path . $catname . '_d.h'; + open my $def, '>', $def_file . $tmpext + or die "can't open $def_file$tmpext: $!"; + + # Opening boilerplate for pg_*_d.h + printf $def <{relation_oid}" @@ -158,11 +177,14 @@ foreach my $catname (@catnames) print $bki " (\n"; my $schema = $catalog->{columns}; + my $attnum = 0; foreach my $column (@$schema) { + $attnum++; my $attname = $column->{name}; my $atttype = $column->{type}; + # Emit column definitions if (!$first) { print $bki " ,\n"; @@ -179,9 +201,22 @@ foreach my $catname (@catnames) { print $bki " FORCE NULL"; } + + # Emit Anum_* constants + print $def + sprintf("#define Anum_%s_%s %s\n", $catname, $attname, $attnum); } print $bki "\n )\n"; + # Emit Natts_* constant + print $def "\n#define Natts_$catname $attnum\n\n"; + + # Emit client code copied from source header + foreach my $line (@{ $catalog->{client_code} }) + { + print $def $line; + } + # Open it, unless bootstrap case (create bootstrap does this # automatically) if (!$catalog->{bootstrap}) @@ -260,9 +295,21 @@ foreach my $catname (@catnames) printf $shdescr "%s\t%s\t%s\n", $bki_values{oid}, $catname, $bki_values{shdescr}; } + + # Emit OID symbols + if (defined $bki_values{oid_symbol}) + { + printf $def "#define %s %s\n", + $bki_values{oid_symbol}, $bki_values{oid}; + } } print $bki "close $catname\n"; + print $def sprintf("\n#endif /* %s_D_H */\n", uc $catname); + + # Close and rename definition header + close $def; + Catalog::RenameTempFile($def_file, $tmpext); } # Any information needed for the BKI that is not contained in a pg_*.h header diff --git a/src/backend/utils/Gen_fmgrtab.pl b/src/backend/utils/Gen_fmgrtab.pl index 5faaadc..2a5381d 100644 --- a/src/backend/utils/Gen_fmgrtab.pl +++ b/src/backend/utils/Gen_fmgrtab.pl @@ -82,7 +82,7 @@ foreach my $datfile (@input_files) my $FirstBootstrapObjectId = Catalog::FindDefinedSymbol('access/transam.h', \@include_path, 'FirstBootstrapObjectId'); my $INTERNALlanguageId = - Catalog::FindDefinedSymbol('catalog/pg_language.h', \@include_path, 'INTERNALlanguageId'); + Catalog::FindDefinedSymbolFromData($catalog_data{pg_language}, 'INTERNALlanguageId'); # Collect certain fields from pg_proc.dat. my @fmgr = (); diff --git a/src/backend/utils/Makefile b/src/backend/utils/Makefile index f71cdc5..26500be 100644 --- a/src/backend/utils/Makefile +++ b/src/backend/utils/Makefile @@ -20,12 +20,14 @@ all: errcodes.h fmgroids.h fmgrprotos.h probes.h $(SUBDIRS:%=%-recursive): fmgroids.h fmgrprotos.h +FMGR_DATA = $(addprefix $(top_srcdir)/src/include/catalog/, pg_proc.dat pg_language.dat) + # see explanation in ../parser/Makefile fmgrprotos.h: fmgroids.h ; fmgroids.h: fmgrtab.c ; -fmgrtab.c: Gen_fmgrtab.pl $(catalogdir)/Catalog.pm $(top_srcdir)/src/include/catalog/pg_proc.dat $(top_srcdir)/src/include/access/transam.h - $(PERL) -I $(catalogdir) $< -I $(top_srcdir)/src/include/ $(top_srcdir)/src/include/catalog/pg_proc.dat +fmgrtab.c: Gen_fmgrtab.pl $(catalogdir)/Catalog.pm $(FMGR_DATA) $(top_srcdir)/src/include/access/transam.h + $(PERL) -I $(catalogdir) $< -I $(top_srcdir)/src/include/ $(FMGR_DATA) errcodes.h: $(top_srcdir)/src/backend/utils/errcodes.txt generate-errcodes.pl $(PERL) $(srcdir)/generate-errcodes.pl $< > $@ diff --git a/src/common/Makefile b/src/common/Makefile index 80e78d7..f28c136 100644 --- a/src/common/Makefile +++ b/src/common/Makefile @@ -88,6 +88,8 @@ libpgcommon_srv.a: $(OBJS_SRV) %_srv.o: %.c %.o $(CC) $(CFLAGS) $(subst -DFRONTEND ,, $(CPPFLAGS)) -c $< -o $@ +$(OBJS_COMMON): | submake-generated-headers + $(OBJS_SRV): | submake-errcodes .PHONY: submake-errcodes diff --git a/src/include/Makefile b/src/include/Makefile index a689d35..7fe4d45 100644 --- a/src/include/Makefile +++ b/src/include/Makefile @@ -73,7 +73,7 @@ uninstall: clean: - rm -f utils/fmgroids.h utils/fmgrprotos.h utils/errcodes.h parser/gram.h utils/probes.h catalog/schemapg.h + rm -f utils/fmgroids.h utils/fmgrprotos.h utils/errcodes.h parser/gram.h utils/probes.h catalog/schemapg.h catalog/pg_*_d.h distclean maintainer-clean: clean rm -f pg_config.h pg_config_ext.h pg_config_os.h dynloader.h stamp-h stamp-ext-h diff --git a/src/include/catalog/.gitignore b/src/include/catalog/.gitignore index 650202e..dfd5616 100644 --- a/src/include/catalog/.gitignore +++ b/src/include/catalog/.gitignore @@ -1 +1,2 @@ /schemapg.h +/pg_*_d.h diff --git a/src/include/catalog/genbki.h b/src/include/catalog/genbki.h index 9b769c2..4702932 100644 --- a/src/include/catalog/genbki.h +++ b/src/include/catalog/genbki.h @@ -34,9 +34,9 @@ /* Specifies a default value for a catalog field */ #define BKI_DEFAULT(value) +/* The following are never defined; they are here only for documentation. */ + /* - * This is never defined; it's here only for documentation. - * * Variable-length catalog fields (except possibly the first not nullable one) * should not be visible in C structures, so they are made invisible by #ifdefs * of an undefined symbol. See also MARKNOTNULL in bootstrap.c for how this is @@ -44,4 +44,13 @@ */ #undef CATALOG_VARLEN +/* + * There is code in the catalog headers that needs to be visible to clients, + * but we don't want them to include the full header because of safety issues + * with other code in the header. This symbol instructs genbki.pl to copy this + * section when generating the corresponding definition header, where it can + * be included by both client and backend code. + */ +#undef EXPOSE_TO_CLIENT_CODE + #endif /* GENBKI_H */ diff --git a/src/include/catalog/pg_aggregate.h b/src/include/catalog/pg_aggregate.h index 4f9edf9..97d8f22 100644 --- a/src/include/catalog/pg_aggregate.h +++ b/src/include/catalog/pg_aggregate.h @@ -19,6 +19,7 @@ #define PG_AGGREGATE_H #include "catalog/genbki.h" +#include "catalog/pg_aggregate_d.h" /* ---------------------------------------------------------------- * pg_aggregate definition. @@ -87,34 +88,7 @@ CATALOG(pg_aggregate,2600) BKI_WITHOUT_OIDS */ typedef FormData_pg_aggregate *Form_pg_aggregate; -/* ---------------- - * compiler constants for pg_aggregate - * ---------------- - */ - -#define Natts_pg_aggregate 22 -#define Anum_pg_aggregate_aggfnoid 1 -#define Anum_pg_aggregate_aggkind 2 -#define Anum_pg_aggregate_aggnumdirectargs 3 -#define Anum_pg_aggregate_aggtransfn 4 -#define Anum_pg_aggregate_aggfinalfn 5 -#define Anum_pg_aggregate_aggcombinefn 6 -#define Anum_pg_aggregate_aggserialfn 7 -#define Anum_pg_aggregate_aggdeserialfn 8 -#define Anum_pg_aggregate_aggmtransfn 9 -#define Anum_pg_aggregate_aggminvtransfn 10 -#define Anum_pg_aggregate_aggmfinalfn 11 -#define Anum_pg_aggregate_aggfinalextra 12 -#define Anum_pg_aggregate_aggmfinalextra 13 -#define Anum_pg_aggregate_aggfinalmodify 14 -#define Anum_pg_aggregate_aggmfinalmodify 15 -#define Anum_pg_aggregate_aggsortop 16 -#define Anum_pg_aggregate_aggtranstype 17 -#define Anum_pg_aggregate_aggtransspace 18 -#define Anum_pg_aggregate_aggmtranstype 19 -#define Anum_pg_aggregate_aggmtransspace 20 -#define Anum_pg_aggregate_agginitval 21 -#define Anum_pg_aggregate_aggminitval 22 +#ifdef EXPOSE_TO_CLIENT_CODE /* * Symbolic values for aggkind column. We distinguish normal aggregates @@ -143,4 +117,6 @@ typedef FormData_pg_aggregate *Form_pg_aggregate; #define AGGMODIFY_SHARABLE 's' #define AGGMODIFY_READ_WRITE 'w' +#endif /* EXPOSE_TO_CLIENT_CODE */ + #endif /* PG_AGGREGATE_H */ diff --git a/src/include/catalog/pg_am.h b/src/include/catalog/pg_am.h index fe59a29..4004c96 100644 --- a/src/include/catalog/pg_am.h +++ b/src/include/catalog/pg_am.h @@ -19,6 +19,7 @@ #define PG_AM_H #include "catalog/genbki.h" +#include "catalog/pg_am_d.h" /* ---------------- * pg_am definition. cpp turns this into @@ -41,14 +42,7 @@ CATALOG(pg_am,2601) */ typedef FormData_pg_am *Form_pg_am; -/* ---------------- - * compiler constants for pg_am - * ---------------- - */ -#define Natts_pg_am 3 -#define Anum_pg_am_amname 1 -#define Anum_pg_am_amhandler 2 -#define Anum_pg_am_amtype 3 +#ifdef EXPOSE_TO_CLIENT_CODE /* ---------------- * compiler constant for amtype @@ -56,11 +50,6 @@ typedef FormData_pg_am *Form_pg_am; */ #define AMTYPE_INDEX 'i' /* index access method */ -#define BTREE_AM_OID 403 -#define HASH_AM_OID 405 -#define GIST_AM_OID 783 -#define GIN_AM_OID 2742 -#define SPGIST_AM_OID 4000 -#define BRIN_AM_OID 3580 +#endif /* EXPOSE_TO_CLIENT_CODE */ #endif /* PG_AM_H */ diff --git a/src/include/catalog/pg_amop.h b/src/include/catalog/pg_amop.h index e978c32..68ee321 100644 --- a/src/include/catalog/pg_amop.h +++ b/src/include/catalog/pg_amop.h @@ -44,6 +44,7 @@ #define PG_AMOP_H #include "catalog/genbki.h" +#include "catalog/pg_amop_d.h" /* ---------------- * pg_amop definition. cpp turns this into @@ -64,10 +65,6 @@ CATALOG(pg_amop,2602) Oid amopsortfamily; /* ordering opfamily OID, or 0 if search op */ } FormData_pg_amop; -/* allowed values of amoppurpose: */ -#define AMOP_SEARCH 's' /* operator is for search */ -#define AMOP_ORDER 'o' /* operator is for ordering */ - /* ---------------- * Form_pg_amop corresponds to a pointer to a tuple with * the format of pg_amop relation. @@ -75,18 +72,12 @@ CATALOG(pg_amop,2602) */ typedef FormData_pg_amop *Form_pg_amop; -/* ---------------- - * compiler constants for pg_amop - * ---------------- - */ -#define Natts_pg_amop 8 -#define Anum_pg_amop_amopfamily 1 -#define Anum_pg_amop_amoplefttype 2 -#define Anum_pg_amop_amoprighttype 3 -#define Anum_pg_amop_amopstrategy 4 -#define Anum_pg_amop_amoppurpose 5 -#define Anum_pg_amop_amopopr 6 -#define Anum_pg_amop_amopmethod 7 -#define Anum_pg_amop_amopsortfamily 8 +#ifdef EXPOSE_TO_CLIENT_CODE + +/* allowed values of amoppurpose: */ +#define AMOP_SEARCH 's' /* operator is for search */ +#define AMOP_ORDER 'o' /* operator is for ordering */ + +#endif /* EXPOSE_TO_CLIENT_CODE */ #endif /* PG_AMOP_H */ diff --git a/src/include/catalog/pg_amproc.h b/src/include/catalog/pg_amproc.h index 83ce03b..66e1cdc 100644 --- a/src/include/catalog/pg_amproc.h +++ b/src/include/catalog/pg_amproc.h @@ -33,6 +33,7 @@ #define PG_AMPROC_H #include "catalog/genbki.h" +#include "catalog/pg_amproc_d.h" /* ---------------- * pg_amproc definition. cpp turns this into @@ -57,15 +58,4 @@ CATALOG(pg_amproc,2603) */ typedef FormData_pg_amproc *Form_pg_amproc; -/* ---------------- - * compiler constants for pg_amproc - * ---------------- - */ -#define Natts_pg_amproc 5 -#define Anum_pg_amproc_amprocfamily 1 -#define Anum_pg_amproc_amproclefttype 2 -#define Anum_pg_amproc_amprocrighttype 3 -#define Anum_pg_amproc_amprocnum 4 -#define Anum_pg_amproc_amproc 5 - #endif /* PG_AMPROC_H */ diff --git a/src/include/catalog/pg_attrdef.h b/src/include/catalog/pg_attrdef.h index 3aab48d..068ab64 100644 --- a/src/include/catalog/pg_attrdef.h +++ b/src/include/catalog/pg_attrdef.h @@ -19,6 +19,7 @@ #define PG_ATTRDEF_H #include "catalog/genbki.h" +#include "catalog/pg_attrdef_d.h" /* ---------------- * pg_attrdef definition. cpp turns this into @@ -45,14 +46,4 @@ CATALOG(pg_attrdef,2604) */ typedef FormData_pg_attrdef *Form_pg_attrdef; -/* ---------------- - * compiler constants for pg_attrdef - * ---------------- - */ -#define Natts_pg_attrdef 4 -#define Anum_pg_attrdef_adrelid 1 -#define Anum_pg_attrdef_adnum 2 -#define Anum_pg_attrdef_adbin 3 -#define Anum_pg_attrdef_adsrc 4 - #endif /* PG_ATTRDEF_H */ diff --git a/src/include/catalog/pg_attribute.h b/src/include/catalog/pg_attribute.h index 3c78871..db3e860 100644 --- a/src/include/catalog/pg_attribute.h +++ b/src/include/catalog/pg_attribute.h @@ -23,6 +23,7 @@ #define PG_ATTRIBUTE_H #include "catalog/genbki.h" +#include "catalog/pg_attribute_d.h" /* ---------------- * pg_attribute definition. cpp turns this into @@ -189,36 +190,11 @@ CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BK */ typedef FormData_pg_attribute *Form_pg_attribute; -/* ---------------- - * compiler constants for pg_attribute - * ---------------- - */ - -#define Natts_pg_attribute 22 -#define Anum_pg_attribute_attrelid 1 -#define Anum_pg_attribute_attname 2 -#define Anum_pg_attribute_atttypid 3 -#define Anum_pg_attribute_attstattarget 4 -#define Anum_pg_attribute_attlen 5 -#define Anum_pg_attribute_attnum 6 -#define Anum_pg_attribute_attndims 7 -#define Anum_pg_attribute_attcacheoff 8 -#define Anum_pg_attribute_atttypmod 9 -#define Anum_pg_attribute_attbyval 10 -#define Anum_pg_attribute_attstorage 11 -#define Anum_pg_attribute_attalign 12 -#define Anum_pg_attribute_attnotnull 13 -#define Anum_pg_attribute_atthasdef 14 -#define Anum_pg_attribute_attidentity 15 -#define Anum_pg_attribute_attisdropped 16 -#define Anum_pg_attribute_attislocal 17 -#define Anum_pg_attribute_attinhcount 18 -#define Anum_pg_attribute_attcollation 19 -#define Anum_pg_attribute_attacl 20 -#define Anum_pg_attribute_attoptions 21 -#define Anum_pg_attribute_attfdwoptions 22 +#ifdef EXPOSE_TO_CLIENT_CODE #define ATTRIBUTE_IDENTITY_ALWAYS 'a' #define ATTRIBUTE_IDENTITY_BY_DEFAULT 'd' +#endif /* EXPOSE_TO_CLIENT_CODE */ + #endif /* PG_ATTRIBUTE_H */ diff --git a/src/include/catalog/pg_auth_members.h b/src/include/catalog/pg_auth_members.h index a702dff..b8ac653 100644 --- a/src/include/catalog/pg_auth_members.h +++ b/src/include/catalog/pg_auth_members.h @@ -20,6 +20,7 @@ #define PG_AUTH_MEMBERS_H #include "catalog/genbki.h" +#include "catalog/pg_auth_members_d.h" /* ---------------- * pg_auth_members definition. cpp turns this into @@ -44,14 +45,4 @@ CATALOG(pg_auth_members,1261) BKI_SHARED_RELATION BKI_WITHOUT_OIDS BKI_ROWTYPE_O */ typedef FormData_pg_auth_members *Form_pg_auth_members; -/* ---------------- - * compiler constants for pg_auth_members - * ---------------- - */ -#define Natts_pg_auth_members 4 -#define Anum_pg_auth_members_roleid 1 -#define Anum_pg_auth_members_member 2 -#define Anum_pg_auth_members_grantor 3 -#define Anum_pg_auth_members_admin_option 4 - #endif /* PG_AUTH_MEMBERS_H */ diff --git a/src/include/catalog/pg_authid.h b/src/include/catalog/pg_authid.h index b101e30..036bc67 100644 --- a/src/include/catalog/pg_authid.h +++ b/src/include/catalog/pg_authid.h @@ -21,6 +21,7 @@ #define PG_AUTHID_H #include "catalog/genbki.h" +#include "catalog/pg_authid_d.h" /* * The CATALOG definition has to refer to the type of rolvaliduntil as @@ -62,7 +63,6 @@ CATALOG(pg_authid,1260) BKI_SHARED_RELATION BKI_ROWTYPE_OID(2842) BKI_SCHEMA_MAC #undef timestamptz - /* ---------------- * Form_pg_authid corresponds to a pointer to a tuple with * the format of pg_authid relation. @@ -70,28 +70,4 @@ CATALOG(pg_authid,1260) BKI_SHARED_RELATION BKI_ROWTYPE_OID(2842) BKI_SCHEMA_MAC */ typedef FormData_pg_authid *Form_pg_authid; -/* ---------------- - * compiler constants for pg_authid - * ---------------- - */ -#define Natts_pg_authid 11 -#define Anum_pg_authid_rolname 1 -#define Anum_pg_authid_rolsuper 2 -#define Anum_pg_authid_rolinherit 3 -#define Anum_pg_authid_rolcreaterole 4 -#define Anum_pg_authid_rolcreatedb 5 -#define Anum_pg_authid_rolcanlogin 6 -#define Anum_pg_authid_rolreplication 7 -#define Anum_pg_authid_rolbypassrls 8 -#define Anum_pg_authid_rolconnlimit 9 -#define Anum_pg_authid_rolpassword 10 -#define Anum_pg_authid_rolvaliduntil 11 - -#define BOOTSTRAP_SUPERUSERID 10 -#define DEFAULT_ROLE_MONITOR 3373 -#define DEFAULT_ROLE_READ_ALL_SETTINGS 3374 -#define DEFAULT_ROLE_READ_ALL_STATS 3375 -#define DEFAULT_ROLE_STAT_SCAN_TABLES 3377 -#define DEFAULT_ROLE_SIGNAL_BACKENDID 4200 - #endif /* PG_AUTHID_H */ diff --git a/src/include/catalog/pg_cast.h b/src/include/catalog/pg_cast.h index 1930d4b..6d98213 100644 --- a/src/include/catalog/pg_cast.h +++ b/src/include/catalog/pg_cast.h @@ -21,6 +21,7 @@ #define PG_CAST_H #include "catalog/genbki.h" +#include "catalog/pg_cast_d.h" /* ---------------- * pg_cast definition. cpp turns this into @@ -38,6 +39,11 @@ CATALOG(pg_cast,2605) char castmethod; /* cast method */ } FormData_pg_cast; +/* ---------------- + * Form_pg_cast corresponds to a pointer to a tuple with + * the format of pg_cast relation. + * ---------------- + */ typedef FormData_pg_cast *Form_pg_cast; /* @@ -68,16 +74,4 @@ typedef enum CoercionMethod COERCION_METHOD_INOUT = 'i' /* use input/output functions */ } CoercionMethod; - -/* ---------------- - * compiler constants for pg_cast - * ---------------- - */ -#define Natts_pg_cast 5 -#define Anum_pg_cast_castsource 1 -#define Anum_pg_cast_casttarget 2 -#define Anum_pg_cast_castfunc 3 -#define Anum_pg_cast_castcontext 4 -#define Anum_pg_cast_castmethod 5 - #endif /* PG_CAST_H */ diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h index 7bc09bb..d9f5aff 100644 --- a/src/include/catalog/pg_class.h +++ b/src/include/catalog/pg_class.h @@ -19,6 +19,7 @@ #define PG_CLASS_H #include "catalog/genbki.h" +#include "catalog/pg_class_d.h" /* ---------------- * pg_class definition. cpp turns this into @@ -93,46 +94,7 @@ CATALOG(pg_class,1259) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83) BKI_SCHEMA_MACRO */ typedef FormData_pg_class *Form_pg_class; -/* ---------------- - * compiler constants for pg_class - * ---------------- - */ - -#define Natts_pg_class 33 -#define Anum_pg_class_relname 1 -#define Anum_pg_class_relnamespace 2 -#define Anum_pg_class_reltype 3 -#define Anum_pg_class_reloftype 4 -#define Anum_pg_class_relowner 5 -#define Anum_pg_class_relam 6 -#define Anum_pg_class_relfilenode 7 -#define Anum_pg_class_reltablespace 8 -#define Anum_pg_class_relpages 9 -#define Anum_pg_class_reltuples 10 -#define Anum_pg_class_relallvisible 11 -#define Anum_pg_class_reltoastrelid 12 -#define Anum_pg_class_relhasindex 13 -#define Anum_pg_class_relisshared 14 -#define Anum_pg_class_relpersistence 15 -#define Anum_pg_class_relkind 16 -#define Anum_pg_class_relnatts 17 -#define Anum_pg_class_relchecks 18 -#define Anum_pg_class_relhasoids 19 -#define Anum_pg_class_relhaspkey 20 -#define Anum_pg_class_relhasrules 21 -#define Anum_pg_class_relhastriggers 22 -#define Anum_pg_class_relhassubclass 23 -#define Anum_pg_class_relrowsecurity 24 -#define Anum_pg_class_relforcerowsecurity 25 -#define Anum_pg_class_relispopulated 26 -#define Anum_pg_class_relreplident 27 -#define Anum_pg_class_relispartition 28 -#define Anum_pg_class_relfrozenxid 29 -#define Anum_pg_class_relminmxid 30 -#define Anum_pg_class_relacl 31 -#define Anum_pg_class_reloptions 32 -#define Anum_pg_class_relpartbound 33 - +#ifdef EXPOSE_TO_CLIENT_CODE #define RELKIND_RELATION 'r' /* ordinary table */ #define RELKIND_INDEX 'i' /* secondary index */ @@ -162,4 +124,6 @@ typedef FormData_pg_class *Form_pg_class; */ #define REPLICA_IDENTITY_INDEX 'i' +#endif /* EXPOSE_TO_CLIENT_CODE */ + #endif /* PG_CLASS_H */ diff --git a/src/include/catalog/pg_collation.h b/src/include/catalog/pg_collation.h index 50cbe1e..0c6d47f 100644 --- a/src/include/catalog/pg_collation.h +++ b/src/include/catalog/pg_collation.h @@ -20,6 +20,7 @@ #define PG_COLLATION_H #include "catalog/genbki.h" +#include "catalog/pg_collation_d.h" /* ---------------- * pg_collation definition. cpp turns this into @@ -50,26 +51,12 @@ CATALOG(pg_collation,3456) */ typedef FormData_pg_collation *Form_pg_collation; -/* ---------------- - * compiler constants for pg_collation - * ---------------- - */ -#define Natts_pg_collation 8 -#define Anum_pg_collation_collname 1 -#define Anum_pg_collation_collnamespace 2 -#define Anum_pg_collation_collowner 3 -#define Anum_pg_collation_collprovider 4 -#define Anum_pg_collation_collencoding 5 -#define Anum_pg_collation_collcollate 6 -#define Anum_pg_collation_collctype 7 -#define Anum_pg_collation_collversion 8 - -#define DEFAULT_COLLATION_OID 100 -#define C_COLLATION_OID 950 -#define POSIX_COLLATION_OID 951 +#ifdef EXPOSE_TO_CLIENT_CODE #define COLLPROVIDER_DEFAULT 'd' #define COLLPROVIDER_ICU 'i' #define COLLPROVIDER_LIBC 'c' +#endif /* EXPOSE_TO_CLIENT_CODE */ + #endif /* PG_COLLATION_H */ diff --git a/src/include/catalog/pg_constraint.h b/src/include/catalog/pg_constraint.h index 41d97d4..758325e 100644 --- a/src/include/catalog/pg_constraint.h +++ b/src/include/catalog/pg_constraint.h @@ -19,6 +19,7 @@ #define PG_CONSTRAINT_H #include "catalog/genbki.h" +#include "catalog/pg_constraint_d.h" /* ---------------- * pg_constraint definition. cpp turns this into @@ -145,35 +146,7 @@ CATALOG(pg_constraint,2606) */ typedef FormData_pg_constraint *Form_pg_constraint; -/* ---------------- - * compiler constants for pg_constraint - * ---------------- - */ -#define Natts_pg_constraint 24 -#define Anum_pg_constraint_conname 1 -#define Anum_pg_constraint_connamespace 2 -#define Anum_pg_constraint_contype 3 -#define Anum_pg_constraint_condeferrable 4 -#define Anum_pg_constraint_condeferred 5 -#define Anum_pg_constraint_convalidated 6 -#define Anum_pg_constraint_conrelid 7 -#define Anum_pg_constraint_contypid 8 -#define Anum_pg_constraint_conindid 9 -#define Anum_pg_constraint_confrelid 10 -#define Anum_pg_constraint_confupdtype 11 -#define Anum_pg_constraint_confdeltype 12 -#define Anum_pg_constraint_confmatchtype 13 -#define Anum_pg_constraint_conislocal 14 -#define Anum_pg_constraint_coninhcount 15 -#define Anum_pg_constraint_connoinherit 16 -#define Anum_pg_constraint_conkey 17 -#define Anum_pg_constraint_confkey 18 -#define Anum_pg_constraint_conpfeqop 19 -#define Anum_pg_constraint_conppeqop 20 -#define Anum_pg_constraint_conffeqop 21 -#define Anum_pg_constraint_conexclop 22 -#define Anum_pg_constraint_conbin 23 -#define Anum_pg_constraint_consrc 24 +#ifdef EXPOSE_TO_CLIENT_CODE /* Valid values for contype */ #define CONSTRAINT_CHECK 'c' @@ -189,4 +162,6 @@ typedef FormData_pg_constraint *Form_pg_constraint; * the FKCONSTR_MATCH_xxx constants defined in parsenodes.h. */ +#endif /* EXPOSE_TO_CLIENT_CODE */ + #endif /* PG_CONSTRAINT_H */ diff --git a/src/include/catalog/pg_conversion.h b/src/include/catalog/pg_conversion.h index 88098fa..eacc09a 100644 --- a/src/include/catalog/pg_conversion.h +++ b/src/include/catalog/pg_conversion.h @@ -19,6 +19,7 @@ #define PG_CONVERSION_H #include "catalog/genbki.h" +#include "catalog/pg_conversion_d.h" /* ---------------------------------------------------------------- * pg_conversion definition. @@ -54,18 +55,4 @@ CATALOG(pg_conversion,2607) */ typedef FormData_pg_conversion *Form_pg_conversion; -/* ---------------- - * compiler constants for pg_conversion - * ---------------- - */ - -#define Natts_pg_conversion 7 -#define Anum_pg_conversion_conname 1 -#define Anum_pg_conversion_connamespace 2 -#define Anum_pg_conversion_conowner 3 -#define Anum_pg_conversion_conforencoding 4 -#define Anum_pg_conversion_contoencoding 5 -#define Anum_pg_conversion_conproc 6 -#define Anum_pg_conversion_condefault 7 - #endif /* PG_CONVERSION_H */ diff --git a/src/include/catalog/pg_database.h b/src/include/catalog/pg_database.h index b7972fa..9435f24 100644 --- a/src/include/catalog/pg_database.h +++ b/src/include/catalog/pg_database.h @@ -19,6 +19,7 @@ #define PG_DATABASE_H #include "catalog/genbki.h" +#include "catalog/pg_database_d.h" /* ---------------- * pg_database definition. cpp turns this into @@ -55,25 +56,4 @@ CATALOG(pg_database,1262) BKI_SHARED_RELATION BKI_ROWTYPE_OID(1248) BKI_SCHEMA_M */ typedef FormData_pg_database *Form_pg_database; -/* ---------------- - * compiler constants for pg_database - * ---------------- - */ -#define Natts_pg_database 13 -#define Anum_pg_database_datname 1 -#define Anum_pg_database_datdba 2 -#define Anum_pg_database_encoding 3 -#define Anum_pg_database_datcollate 4 -#define Anum_pg_database_datctype 5 -#define Anum_pg_database_datistemplate 6 -#define Anum_pg_database_datallowconn 7 -#define Anum_pg_database_datconnlimit 8 -#define Anum_pg_database_datlastsysoid 9 -#define Anum_pg_database_datfrozenxid 10 -#define Anum_pg_database_datminmxid 11 -#define Anum_pg_database_dattablespace 12 -#define Anum_pg_database_datacl 13 - -#define TemplateDbOid 1 - #endif /* PG_DATABASE_H */ diff --git a/src/include/catalog/pg_db_role_setting.h b/src/include/catalog/pg_db_role_setting.h index 09546bd..013e6a2 100644 --- a/src/include/catalog/pg_db_role_setting.h +++ b/src/include/catalog/pg_db_role_setting.h @@ -18,6 +18,7 @@ #ifndef PG_DB_ROLE_SETTING_H #define PG_DB_ROLE_SETTING_H +#include "catalog/pg_db_role_setting_d.h" #include "utils/guc.h" #include "utils/relcache.h" #include "utils/snapshot.h" @@ -41,15 +42,6 @@ CATALOG(pg_db_role_setting,2964) BKI_SHARED_RELATION BKI_WITHOUT_OIDS typedef FormData_pg_db_role_setting * Form_pg_db_role_setting; -/* ---------------- - * compiler constants for pg_db_role_setting - * ---------------- - */ -#define Natts_pg_db_role_setting 3 -#define Anum_pg_db_role_setting_setdatabase 1 -#define Anum_pg_db_role_setting_setrole 2 -#define Anum_pg_db_role_setting_setconfig 3 - /* * prototypes for functions in pg_db_role_setting.h */ diff --git a/src/include/catalog/pg_default_acl.h b/src/include/catalog/pg_default_acl.h index 7778276..868ac0c 100644 --- a/src/include/catalog/pg_default_acl.h +++ b/src/include/catalog/pg_default_acl.h @@ -19,6 +19,7 @@ #define PG_DEFAULT_ACL_H #include "catalog/genbki.h" +#include "catalog/pg_default_acl_d.h" /* ---------------- * pg_default_acl definition. cpp turns this into @@ -45,16 +46,7 @@ CATALOG(pg_default_acl,826) */ typedef FormData_pg_default_acl *Form_pg_default_acl; -/* ---------------- - * compiler constants for pg_default_acl - * ---------------- - */ - -#define Natts_pg_default_acl 4 -#define Anum_pg_default_acl_defaclrole 1 -#define Anum_pg_default_acl_defaclnamespace 2 -#define Anum_pg_default_acl_defaclobjtype 3 -#define Anum_pg_default_acl_defaclacl 4 +#ifdef EXPOSE_TO_CLIENT_CODE /* * Types of objects for which the user is allowed to specify default @@ -67,4 +59,6 @@ typedef FormData_pg_default_acl *Form_pg_default_acl; #define DEFACLOBJ_TYPE 'T' /* type */ #define DEFACLOBJ_NAMESPACE 'n' /* namespace */ +#endif /* EXPOSE_TO_CLIENT_CODE */ + #endif /* PG_DEFAULT_ACL_H */ diff --git a/src/include/catalog/pg_depend.h b/src/include/catalog/pg_depend.h index 7c60e63..030f655 100644 --- a/src/include/catalog/pg_depend.h +++ b/src/include/catalog/pg_depend.h @@ -31,6 +31,7 @@ #define PG_DEPEND_H #include "catalog/genbki.h" +#include "catalog/pg_depend_d.h" /* ---------------- * pg_depend definition. cpp turns this into @@ -71,18 +72,4 @@ CATALOG(pg_depend,2608) BKI_WITHOUT_OIDS */ typedef FormData_pg_depend *Form_pg_depend; -/* ---------------- - * compiler constants for pg_depend - * ---------------- - */ -#define Natts_pg_depend 7 -#define Anum_pg_depend_classid 1 -#define Anum_pg_depend_objid 2 -#define Anum_pg_depend_objsubid 3 -#define Anum_pg_depend_refclassid 4 -#define Anum_pg_depend_refobjid 5 -#define Anum_pg_depend_refobjsubid 6 -#define Anum_pg_depend_deptype 7 - - #endif /* PG_DEPEND_H */ diff --git a/src/include/catalog/pg_description.h b/src/include/catalog/pg_description.h index 71eed4e..d3c8644 100644 --- a/src/include/catalog/pg_description.h +++ b/src/include/catalog/pg_description.h @@ -38,6 +38,7 @@ #define PG_DESCRIPTION_H #include "catalog/genbki.h" +#include "catalog/pg_description_d.h" /* ---------------- * pg_description definition. cpp turns this into @@ -64,14 +65,4 @@ CATALOG(pg_description,2609) BKI_WITHOUT_OIDS */ typedef FormData_pg_description * Form_pg_description; -/* ---------------- - * compiler constants for pg_description - * ---------------- - */ -#define Natts_pg_description 4 -#define Anum_pg_description_objoid 1 -#define Anum_pg_description_classoid 2 -#define Anum_pg_description_objsubid 3 -#define Anum_pg_description_description 4 - #endif /* PG_DESCRIPTION_H */ diff --git a/src/include/catalog/pg_enum.h b/src/include/catalog/pg_enum.h index 3327688..edea5e3 100644 --- a/src/include/catalog/pg_enum.h +++ b/src/include/catalog/pg_enum.h @@ -18,6 +18,7 @@ #define PG_ENUM_H #include "catalog/genbki.h" +#include "catalog/pg_enum_d.h" #include "nodes/pg_list.h" /* ---------------- @@ -41,15 +42,6 @@ CATALOG(pg_enum,3501) */ typedef FormData_pg_enum *Form_pg_enum; -/* ---------------- - * compiler constants for pg_enum - * ---------------- - */ -#define Natts_pg_enum 3 -#define Anum_pg_enum_enumtypid 1 -#define Anum_pg_enum_enumsortorder 2 -#define Anum_pg_enum_enumlabel 3 - /* * prototypes for functions in pg_enum.c */ diff --git a/src/include/catalog/pg_event_trigger.h b/src/include/catalog/pg_event_trigger.h index 20e7e38..3ca0a88 100644 --- a/src/include/catalog/pg_event_trigger.h +++ b/src/include/catalog/pg_event_trigger.h @@ -19,6 +19,7 @@ #define PG_EVENT_TRIGGER_H #include "catalog/genbki.h" +#include "catalog/pg_event_trigger_d.h" /* ---------------- * pg_event_trigger definition. cpp turns this into @@ -48,16 +49,4 @@ CATALOG(pg_event_trigger,3466) */ typedef FormData_pg_event_trigger *Form_pg_event_trigger; -/* ---------------- - * compiler constants for pg_event_trigger - * ---------------- - */ -#define Natts_pg_event_trigger 6 -#define Anum_pg_event_trigger_evtname 1 -#define Anum_pg_event_trigger_evtevent 2 -#define Anum_pg_event_trigger_evtowner 3 -#define Anum_pg_event_trigger_evtfoid 4 -#define Anum_pg_event_trigger_evtenabled 5 -#define Anum_pg_event_trigger_evttags 6 - #endif /* PG_EVENT_TRIGGER_H */ diff --git a/src/include/catalog/pg_extension.h b/src/include/catalog/pg_extension.h index c2d528f..a60bd44 100644 --- a/src/include/catalog/pg_extension.h +++ b/src/include/catalog/pg_extension.h @@ -19,6 +19,7 @@ #define PG_EXTENSION_H #include "catalog/genbki.h" +#include "catalog/pg_extension_d.h" /* ---------------- * pg_extension definition. cpp turns this into @@ -49,18 +50,4 @@ CATALOG(pg_extension,3079) */ typedef FormData_pg_extension *Form_pg_extension; -/* ---------------- - * compiler constants for pg_extension - * ---------------- - */ - -#define Natts_pg_extension 7 -#define Anum_pg_extension_extname 1 -#define Anum_pg_extension_extowner 2 -#define Anum_pg_extension_extnamespace 3 -#define Anum_pg_extension_extrelocatable 4 -#define Anum_pg_extension_extversion 5 -#define Anum_pg_extension_extconfig 6 -#define Anum_pg_extension_extcondition 7 - #endif /* PG_EXTENSION_H */ diff --git a/src/include/catalog/pg_foreign_data_wrapper.h b/src/include/catalog/pg_foreign_data_wrapper.h index 6cf321d..ae9b0be 100644 --- a/src/include/catalog/pg_foreign_data_wrapper.h +++ b/src/include/catalog/pg_foreign_data_wrapper.h @@ -19,6 +19,7 @@ #define PG_FOREIGN_DATA_WRAPPER_H #include "catalog/genbki.h" +#include "catalog/pg_foreign_data_wrapper_d.h" /* ---------------- * pg_foreign_data_wrapper definition. cpp turns this into @@ -47,17 +48,4 @@ CATALOG(pg_foreign_data_wrapper,2328) */ typedef FormData_pg_foreign_data_wrapper *Form_pg_foreign_data_wrapper; -/* ---------------- - * compiler constants for pg_fdw - * ---------------- - */ - -#define Natts_pg_foreign_data_wrapper 6 -#define Anum_pg_foreign_data_wrapper_fdwname 1 -#define Anum_pg_foreign_data_wrapper_fdwowner 2 -#define Anum_pg_foreign_data_wrapper_fdwhandler 3 -#define Anum_pg_foreign_data_wrapper_fdwvalidator 4 -#define Anum_pg_foreign_data_wrapper_fdwacl 5 -#define Anum_pg_foreign_data_wrapper_fdwoptions 6 - #endif /* PG_FOREIGN_DATA_WRAPPER_H */ diff --git a/src/include/catalog/pg_foreign_server.h b/src/include/catalog/pg_foreign_server.h index f909b26..34fc827 100644 --- a/src/include/catalog/pg_foreign_server.h +++ b/src/include/catalog/pg_foreign_server.h @@ -18,6 +18,7 @@ #define PG_FOREIGN_SERVER_H #include "catalog/genbki.h" +#include "catalog/pg_foreign_server_d.h" /* ---------------- * pg_foreign_server definition. cpp turns this into @@ -47,18 +48,4 @@ CATALOG(pg_foreign_server,1417) */ typedef FormData_pg_foreign_server *Form_pg_foreign_server; -/* ---------------- - * compiler constants for pg_foreign_server - * ---------------- - */ - -#define Natts_pg_foreign_server 7 -#define Anum_pg_foreign_server_srvname 1 -#define Anum_pg_foreign_server_srvowner 2 -#define Anum_pg_foreign_server_srvfdw 3 -#define Anum_pg_foreign_server_srvtype 4 -#define Anum_pg_foreign_server_srvversion 5 -#define Anum_pg_foreign_server_srvacl 6 -#define Anum_pg_foreign_server_srvoptions 7 - #endif /* PG_FOREIGN_SERVER_H */ diff --git a/src/include/catalog/pg_foreign_table.h b/src/include/catalog/pg_foreign_table.h index 9bee001..1a1fefc 100644 --- a/src/include/catalog/pg_foreign_table.h +++ b/src/include/catalog/pg_foreign_table.h @@ -18,6 +18,7 @@ #define PG_FOREIGN_TABLE_H #include "catalog/genbki.h" +#include "catalog/pg_foreign_table_d.h" /* ---------------- * pg_foreign_table definition. cpp turns this into @@ -43,14 +44,4 @@ CATALOG(pg_foreign_table,3118) BKI_WITHOUT_OIDS */ typedef FormData_pg_foreign_table *Form_pg_foreign_table; -/* ---------------- - * compiler constants for pg_foreign_table - * ---------------- - */ - -#define Natts_pg_foreign_table 3 -#define Anum_pg_foreign_table_ftrelid 1 -#define Anum_pg_foreign_table_ftserver 2 -#define Anum_pg_foreign_table_ftoptions 3 - #endif /* PG_FOREIGN_TABLE_H */ diff --git a/src/include/catalog/pg_index.h b/src/include/catalog/pg_index.h index ef0dea6..f8371f0 100644 --- a/src/include/catalog/pg_index.h +++ b/src/include/catalog/pg_index.h @@ -19,6 +19,7 @@ #define PG_INDEX_H #include "catalog/genbki.h" +#include "catalog/pg_index_d.h" /* ---------------- * pg_index definition. cpp turns this into @@ -65,31 +66,6 @@ CATALOG(pg_index,2610) BKI_WITHOUT_OIDS BKI_SCHEMA_MACRO */ typedef FormData_pg_index *Form_pg_index; -/* ---------------- - * compiler constants for pg_index - * ---------------- - */ -#define Natts_pg_index 19 -#define Anum_pg_index_indexrelid 1 -#define Anum_pg_index_indrelid 2 -#define Anum_pg_index_indnatts 3 -#define Anum_pg_index_indisunique 4 -#define Anum_pg_index_indisprimary 5 -#define Anum_pg_index_indisexclusion 6 -#define Anum_pg_index_indimmediate 7 -#define Anum_pg_index_indisclustered 8 -#define Anum_pg_index_indisvalid 9 -#define Anum_pg_index_indcheckxmin 10 -#define Anum_pg_index_indisready 11 -#define Anum_pg_index_indislive 12 -#define Anum_pg_index_indisreplident 13 -#define Anum_pg_index_indkey 14 -#define Anum_pg_index_indcollation 15 -#define Anum_pg_index_indclass 16 -#define Anum_pg_index_indoption 17 -#define Anum_pg_index_indexprs 18 -#define Anum_pg_index_indpred 19 - /* * Index AMs that support ordered scans must support these two indoption * bits. Otherwise, the content of the per-column indoption fields is diff --git a/src/include/catalog/pg_inherits.h b/src/include/catalog/pg_inherits.h index 3af1647..478a587 100644 --- a/src/include/catalog/pg_inherits.h +++ b/src/include/catalog/pg_inherits.h @@ -19,6 +19,7 @@ #define PG_INHERITS_H #include "catalog/genbki.h" +#include "catalog/pg_inherits_d.h" /* ---------------- * pg_inherits definition. cpp turns this into @@ -41,13 +42,4 @@ CATALOG(pg_inherits,2611) BKI_WITHOUT_OIDS */ typedef FormData_pg_inherits *Form_pg_inherits; -/* ---------------- - * compiler constants for pg_inherits - * ---------------- - */ -#define Natts_pg_inherits 3 -#define Anum_pg_inherits_inhrelid 1 -#define Anum_pg_inherits_inhparent 2 -#define Anum_pg_inherits_inhseqno 3 - #endif /* PG_INHERITS_H */ diff --git a/src/include/catalog/pg_init_privs.h b/src/include/catalog/pg_init_privs.h index 51adc7a..7dcb70c 100644 --- a/src/include/catalog/pg_init_privs.h +++ b/src/include/catalog/pg_init_privs.h @@ -36,6 +36,7 @@ #define PG_INIT_PRIVS_H #include "catalog/genbki.h" +#include "catalog/pg_init_privs_d.h" /* ---------------- * pg_init_privs definition. cpp turns this into @@ -63,17 +64,6 @@ CATALOG(pg_init_privs,3394) BKI_WITHOUT_OIDS */ typedef FormData_pg_init_privs * Form_pg_init_privs; -/* ---------------- - * compiler constants for pg_init_privs - * ---------------- - */ -#define Natts_pg_init_privs 5 -#define Anum_pg_init_privs_objoid 1 -#define Anum_pg_init_privs_classoid 2 -#define Anum_pg_init_privs_objsubid 3 -#define Anum_pg_init_privs_privtype 4 -#define Anum_pg_init_privs_initprivs 5 - /* * It is important to know if the initial privileges are from initdb or from an * extension. This enum is used to provide that differentiation and the two diff --git a/src/include/catalog/pg_language.h b/src/include/catalog/pg_language.h index 5f82158..d2d878c 100644 --- a/src/include/catalog/pg_language.h +++ b/src/include/catalog/pg_language.h @@ -19,6 +19,7 @@ #define PG_LANGUAGE_H #include "catalog/genbki.h" +#include "catalog/pg_language_d.h" /* ---------------- * pg_language definition. cpp turns this into @@ -49,22 +50,4 @@ CATALOG(pg_language,2612) */ typedef FormData_pg_language *Form_pg_language; -/* ---------------- - * compiler constants for pg_language - * ---------------- - */ -#define Natts_pg_language 8 -#define Anum_pg_language_lanname 1 -#define Anum_pg_language_lanowner 2 -#define Anum_pg_language_lanispl 3 -#define Anum_pg_language_lanpltrusted 4 -#define Anum_pg_language_lanplcallfoid 5 -#define Anum_pg_language_laninline 6 -#define Anum_pg_language_lanvalidator 7 -#define Anum_pg_language_lanacl 8 - -#define INTERNALlanguageId 12 -#define ClanguageId 13 -#define SQLlanguageId 14 - #endif /* PG_LANGUAGE_H */ diff --git a/src/include/catalog/pg_largeobject.h b/src/include/catalog/pg_largeobject.h index 1857ca4..2157bab 100644 --- a/src/include/catalog/pg_largeobject.h +++ b/src/include/catalog/pg_largeobject.h @@ -17,6 +17,7 @@ #define PG_LARGEOBJECT_H #include "catalog/genbki.h" +#include "catalog/pg_largeobject_d.h" /* ---------------- * pg_largeobject definition. cpp turns this into @@ -42,15 +43,6 @@ CATALOG(pg_largeobject,2613) BKI_WITHOUT_OIDS */ typedef FormData_pg_largeobject *Form_pg_largeobject; -/* ---------------- - * compiler constants for pg_largeobject - * ---------------- - */ -#define Natts_pg_largeobject 3 -#define Anum_pg_largeobject_loid 1 -#define Anum_pg_largeobject_pageno 2 -#define Anum_pg_largeobject_data 3 - extern Oid LargeObjectCreate(Oid loid); extern void LargeObjectDrop(Oid loid); extern bool LargeObjectExists(Oid loid); diff --git a/src/include/catalog/pg_largeobject_metadata.h b/src/include/catalog/pg_largeobject_metadata.h index 0cf7bcd..3d5e0cd 100644 --- a/src/include/catalog/pg_largeobject_metadata.h +++ b/src/include/catalog/pg_largeobject_metadata.h @@ -19,6 +19,7 @@ #define PG_LARGEOBJECT_METADATA_H #include "catalog/genbki.h" +#include "catalog/pg_largeobject_metadata_d.h" /* ---------------- * pg_largeobject_metadata definition. cpp turns this into @@ -43,12 +44,4 @@ CATALOG(pg_largeobject_metadata,2995) */ typedef FormData_pg_largeobject_metadata *Form_pg_largeobject_metadata; -/* ---------------- - * compiler constants for pg_largeobject_metadata - * ---------------- - */ -#define Natts_pg_largeobject_metadata 2 -#define Anum_pg_largeobject_metadata_lomowner 1 -#define Anum_pg_largeobject_metadata_lomacl 2 - #endif /* PG_LARGEOBJECT_METADATA_H */ diff --git a/src/include/catalog/pg_namespace.h b/src/include/catalog/pg_namespace.h index 19b559f9..5f80e86 100644 --- a/src/include/catalog/pg_namespace.h +++ b/src/include/catalog/pg_namespace.h @@ -19,6 +19,7 @@ #define PG_NAMESPACE_H #include "catalog/genbki.h" +#include "catalog/pg_namespace_d.h" /* ---------------------------------------------------------------- * pg_namespace definition. @@ -49,20 +50,6 @@ CATALOG(pg_namespace,2615) */ typedef FormData_pg_namespace *Form_pg_namespace; -/* ---------------- - * compiler constants for pg_namespace - * ---------------- - */ - -#define Natts_pg_namespace 3 -#define Anum_pg_namespace_nspname 1 -#define Anum_pg_namespace_nspowner 2 -#define Anum_pg_namespace_nspacl 3 - -#define PG_CATALOG_NAMESPACE 11 -#define PG_TOAST_NAMESPACE 99 -#define PG_PUBLIC_NAMESPACE 2200 - /* * prototypes for functions in pg_namespace.c */ diff --git a/src/include/catalog/pg_opclass.h b/src/include/catalog/pg_opclass.h index b10ceb9..1f64710 100644 --- a/src/include/catalog/pg_opclass.h +++ b/src/include/catalog/pg_opclass.h @@ -39,6 +39,7 @@ #define PG_OPCLASS_H #include "catalog/genbki.h" +#include "catalog/pg_opclass_d.h" /* ---------------- * pg_opclass definition. cpp turns this into @@ -66,29 +67,4 @@ CATALOG(pg_opclass,2616) */ typedef FormData_pg_opclass *Form_pg_opclass; -/* ---------------- - * compiler constants for pg_opclass - * ---------------- - */ -#define Natts_pg_opclass 8 -#define Anum_pg_opclass_opcmethod 1 -#define Anum_pg_opclass_opcname 2 -#define Anum_pg_opclass_opcnamespace 3 -#define Anum_pg_opclass_opcowner 4 -#define Anum_pg_opclass_opcfamily 5 -#define Anum_pg_opclass_opcintype 6 -#define Anum_pg_opclass_opcdefault 7 -#define Anum_pg_opclass_opckeytype 8 - -#define DATE_BTREE_OPS_OID 3122 -#define FLOAT8_BTREE_OPS_OID 3123 -#define INT2_BTREE_OPS_OID 1979 -#define INT4_BTREE_OPS_OID 1978 -#define INT8_BTREE_OPS_OID 3124 -#define NUMERIC_BTREE_OPS_OID 3125 -#define OID_BTREE_OPS_OID 1981 -#define TEXT_BTREE_OPS_OID 3126 -#define TIMESTAMPTZ_BTREE_OPS_OID 3127 -#define TIMESTAMP_BTREE_OPS_OID 3128 - #endif /* PG_OPCLASS_H */ diff --git a/src/include/catalog/pg_operator.h b/src/include/catalog/pg_operator.h index cbe6884..a0b20f2 100644 --- a/src/include/catalog/pg_operator.h +++ b/src/include/catalog/pg_operator.h @@ -19,6 +19,7 @@ #define PG_OPERATOR_H #include "catalog/genbki.h" +#include "catalog/pg_operator_d.h" /* ---------------- * pg_operator definition. cpp turns this into @@ -52,75 +53,4 @@ CATALOG(pg_operator,2617) */ typedef FormData_pg_operator *Form_pg_operator; -/* ---------------- - * compiler constants for pg_operator - * ---------------- - */ - -#define Natts_pg_operator 14 -#define Anum_pg_operator_oprname 1 -#define Anum_pg_operator_oprnamespace 2 -#define Anum_pg_operator_oprowner 3 -#define Anum_pg_operator_oprkind 4 -#define Anum_pg_operator_oprcanmerge 5 -#define Anum_pg_operator_oprcanhash 6 -#define Anum_pg_operator_oprleft 7 -#define Anum_pg_operator_oprright 8 -#define Anum_pg_operator_oprresult 9 -#define Anum_pg_operator_oprcom 10 -#define Anum_pg_operator_oprnegate 11 -#define Anum_pg_operator_oprcode 12 -#define Anum_pg_operator_oprrest 13 -#define Anum_pg_operator_oprjoin 14 - -#define BooleanNotEqualOperator 85 -#define BooleanEqualOperator 91 -#define Int4EqualOperator 96 -#define Int4LessOperator 97 -#define TextEqualOperator 98 -#define TIDEqualOperator 387 -#define TIDLessOperator 2799 -#define Int8LessOperator 412 -#define OID_NAME_REGEXEQ_OP 639 -#define OID_TEXT_REGEXEQ_OP 641 -#define Float8LessOperator 672 -#define OID_BPCHAR_REGEXEQ_OP 1055 -#define ARRAY_EQ_OP 1070 -#define ARRAY_LT_OP 1072 -#define ARRAY_GT_OP 1073 -#define OID_NAME_LIKE_OP 1207 -#define OID_TEXT_LIKE_OP 1209 -#define OID_BPCHAR_LIKE_OP 1211 -#define OID_NAME_ICREGEXEQ_OP 1226 -#define OID_TEXT_ICREGEXEQ_OP 1228 -#define OID_BPCHAR_ICREGEXEQ_OP 1234 -#define OID_INET_SUB_OP 931 -#define OID_INET_SUBEQ_OP 932 -#define OID_INET_SUP_OP 933 -#define OID_INET_SUPEQ_OP 934 -#define OID_INET_OVERLAP_OP 3552 -#define OID_NAME_ICLIKE_OP 1625 -#define OID_TEXT_ICLIKE_OP 1627 -#define OID_BPCHAR_ICLIKE_OP 1629 -#define OID_BYTEA_LIKE_OP 2016 -#define OID_ARRAY_OVERLAP_OP 2750 -#define OID_ARRAY_CONTAINS_OP 2751 -#define OID_ARRAY_CONTAINED_OP 2752 -#define RECORD_EQ_OP 2988 -#define RECORD_LT_OP 2990 -#define RECORD_GT_OP 2991 -#define OID_RANGE_LESS_OP 3884 -#define OID_RANGE_LESS_EQUAL_OP 3885 -#define OID_RANGE_GREATER_EQUAL_OP 3886 -#define OID_RANGE_GREATER_OP 3887 -#define OID_RANGE_OVERLAP_OP 3888 -#define OID_RANGE_CONTAINS_ELEM_OP 3889 -#define OID_RANGE_CONTAINS_OP 3890 -#define OID_RANGE_ELEM_CONTAINED_OP 3891 -#define OID_RANGE_CONTAINED_OP 3892 -#define OID_RANGE_LEFT_OP 3893 -#define OID_RANGE_RIGHT_OP 3894 -#define OID_RANGE_OVERLAPS_LEFT_OP 3895 -#define OID_RANGE_OVERLAPS_RIGHT_OP 3896 - #endif /* PG_OPERATOR_H */ diff --git a/src/include/catalog/pg_opfamily.h b/src/include/catalog/pg_opfamily.h index e9d8d3d..6ec28ae 100644 --- a/src/include/catalog/pg_opfamily.h +++ b/src/include/catalog/pg_opfamily.h @@ -19,6 +19,7 @@ #define PG_OPFAMILY_H #include "catalog/genbki.h" +#include "catalog/pg_opfamily_d.h" /* ---------------- * pg_opfamily definition. cpp turns this into @@ -42,27 +43,4 @@ CATALOG(pg_opfamily,2753) */ typedef FormData_pg_opfamily *Form_pg_opfamily; -/* ---------------- - * compiler constants for pg_opfamily - * ---------------- - */ -#define Natts_pg_opfamily 4 -#define Anum_pg_opfamily_opfmethod 1 -#define Anum_pg_opfamily_opfname 2 -#define Anum_pg_opfamily_opfnamespace 3 -#define Anum_pg_opfamily_opfowner 4 - -#define BOOL_BTREE_FAM_OID 424 -#define BPCHAR_BTREE_FAM_OID 426 -#define BYTEA_BTREE_FAM_OID 428 -#define NETWORK_BTREE_FAM_OID 1974 -#define INTEGER_BTREE_FAM_OID 1976 -#define NAME_BTREE_FAM_OID 1986 -#define OID_BTREE_FAM_OID 1989 -#define TEXT_BTREE_FAM_OID 1994 -#define TEXT_PATTERN_BTREE_FAM_OID 2095 -#define BPCHAR_PATTERN_BTREE_FAM_OID 2097 -#define BOOL_HASH_FAM_OID 2222 -#define TEXT_SPGIST_FAM_OID 4017 - #endif /* PG_OPFAMILY_H */ diff --git a/src/include/catalog/pg_partitioned_table.h b/src/include/catalog/pg_partitioned_table.h index a8bda00..39ee67e 100644 --- a/src/include/catalog/pg_partitioned_table.h +++ b/src/include/catalog/pg_partitioned_table.h @@ -18,6 +18,7 @@ #define PG_PARTITIONED_TABLE_H #include "catalog/genbki.h" +#include "catalog/pg_partitioned_table_d.h" /* ---------------- * pg_partitioned_table definition. cpp turns this into @@ -59,18 +60,4 @@ CATALOG(pg_partitioned_table,3350) BKI_WITHOUT_OIDS */ typedef FormData_pg_partitioned_table *Form_pg_partitioned_table; -/* ---------------- - * compiler constants for pg_partitioned_table - * ---------------- - */ -#define Natts_pg_partitioned_table 8 -#define Anum_pg_partitioned_table_partrelid 1 -#define Anum_pg_partitioned_table_partstrat 2 -#define Anum_pg_partitioned_table_partnatts 3 -#define Anum_pg_partitioned_table_partdefid 4 -#define Anum_pg_partitioned_table_partattrs 5 -#define Anum_pg_partitioned_table_partclass 6 -#define Anum_pg_partitioned_table_partcollation 7 -#define Anum_pg_partitioned_table_partexprs 8 - #endif /* PG_PARTITIONED_TABLE_H */ diff --git a/src/include/catalog/pg_pltemplate.h b/src/include/catalog/pg_pltemplate.h index b1d9ece..116a4a0 100644 --- a/src/include/catalog/pg_pltemplate.h +++ b/src/include/catalog/pg_pltemplate.h @@ -19,6 +19,7 @@ #define PG_PLTEMPLATE_H #include "catalog/genbki.h" +#include "catalog/pg_pltemplate_d.h" /* ---------------- * pg_pltemplate definition. cpp turns this into @@ -50,18 +51,4 @@ CATALOG(pg_pltemplate,1136) BKI_SHARED_RELATION BKI_WITHOUT_OIDS */ typedef FormData_pg_pltemplate *Form_pg_pltemplate; -/* ---------------- - * compiler constants for pg_pltemplate - * ---------------- - */ -#define Natts_pg_pltemplate 8 -#define Anum_pg_pltemplate_tmplname 1 -#define Anum_pg_pltemplate_tmpltrusted 2 -#define Anum_pg_pltemplate_tmpldbacreate 3 -#define Anum_pg_pltemplate_tmplhandler 4 -#define Anum_pg_pltemplate_tmplinline 5 -#define Anum_pg_pltemplate_tmplvalidator 6 -#define Anum_pg_pltemplate_tmpllibrary 7 -#define Anum_pg_pltemplate_tmplacl 8 - #endif /* PG_PLTEMPLATE_H */ diff --git a/src/include/catalog/pg_policy.h b/src/include/catalog/pg_policy.h index 0d94f1a..543077c 100644 --- a/src/include/catalog/pg_policy.h +++ b/src/include/catalog/pg_policy.h @@ -1,15 +1,19 @@ -/* +/*------------------------------------------------------------------------- + * * pg_policy.h * definition of the system "policy" relation (pg_policy) * + * * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * + *------------------------------------------------------------------------- */ #ifndef PG_POLICY_H #define PG_POLICY_H #include "catalog/genbki.h" +#include "catalog/pg_policy_d.h" /* ---------------- * pg_policy definition. cpp turns this into @@ -39,17 +43,4 @@ CATALOG(pg_policy,3256) */ typedef FormData_pg_policy *Form_pg_policy; -/* ---------------- - * compiler constants for pg_policy - * ---------------- - */ -#define Natts_pg_policy 7 -#define Anum_pg_policy_polname 1 -#define Anum_pg_policy_polrelid 2 -#define Anum_pg_policy_polcmd 3 -#define Anum_pg_policy_polpermissive 4 -#define Anum_pg_policy_polroles 5 -#define Anum_pg_policy_polqual 6 -#define Anum_pg_policy_polwithcheck 7 - #endif /* PG_POLICY_H */ diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index f05eb32..29ca0ee 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -18,6 +18,7 @@ #define PG_PROC_H #include "catalog/genbki.h" +#include "catalog/pg_proc_d.h" /* ---------------- * pg_proc definition. cpp turns this into @@ -75,39 +76,7 @@ CATALOG(pg_proc,1255) BKI_BOOTSTRAP BKI_ROWTYPE_OID(81) BKI_SCHEMA_MACRO */ typedef FormData_pg_proc *Form_pg_proc; -/* ---------------- - * compiler constants for pg_proc - * ---------------- - */ -#define Natts_pg_proc 28 -#define Anum_pg_proc_proname 1 -#define Anum_pg_proc_pronamespace 2 -#define Anum_pg_proc_proowner 3 -#define Anum_pg_proc_prolang 4 -#define Anum_pg_proc_procost 5 -#define Anum_pg_proc_prorows 6 -#define Anum_pg_proc_provariadic 7 -#define Anum_pg_proc_protransform 8 -#define Anum_pg_proc_prokind 9 -#define Anum_pg_proc_prosecdef 10 -#define Anum_pg_proc_proleakproof 11 -#define Anum_pg_proc_proisstrict 12 -#define Anum_pg_proc_proretset 13 -#define Anum_pg_proc_provolatile 14 -#define Anum_pg_proc_proparallel 15 -#define Anum_pg_proc_pronargs 16 -#define Anum_pg_proc_pronargdefaults 17 -#define Anum_pg_proc_prorettype 18 -#define Anum_pg_proc_proargtypes 19 -#define Anum_pg_proc_proallargtypes 20 -#define Anum_pg_proc_proargmodes 21 -#define Anum_pg_proc_proargnames 22 -#define Anum_pg_proc_proargdefaults 23 -#define Anum_pg_proc_protrftypes 24 -#define Anum_pg_proc_prosrc 25 -#define Anum_pg_proc_probin 26 -#define Anum_pg_proc_proconfig 27 -#define Anum_pg_proc_proacl 28 +#ifdef EXPOSE_TO_CLIENT_CODE /* * Symbolic values for prokind column @@ -149,4 +118,6 @@ typedef FormData_pg_proc *Form_pg_proc; #define PROARGMODE_VARIADIC 'v' #define PROARGMODE_TABLE 't' +#endif /* EXPOSE_TO_CLIENT_CODE */ + #endif /* PG_PROC_H */ diff --git a/src/include/catalog/pg_publication.h b/src/include/catalog/pg_publication.h index 62772b6..92cdcf1 100644 --- a/src/include/catalog/pg_publication.h +++ b/src/include/catalog/pg_publication.h @@ -18,12 +18,12 @@ #define PG_PUBLICATION_H #include "catalog/genbki.h" +#include "catalog/pg_publication_d.h" #include "catalog/objectaddress.h" /* ---------------- * pg_publication definition. cpp turns this into * typedef struct FormData_pg_publication - * * ---------------- */ #define PublicationRelationId 6104 @@ -58,19 +58,6 @@ CATALOG(pg_publication,6104) */ typedef FormData_pg_publication *Form_pg_publication; -/* ---------------- - * compiler constants for pg_publication - * ---------------- - */ - -#define Natts_pg_publication 6 -#define Anum_pg_publication_pubname 1 -#define Anum_pg_publication_pubowner 2 -#define Anum_pg_publication_puballtables 3 -#define Anum_pg_publication_pubinsert 4 -#define Anum_pg_publication_pubupdate 5 -#define Anum_pg_publication_pubdelete 6 - typedef struct PublicationActions { bool pubinsert; diff --git a/src/include/catalog/pg_publication_rel.h b/src/include/catalog/pg_publication_rel.h index 661466f..864d6ca 100644 --- a/src/include/catalog/pg_publication_rel.h +++ b/src/include/catalog/pg_publication_rel.h @@ -18,11 +18,11 @@ #define PG_PUBLICATION_REL_H #include "catalog/genbki.h" +#include "catalog/pg_publication_rel_d.h" /* ---------------- * pg_publication_rel definition. cpp turns this into * typedef struct FormData_pg_publication_rel - * * ---------------- */ #define PublicationRelRelationId 6106 @@ -40,13 +40,4 @@ CATALOG(pg_publication_rel,6106) */ typedef FormData_pg_publication_rel *Form_pg_publication_rel; -/* ---------------- - * compiler constants for pg_publication_rel - * ---------------- - */ - -#define Natts_pg_publication_rel 2 -#define Anum_pg_publication_rel_prpubid 1 -#define Anum_pg_publication_rel_prrelid 2 - #endif /* PG_PUBLICATION_REL_H */ diff --git a/src/include/catalog/pg_range.h b/src/include/catalog/pg_range.h index b7113bf..4c806fd 100644 --- a/src/include/catalog/pg_range.h +++ b/src/include/catalog/pg_range.h @@ -19,6 +19,7 @@ #define PG_RANGE_H #include "catalog/genbki.h" +#include "catalog/pg_range_d.h" /* ---------------- * pg_range definition. cpp turns this into @@ -44,18 +45,6 @@ CATALOG(pg_range,3541) BKI_WITHOUT_OIDS */ typedef FormData_pg_range *Form_pg_range; -/* ---------------- - * compiler constants for pg_range - * ---------------- - */ -#define Natts_pg_range 6 -#define Anum_pg_range_rngtypid 1 -#define Anum_pg_range_rngsubtype 2 -#define Anum_pg_range_rngcollation 3 -#define Anum_pg_range_rngsubopc 4 -#define Anum_pg_range_rngcanonical 5 -#define Anum_pg_range_rngsubdiff 6 - /* * prototypes for functions in pg_range.c */ diff --git a/src/include/catalog/pg_replication_origin.h b/src/include/catalog/pg_replication_origin.h index 0c5a05e..02856dd 100644 --- a/src/include/catalog/pg_replication_origin.h +++ b/src/include/catalog/pg_replication_origin.h @@ -18,6 +18,7 @@ #define PG_REPLICATION_ORIGIN_H #include "catalog/genbki.h" +#include "catalog/pg_replication_origin_d.h" #include "access/xlogdefs.h" /* ---------------- @@ -54,12 +55,4 @@ CATALOG(pg_replication_origin,6000) BKI_SHARED_RELATION BKI_WITHOUT_OIDS typedef FormData_pg_replication_origin *Form_pg_replication_origin; -/* ---------------- - * compiler constants for pg_replication_origin - * ---------------- - */ -#define Natts_pg_replication_origin 2 -#define Anum_pg_replication_origin_roident 1 -#define Anum_pg_replication_origin_roname 2 - #endif /* PG_REPLICATION_ORIGIN_H */ diff --git a/src/include/catalog/pg_rewrite.h b/src/include/catalog/pg_rewrite.h index a310ecb..d656990 100644 --- a/src/include/catalog/pg_rewrite.h +++ b/src/include/catalog/pg_rewrite.h @@ -22,6 +22,7 @@ #define PG_REWRITE_H #include "catalog/genbki.h" +#include "catalog/pg_rewrite_d.h" /* ---------------- * pg_rewrite definition. cpp turns this into @@ -51,17 +52,4 @@ CATALOG(pg_rewrite,2618) */ typedef FormData_pg_rewrite *Form_pg_rewrite; -/* ---------------- - * compiler constants for pg_rewrite - * ---------------- - */ -#define Natts_pg_rewrite 7 -#define Anum_pg_rewrite_rulename 1 -#define Anum_pg_rewrite_ev_class 2 -#define Anum_pg_rewrite_ev_type 3 -#define Anum_pg_rewrite_ev_enabled 4 -#define Anum_pg_rewrite_is_instead 5 -#define Anum_pg_rewrite_ev_qual 6 -#define Anum_pg_rewrite_ev_action 7 - #endif /* PG_REWRITE_H */ diff --git a/src/include/catalog/pg_seclabel.h b/src/include/catalog/pg_seclabel.h index 70dc01e..d6d2f97 100644 --- a/src/include/catalog/pg_seclabel.h +++ b/src/include/catalog/pg_seclabel.h @@ -12,6 +12,7 @@ #define PG_SECLABEL_H #include "catalog/genbki.h" +#include "catalog/pg_seclabel_d.h" /* ---------------- * pg_seclabel definition. cpp turns this into @@ -32,15 +33,4 @@ CATALOG(pg_seclabel,3596) BKI_WITHOUT_OIDS #endif } FormData_pg_seclabel; -/* ---------------- - * compiler constants for pg_seclabel - * ---------------- - */ -#define Natts_pg_seclabel 5 -#define Anum_pg_seclabel_objoid 1 -#define Anum_pg_seclabel_classoid 2 -#define Anum_pg_seclabel_objsubid 3 -#define Anum_pg_seclabel_provider 4 -#define Anum_pg_seclabel_label 5 - #endif /* PG_SECLABEL_H */ diff --git a/src/include/catalog/pg_sequence.h b/src/include/catalog/pg_sequence.h index a78417e..de6ed1a 100644 --- a/src/include/catalog/pg_sequence.h +++ b/src/include/catalog/pg_sequence.h @@ -12,6 +12,7 @@ #define PG_SEQUENCE_H #include "catalog/genbki.h" +#include "catalog/pg_sequence_d.h" #define SequenceRelationId 2224 @@ -27,16 +28,11 @@ CATALOG(pg_sequence,2224) BKI_WITHOUT_OIDS bool seqcycle; } FormData_pg_sequence; +/* ---------------- + * Form_pg_sequence corresponds to a pointer to a tuple with + * the format of pg_sequence relation. + * ---------------- + */ typedef FormData_pg_sequence *Form_pg_sequence; -#define Natts_pg_sequence 8 -#define Anum_pg_sequence_seqrelid 1 -#define Anum_pg_sequence_seqtypid 2 -#define Anum_pg_sequence_seqstart 3 -#define Anum_pg_sequence_seqincrement 4 -#define Anum_pg_sequence_seqmax 5 -#define Anum_pg_sequence_seqmin 6 -#define Anum_pg_sequence_seqcache 7 -#define Anum_pg_sequence_seqcycle 8 - #endif /* PG_SEQUENCE_H */ diff --git a/src/include/catalog/pg_shdepend.h b/src/include/catalog/pg_shdepend.h index 17ac34a..708980b 100644 --- a/src/include/catalog/pg_shdepend.h +++ b/src/include/catalog/pg_shdepend.h @@ -28,6 +28,7 @@ #define PG_SHDEPEND_H #include "catalog/genbki.h" +#include "catalog/pg_shdepend_d.h" /* ---------------- * pg_shdepend definition. cpp turns this into @@ -71,18 +72,4 @@ CATALOG(pg_shdepend,1214) BKI_SHARED_RELATION BKI_WITHOUT_OIDS */ typedef FormData_pg_shdepend *Form_pg_shdepend; -/* ---------------- - * compiler constants for pg_shdepend - * ---------------- - */ -#define Natts_pg_shdepend 7 -#define Anum_pg_shdepend_dbid 1 -#define Anum_pg_shdepend_classid 2 -#define Anum_pg_shdepend_objid 3 -#define Anum_pg_shdepend_objsubid 4 -#define Anum_pg_shdepend_refclassid 5 -#define Anum_pg_shdepend_refobjid 6 -#define Anum_pg_shdepend_deptype 7 - - #endif /* PG_SHDEPEND_H */ diff --git a/src/include/catalog/pg_shdescription.h b/src/include/catalog/pg_shdescription.h index c0ecc0c..1777144 100644 --- a/src/include/catalog/pg_shdescription.h +++ b/src/include/catalog/pg_shdescription.h @@ -31,6 +31,7 @@ #define PG_SHDESCRIPTION_H #include "catalog/genbki.h" +#include "catalog/pg_shdescription_d.h" /* ---------------- * pg_shdescription definition. cpp turns this into @@ -56,13 +57,4 @@ CATALOG(pg_shdescription,2396) BKI_SHARED_RELATION BKI_WITHOUT_OIDS */ typedef FormData_pg_shdescription * Form_pg_shdescription; -/* ---------------- - * compiler constants for pg_shdescription - * ---------------- - */ -#define Natts_pg_shdescription 3 -#define Anum_pg_shdescription_objoid 1 -#define Anum_pg_shdescription_classoid 2 -#define Anum_pg_shdescription_description 3 - #endif /* PG_SHDESCRIPTION_H */ diff --git a/src/include/catalog/pg_shseclabel.h b/src/include/catalog/pg_shseclabel.h index 57b854c..9fceeee 100644 --- a/src/include/catalog/pg_shseclabel.h +++ b/src/include/catalog/pg_shseclabel.h @@ -1,7 +1,7 @@ /* ------------------------------------------------------------------------- * * pg_shseclabel.h - * definition of the system "security label" relation (pg_shseclabel) + * definition of the system "shared security label" relation (pg_shseclabel) * * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California @@ -12,6 +12,7 @@ #define PG_SHSECLABEL_H #include "catalog/genbki.h" +#include "catalog/pg_shseclabel_d.h" /* ---------------- * pg_shseclabel definition. cpp turns this into @@ -34,14 +35,4 @@ CATALOG(pg_shseclabel,3592) BKI_SHARED_RELATION BKI_ROWTYPE_OID(4066) BKI_WITHOU typedef FormData_pg_shseclabel * Form_pg_shseclabel; -/* ---------------- - * compiler constants for pg_shseclabel - * ---------------- - */ -#define Natts_pg_shseclabel 4 -#define Anum_pg_shseclabel_objoid 1 -#define Anum_pg_shseclabel_classoid 2 -#define Anum_pg_shseclabel_provider 3 -#define Anum_pg_shseclabel_label 4 - #endif /* PG_SHSECLABEL_H */ diff --git a/src/include/catalog/pg_statistic.h b/src/include/catalog/pg_statistic.h index 8ef2e55..81984d4 100644 --- a/src/include/catalog/pg_statistic.h +++ b/src/include/catalog/pg_statistic.h @@ -19,6 +19,7 @@ #define PG_STATISTIC_H #include "catalog/genbki.h" +#include "catalog/pg_statistic_d.h" /* ---------------- * pg_statistic definition. cpp turns this into @@ -127,38 +128,6 @@ CATALOG(pg_statistic,2619) BKI_WITHOUT_OIDS */ typedef FormData_pg_statistic *Form_pg_statistic; -/* ---------------- - * compiler constants for pg_statistic - * ---------------- - */ -#define Natts_pg_statistic 26 -#define Anum_pg_statistic_starelid 1 -#define Anum_pg_statistic_staattnum 2 -#define Anum_pg_statistic_stainherit 3 -#define Anum_pg_statistic_stanullfrac 4 -#define Anum_pg_statistic_stawidth 5 -#define Anum_pg_statistic_stadistinct 6 -#define Anum_pg_statistic_stakind1 7 -#define Anum_pg_statistic_stakind2 8 -#define Anum_pg_statistic_stakind3 9 -#define Anum_pg_statistic_stakind4 10 -#define Anum_pg_statistic_stakind5 11 -#define Anum_pg_statistic_staop1 12 -#define Anum_pg_statistic_staop2 13 -#define Anum_pg_statistic_staop3 14 -#define Anum_pg_statistic_staop4 15 -#define Anum_pg_statistic_staop5 16 -#define Anum_pg_statistic_stanumbers1 17 -#define Anum_pg_statistic_stanumbers2 18 -#define Anum_pg_statistic_stanumbers3 19 -#define Anum_pg_statistic_stanumbers4 20 -#define Anum_pg_statistic_stanumbers5 21 -#define Anum_pg_statistic_stavalues1 22 -#define Anum_pg_statistic_stavalues2 23 -#define Anum_pg_statistic_stavalues3 24 -#define Anum_pg_statistic_stavalues4 25 -#define Anum_pg_statistic_stavalues5 26 - /* * Several statistical slot "kinds" are defined by core PostgreSQL, as * documented below. Also, custom data types can define their own "kind" diff --git a/src/include/catalog/pg_statistic_ext.h b/src/include/catalog/pg_statistic_ext.h index d656cd8..be84037 100644 --- a/src/include/catalog/pg_statistic_ext.h +++ b/src/include/catalog/pg_statistic_ext.h @@ -19,6 +19,7 @@ #define PG_STATISTIC_EXT_H #include "catalog/genbki.h" +#include "catalog/pg_statistic_ext_d.h" /* ---------------- * pg_statistic_ext definition. cpp turns this into @@ -59,20 +60,6 @@ CATALOG(pg_statistic_ext,3381) */ typedef FormData_pg_statistic_ext *Form_pg_statistic_ext; -/* ---------------- - * compiler constants for pg_statistic_ext - * ---------------- - */ -#define Natts_pg_statistic_ext 8 -#define Anum_pg_statistic_ext_stxrelid 1 -#define Anum_pg_statistic_ext_stxname 2 -#define Anum_pg_statistic_ext_stxnamespace 3 -#define Anum_pg_statistic_ext_stxowner 4 -#define Anum_pg_statistic_ext_stxkeys 5 -#define Anum_pg_statistic_ext_stxkind 6 -#define Anum_pg_statistic_ext_stxndistinct 7 -#define Anum_pg_statistic_ext_stxdependencies 8 - #define STATS_EXT_NDISTINCT 'd' #define STATS_EXT_DEPENDENCIES 'f' diff --git a/src/include/catalog/pg_subscription.h b/src/include/catalog/pg_subscription.h index 46d0b48..1b2981f 100644 --- a/src/include/catalog/pg_subscription.h +++ b/src/include/catalog/pg_subscription.h @@ -12,6 +12,7 @@ #define PG_SUBSCRIPTION_H #include "catalog/genbki.h" +#include "catalog/pg_subscription_d.h" #include "nodes/pg_list.h" /* ---------------- @@ -57,21 +58,6 @@ CATALOG(pg_subscription,6100) BKI_SHARED_RELATION BKI_ROWTYPE_OID(6101) BKI_SCHE typedef FormData_pg_subscription *Form_pg_subscription; -/* ---------------- - * compiler constants for pg_subscription - * ---------------- - */ -#define Natts_pg_subscription 8 -#define Anum_pg_subscription_subdbid 1 -#define Anum_pg_subscription_subname 2 -#define Anum_pg_subscription_subowner 3 -#define Anum_pg_subscription_subenabled 4 -#define Anum_pg_subscription_subconninfo 5 -#define Anum_pg_subscription_subslotname 6 -#define Anum_pg_subscription_subsynccommit 7 -#define Anum_pg_subscription_subpublications 8 - - typedef struct Subscription { Oid oid; /* Oid of the subscription */ diff --git a/src/include/catalog/pg_subscription_rel.h b/src/include/catalog/pg_subscription_rel.h index d936973..64aa121 100644 --- a/src/include/catalog/pg_subscription_rel.h +++ b/src/include/catalog/pg_subscription_rel.h @@ -14,6 +14,7 @@ #include "access/xlogdefs.h" #include "catalog/genbki.h" +#include "catalog/pg_subscription_rel_d.h" #include "nodes/pg_list.h" /* ---------------- @@ -34,15 +35,7 @@ CATALOG(pg_subscription_rel,6102) BKI_WITHOUT_OIDS typedef FormData_pg_subscription_rel *Form_pg_subscription_rel; -/* ---------------- - * compiler constants for pg_subscription_rel - * ---------------- - */ -#define Natts_pg_subscription_rel 4 -#define Anum_pg_subscription_rel_srsubid 1 -#define Anum_pg_subscription_rel_srrelid 2 -#define Anum_pg_subscription_rel_srsubstate 3 -#define Anum_pg_subscription_rel_srsublsn 4 +#ifdef EXPOSE_TO_CLIENT_CODE /* ---------------- * substate constants @@ -60,6 +53,8 @@ typedef FormData_pg_subscription_rel *Form_pg_subscription_rel; #define SUBREL_STATE_SYNCWAIT 'w' /* waiting for sync */ #define SUBREL_STATE_CATCHUP 'c' /* catching up with apply */ +#endif /* EXPOSE_TO_CLIENT_CODE */ + typedef struct SubscriptionRelState { Oid relid; diff --git a/src/include/catalog/pg_tablespace.h b/src/include/catalog/pg_tablespace.h index 75a3a2e..bd9c118 100644 --- a/src/include/catalog/pg_tablespace.h +++ b/src/include/catalog/pg_tablespace.h @@ -19,6 +19,7 @@ #define PG_TABLESPACE_H #include "catalog/genbki.h" +#include "catalog/pg_tablespace_d.h" /* ---------------- * pg_tablespace definition. cpp turns this into @@ -45,18 +46,4 @@ CATALOG(pg_tablespace,1213) BKI_SHARED_RELATION */ typedef FormData_pg_tablespace *Form_pg_tablespace; -/* ---------------- - * compiler constants for pg_tablespace - * ---------------- - */ - -#define Natts_pg_tablespace 4 -#define Anum_pg_tablespace_spcname 1 -#define Anum_pg_tablespace_spcowner 2 -#define Anum_pg_tablespace_spcacl 3 -#define Anum_pg_tablespace_spcoptions 4 - -#define DEFAULTTABLESPACE_OID 1663 -#define GLOBALTABLESPACE_OID 1664 - #endif /* PG_TABLESPACE_H */ diff --git a/src/include/catalog/pg_transform.h b/src/include/catalog/pg_transform.h index 21109db..c571fb5 100644 --- a/src/include/catalog/pg_transform.h +++ b/src/include/catalog/pg_transform.h @@ -1,8 +1,11 @@ /*------------------------------------------------------------------------- * * pg_transform.h + * definition of the system "transform" relation (pg_transform) * - * Copyright (c) 2012-2018, PostgreSQL Global Development Group + * + * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_transform.h * @@ -16,6 +19,7 @@ #define PG_TRANSFORM_H #include "catalog/genbki.h" +#include "catalog/pg_transform_d.h" /* ---------------- * pg_transform definition. cpp turns this into @@ -32,16 +36,11 @@ CATALOG(pg_transform,3576) regproc trftosql; } FormData_pg_transform; -typedef FormData_pg_transform *Form_pg_transform; - /* ---------------- - * compiler constants for pg_transform + * Form_pg_transform corresponds to a pointer to a tuple with + * the format of pg_transform relation. * ---------------- */ -#define Natts_pg_transform 4 -#define Anum_pg_transform_trftype 1 -#define Anum_pg_transform_trflang 2 -#define Anum_pg_transform_trffromsql 3 -#define Anum_pg_transform_trftosql 4 +typedef FormData_pg_transform *Form_pg_transform; #endif /* PG_TRANSFORM_H */ diff --git a/src/include/catalog/pg_trigger.h b/src/include/catalog/pg_trigger.h index e307039..2a5d05e 100644 --- a/src/include/catalog/pg_trigger.h +++ b/src/include/catalog/pg_trigger.h @@ -19,6 +19,7 @@ #define PG_TRIGGER_H #include "catalog/genbki.h" +#include "catalog/pg_trigger_d.h" /* ---------------- * pg_trigger definition. cpp turns this into @@ -70,29 +71,6 @@ CATALOG(pg_trigger,2620) */ typedef FormData_pg_trigger *Form_pg_trigger; -/* ---------------- - * compiler constants for pg_trigger - * ---------------- - */ -#define Natts_pg_trigger 17 -#define Anum_pg_trigger_tgrelid 1 -#define Anum_pg_trigger_tgname 2 -#define Anum_pg_trigger_tgfoid 3 -#define Anum_pg_trigger_tgtype 4 -#define Anum_pg_trigger_tgenabled 5 -#define Anum_pg_trigger_tgisinternal 6 -#define Anum_pg_trigger_tgconstrrelid 7 -#define Anum_pg_trigger_tgconstrindid 8 -#define Anum_pg_trigger_tgconstraint 9 -#define Anum_pg_trigger_tgdeferrable 10 -#define Anum_pg_trigger_tginitdeferred 11 -#define Anum_pg_trigger_tgnargs 12 -#define Anum_pg_trigger_tgattr 13 -#define Anum_pg_trigger_tgargs 14 -#define Anum_pg_trigger_tgqual 15 -#define Anum_pg_trigger_tgoldtable 16 -#define Anum_pg_trigger_tgnewtable 17 - /* Bits within tgtype */ #define TRIGGER_TYPE_ROW (1 << 0) #define TRIGGER_TYPE_BEFORE (1 << 1) diff --git a/src/include/catalog/pg_ts_config.h b/src/include/catalog/pg_ts_config.h index 21e6c2c..d0b7aa9 100644 --- a/src/include/catalog/pg_ts_config.h +++ b/src/include/catalog/pg_ts_config.h @@ -19,6 +19,7 @@ #define PG_TS_CONFIG_H #include "catalog/genbki.h" +#include "catalog/pg_ts_config_d.h" /* ---------------- * pg_ts_config definition. cpp turns this into @@ -37,14 +38,4 @@ CATALOG(pg_ts_config,3602) typedef FormData_pg_ts_config *Form_pg_ts_config; -/* ---------------- - * compiler constants for pg_ts_config - * ---------------- - */ -#define Natts_pg_ts_config 4 -#define Anum_pg_ts_config_cfgname 1 -#define Anum_pg_ts_config_cfgnamespace 2 -#define Anum_pg_ts_config_cfgowner 3 -#define Anum_pg_ts_config_cfgparser 4 - #endif /* PG_TS_CONFIG_H */ diff --git a/src/include/catalog/pg_ts_config_map.h b/src/include/catalog/pg_ts_config_map.h index 3b5e791..cdee4b4 100644 --- a/src/include/catalog/pg_ts_config_map.h +++ b/src/include/catalog/pg_ts_config_map.h @@ -19,6 +19,7 @@ #define PG_TS_CONFIG_MAP_H #include "catalog/genbki.h" +#include "catalog/pg_ts_config_map_d.h" /* ---------------- * pg_ts_config_map definition. cpp turns this into @@ -37,14 +38,4 @@ CATALOG(pg_ts_config_map,3603) BKI_WITHOUT_OIDS typedef FormData_pg_ts_config_map *Form_pg_ts_config_map; -/* ---------------- - * compiler constants for pg_ts_config_map - * ---------------- - */ -#define Natts_pg_ts_config_map 4 -#define Anum_pg_ts_config_map_mapcfg 1 -#define Anum_pg_ts_config_map_maptokentype 2 -#define Anum_pg_ts_config_map_mapseqno 3 -#define Anum_pg_ts_config_map_mapdict 4 - #endif /* PG_TS_CONFIG_MAP_H */ diff --git a/src/include/catalog/pg_ts_dict.h b/src/include/catalog/pg_ts_dict.h index 74c80f0..58af179 100644 --- a/src/include/catalog/pg_ts_dict.h +++ b/src/include/catalog/pg_ts_dict.h @@ -19,6 +19,7 @@ #define PG_TS_DICT_H #include "catalog/genbki.h" +#include "catalog/pg_ts_dict_d.h" /* ---------------- * pg_ts_dict definition. cpp turns this into @@ -41,15 +42,4 @@ CATALOG(pg_ts_dict,3600) typedef FormData_pg_ts_dict *Form_pg_ts_dict; -/* ---------------- - * compiler constants for pg_ts_dict - * ---------------- - */ -#define Natts_pg_ts_dict 5 -#define Anum_pg_ts_dict_dictname 1 -#define Anum_pg_ts_dict_dictnamespace 2 -#define Anum_pg_ts_dict_dictowner 3 -#define Anum_pg_ts_dict_dicttemplate 4 -#define Anum_pg_ts_dict_dictinitoption 5 - #endif /* PG_TS_DICT_H */ diff --git a/src/include/catalog/pg_ts_parser.h b/src/include/catalog/pg_ts_parser.h index 5b5edd0..3baaef0 100644 --- a/src/include/catalog/pg_ts_parser.h +++ b/src/include/catalog/pg_ts_parser.h @@ -19,6 +19,7 @@ #define PG_TS_PARSER_H #include "catalog/genbki.h" +#include "catalog/pg_ts_parser_d.h" /* ---------------- * pg_ts_parser definition. cpp turns this into @@ -40,17 +41,4 @@ CATALOG(pg_ts_parser,3601) typedef FormData_pg_ts_parser *Form_pg_ts_parser; -/* ---------------- - * compiler constants for pg_ts_parser - * ---------------- - */ -#define Natts_pg_ts_parser 7 -#define Anum_pg_ts_parser_prsname 1 -#define Anum_pg_ts_parser_prsnamespace 2 -#define Anum_pg_ts_parser_prsstart 3 -#define Anum_pg_ts_parser_prstoken 4 -#define Anum_pg_ts_parser_prsend 5 -#define Anum_pg_ts_parser_prsheadline 6 -#define Anum_pg_ts_parser_prslextype 7 - #endif /* PG_TS_PARSER_H */ diff --git a/src/include/catalog/pg_ts_template.h b/src/include/catalog/pg_ts_template.h index b641788..7ea6e15 100644 --- a/src/include/catalog/pg_ts_template.h +++ b/src/include/catalog/pg_ts_template.h @@ -19,6 +19,7 @@ #define PG_TS_TEMPLATE_H #include "catalog/genbki.h" +#include "catalog/pg_ts_template_d.h" /* ---------------- * pg_ts_template definition. cpp turns this into @@ -37,14 +38,4 @@ CATALOG(pg_ts_template,3764) typedef FormData_pg_ts_template *Form_pg_ts_template; -/* ---------------- - * compiler constants for pg_ts_template - * ---------------- - */ -#define Natts_pg_ts_template 4 -#define Anum_pg_ts_template_tmplname 1 -#define Anum_pg_ts_template_tmplnamespace 2 -#define Anum_pg_ts_template_tmplinit 3 -#define Anum_pg_ts_template_tmpllexize 4 - #endif /* PG_TS_TEMPLATE_H */ diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h index 6aa9185..f7ddb0c 100644 --- a/src/include/catalog/pg_type.h +++ b/src/include/catalog/pg_type.h @@ -19,6 +19,7 @@ #define PG_TYPE_H #include "catalog/genbki.h" +#include "catalog/pg_type_d.h" /* ---------------- * pg_type definition. cpp turns this into @@ -231,135 +232,7 @@ CATALOG(pg_type,1247) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71) BKI_SCHEMA_MACRO */ typedef FormData_pg_type *Form_pg_type; -/* ---------------- - * compiler constants for pg_type - * ---------------- - */ -#define Natts_pg_type 30 -#define Anum_pg_type_typname 1 -#define Anum_pg_type_typnamespace 2 -#define Anum_pg_type_typowner 3 -#define Anum_pg_type_typlen 4 -#define Anum_pg_type_typbyval 5 -#define Anum_pg_type_typtype 6 -#define Anum_pg_type_typcategory 7 -#define Anum_pg_type_typispreferred 8 -#define Anum_pg_type_typisdefined 9 -#define Anum_pg_type_typdelim 10 -#define Anum_pg_type_typrelid 11 -#define Anum_pg_type_typelem 12 -#define Anum_pg_type_typarray 13 -#define Anum_pg_type_typinput 14 -#define Anum_pg_type_typoutput 15 -#define Anum_pg_type_typreceive 16 -#define Anum_pg_type_typsend 17 -#define Anum_pg_type_typmodin 18 -#define Anum_pg_type_typmodout 19 -#define Anum_pg_type_typanalyze 20 -#define Anum_pg_type_typalign 21 -#define Anum_pg_type_typstorage 22 -#define Anum_pg_type_typnotnull 23 -#define Anum_pg_type_typbasetype 24 -#define Anum_pg_type_typtypmod 25 -#define Anum_pg_type_typndims 26 -#define Anum_pg_type_typcollation 27 -#define Anum_pg_type_typdefaultbin 28 -#define Anum_pg_type_typdefault 29 -#define Anum_pg_type_typacl 30 - -#define BOOLOID 16 -#define BYTEAOID 17 -#define CHAROID 18 -#define NAMEOID 19 -#define INT8OID 20 -#define INT2OID 21 -#define INT2VECTOROID 22 -#define INT4OID 23 -#define REGPROCOID 24 -#define TEXTOID 25 -#define OIDOID 26 -#define TIDOID 27 -#define XIDOID 28 -#define CIDOID 29 -#define OIDVECTOROID 30 -#define JSONOID 114 -#define XMLOID 142 -#define PGNODETREEOID 194 -#define PGNDISTINCTOID 3361 -#define PGDEPENDENCIESOID 3402 -#define PGDDLCOMMANDOID 32 -#define POINTOID 600 -#define LSEGOID 601 -#define PATHOID 602 -#define BOXOID 603 -#define POLYGONOID 604 -#define LINEOID 628 -#define FLOAT4OID 700 -#define FLOAT8OID 701 -#define ABSTIMEOID 702 -#define RELTIMEOID 703 -#define TINTERVALOID 704 -#define UNKNOWNOID 705 -#define CIRCLEOID 718 -#define CASHOID 790 -#define MACADDROID 829 -#define INETOID 869 -#define CIDROID 650 -#define MACADDR8OID 774 -#define INT2ARRAYOID 1005 -#define INT4ARRAYOID 1007 -#define TEXTARRAYOID 1009 -#define OIDARRAYOID 1028 -#define FLOAT4ARRAYOID 1021 -#define ACLITEMOID 1033 -#define CSTRINGARRAYOID 1263 -#define BPCHAROID 1042 -#define VARCHAROID 1043 -#define DATEOID 1082 -#define TIMEOID 1083 -#define TIMESTAMPOID 1114 -#define TIMESTAMPTZOID 1184 -#define INTERVALOID 1186 -#define TIMETZOID 1266 -#define BITOID 1560 -#define VARBITOID 1562 -#define NUMERICOID 1700 -#define REFCURSOROID 1790 -#define REGPROCEDUREOID 2202 -#define REGOPEROID 2203 -#define REGOPERATOROID 2204 -#define REGCLASSOID 2205 -#define REGTYPEOID 2206 -#define REGROLEOID 4096 -#define REGNAMESPACEOID 4089 -#define REGTYPEARRAYOID 2211 -#define UUIDOID 2950 -#define LSNOID 3220 -#define TSVECTOROID 3614 -#define GTSVECTOROID 3642 -#define TSQUERYOID 3615 -#define REGCONFIGOID 3734 -#define REGDICTIONARYOID 3769 -#define JSONBOID 3802 -#define INT4RANGEOID 3904 -#define RECORDOID 2249 -#define RECORDARRAYOID 2287 -#define CSTRINGOID 2275 -#define ANYOID 2276 -#define ANYARRAYOID 2277 -#define VOIDOID 2278 -#define TRIGGEROID 2279 -#define EVTTRIGGEROID 3838 -#define LANGUAGE_HANDLEROID 2280 -#define INTERNALOID 2281 -#define OPAQUEOID 2282 -#define ANYELEMENTOID 2283 -#define ANYNONARRAYOID 2776 -#define ANYENUMOID 3500 -#define FDW_HANDLEROID 3115 -#define INDEX_AM_HANDLEROID 325 -#define TSM_HANDLEROID 3310 -#define ANYRANGEOID 3831 +#ifdef EXPOSE_TO_CLIENT_CODE /* * macros @@ -396,4 +269,6 @@ typedef FormData_pg_type *Form_pg_type; (typid) == ANYENUMOID || \ (typid) == ANYRANGEOID) +#endif /* EXPOSE_TO_CLIENT_CODE */ + #endif /* PG_TYPE_H */ diff --git a/src/include/catalog/pg_user_mapping.h b/src/include/catalog/pg_user_mapping.h index 3da6496..ec62ee2 100644 --- a/src/include/catalog/pg_user_mapping.h +++ b/src/include/catalog/pg_user_mapping.h @@ -18,6 +18,7 @@ #define PG_USER_MAPPING_H #include "catalog/genbki.h" +#include "catalog/pg_user_mapping_d.h" /* ---------------- * pg_user_mapping definition. cpp turns this into @@ -44,14 +45,4 @@ CATALOG(pg_user_mapping,1418) */ typedef FormData_pg_user_mapping *Form_pg_user_mapping; -/* ---------------- - * compiler constants for pg_user_mapping - * ---------------- - */ - -#define Natts_pg_user_mapping 3 -#define Anum_pg_user_mapping_umuser 1 -#define Anum_pg_user_mapping_umserver 2 -#define Anum_pg_user_mapping_umoptions 3 - #endif /* PG_USER_MAPPING_H */ diff --git a/src/interfaces/ecpg/ecpglib/pg_type.h b/src/interfaces/ecpg/ecpglib/pg_type.h index f75c887..79a6cf8 100644 --- a/src/interfaces/ecpg/ecpglib/pg_type.h +++ b/src/interfaces/ecpg/ecpglib/pg_type.h @@ -1,9 +1,7 @@ /*------------------------------------------------------------------------- * * pg_type.h - * Hard-wired knowledge about some standard type OIDs. - * - * XXX keep this in sync with src/include/catalog/pg_type.h + * Interface to generated type OID symbols. * * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California @@ -15,65 +13,6 @@ #ifndef PG_TYPE_H #define PG_TYPE_H -#define BOOLOID 16 -#define BYTEAOID 17 -#define CHAROID 18 -#define NAMEOID 19 -#define INT8OID 20 -#define INT2OID 21 -#define INT2VECTOROID 22 -#define INT4OID 23 -#define REGPROCOID 24 -#define TEXTOID 25 -#define OIDOID 26 -#define TIDOID 27 -#define XIDOID 28 -#define CIDOID 29 -#define OIDVECTOROID 30 -#define POINTOID 600 -#define LSEGOID 601 -#define PATHOID 602 -#define BOXOID 603 -#define POLYGONOID 604 -#define LINEOID 628 -#define FLOAT4OID 700 -#define FLOAT8OID 701 -#define ABSTIMEOID 702 -#define RELTIMEOID 703 -#define TINTERVALOID 704 -#define UNKNOWNOID 705 -#define CIRCLEOID 718 -#define CASHOID 790 -#define INETOID 869 -#define CIDROID 650 -#define BPCHAROID 1042 -#define VARCHAROID 1043 -#define DATEOID 1082 -#define TIMEOID 1083 -#define TIMESTAMPOID 1114 -#define TIMESTAMPTZOID 1184 -#define INTERVALOID 1186 -#define TIMETZOID 1266 -#define BITOID 1560 -#define VARBITOID 1562 -#define NUMERICOID 1700 -#define REFCURSOROID 1790 -#define REGPROCEDUREOID 2202 -#define REGOPEROID 2203 -#define REGOPERATOROID 2204 -#define REGCLASSOID 2205 -#define REGTYPEOID 2206 -#define REGROLEOID 4096 -#define REGNAMESPACEOID 4089 -#define REGTYPEARRAYOID 2211 -#define UUIDOID 2950 -#define LSNOID 3220 -#define TSVECTOROID 3614 -#define GTSVECTOROID 3642 -#define TSQUERYOID 3615 -#define REGCONFIGOID 3734 -#define REGDICTIONARYOID 3769 -#define JSONBOID 3802 -#define INT4RANGEOID 3904 +#include "catalog/pg_type_d.h" #endif /* PG_TYPE_H */ diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm index 9263f5a..e2389b5 100644 --- a/src/tools/msvc/Solution.pm +++ b/src/tools/msvc/Solution.pm @@ -456,9 +456,11 @@ EOF my $mf = Project::read_file('src/backend/catalog/Makefile'); $mf =~ s{\\\r?\n}{}g; - $mf =~ /^POSTGRES_BKI_SRCS\s*:?=[^,]+,(.*)\)$/gm - || croak "Could not find POSTGRES_BKI_SRCS in Makefile\n"; + $mf =~ /^CATALOG_HEADERS\s*:?=(.*)$/gm + || croak "Could not find CATALOG_HEADERS in Makefile\n"; my @bki_srcs = split /\s+/, $1; + push @bki_srcs, 'toasting.h'; + push @bki_srcs, 'indexing.h'; $mf =~ /^POSTGRES_BKI_DATA\s*:?=[^,]+,(.*)\)$/gm || croak "Could not find POSTGRES_BKI_DATA in Makefile\n"; my @bki_data = split /\s+/, $1; @@ -469,13 +471,23 @@ EOF 'src/backend/catalog/postgres.bki', "src/include/catalog/$bki")) { - print "Generating postgres.bki and schemapg.h...\n"; + print "Generating postgres.bki and catalog headers...\n"; chdir('src/backend/catalog'); my $bki_srcs = join(' ../../../src/include/catalog/', @bki_srcs); - system( -"perl genbki.pl -I../../../src/include/catalog --set-version=$self->{majorver} $bki_srcs" - ); + system("perl genbki.pl --set-version=$self->{majorver} $bki_srcs"); chdir('../../..'); + + # Copy generated headers to include directory. + opendir(my $dh, 'src/backend/catalog/') + || die "Can't opendir src/backend/catalog/ $!"; + my @def_headers = grep { /pg_\w+_d\.h$/ } readdir($dh); + closedir $dh; + foreach my $def_header (@def_headers) + { + copyFile( + "src/backend/catalog/$def_header", + "src/include/catalog/$def_header"); + } copyFile( 'src/backend/catalog/schemapg.h', 'src/include/catalog/schemapg.h'); diff --git a/src/tools/msvc/clean.bat b/src/tools/msvc/clean.bat index 0a88b52..b052496 100755 --- a/src/tools/msvc/clean.bat +++ b/src/tools/msvc/clean.bat @@ -48,6 +48,7 @@ if exist src\include\utils\fmgrprotos.h del /q src\include\utils\fmgrprotos.h if exist src\include\storage\lwlocknames.h del /q src\include\storage\lwlocknames.h if exist src\include\utils\probes.h del /q src\include\utils\probes.h if exist src\include\catalog\schemapg.h del /q src\include\catalog\schemapg.h +if exist src\include\catalog\pg_*_d.h del /q src\include\catalog\pg_*_d.h if exist doc\src\sgml\version.sgml del /q doc\src\sgml\version.sgml if %DIST%==1 if exist src\backend\utils\fmgroids.h del /q src\backend\utils\fmgroids.h @@ -67,6 +68,7 @@ if %DIST%==1 if exist src\backend\catalog\postgres.bki del /q src\backend\catalo if %DIST%==1 if exist src\backend\catalog\postgres.description del /q src\backend\catalog\postgres.description if %DIST%==1 if exist src\backend\catalog\postgres.shdescription del /q src\backend\catalog\postgres.shdescription if %DIST%==1 if exist src\backend\catalog\schemapg.h del /q src\backend\catalog\schemapg.h +if %DIST%==1 if exist src\backend\catalog\pg_*_d.h del /q src\backend\catalog\pg_*_d.h if %DIST%==1 if exist src\backend\parser\scan.c del /q src\backend\parser\scan.c if %DIST%==1 if exist src\backend\parser\gram.c del /q src\backend\parser\gram.c if %DIST%==1 if exist src\backend\bootstrap\bootscanner.c del /q src\backend\bootstrap\bootscanner.c diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent index a32aaa6..79243a1 100755 --- a/src/tools/pgindent/pgindent +++ b/src/tools/pgindent/pgindent @@ -198,8 +198,8 @@ sub pre_indent s!(^#ifdef[ \t]+__cplusplus.*\nextern[ \t]+"C"[ \t]*\n)\{[ \t]*$!$1$extern_c_start!gm; $source =~ s!(^#ifdef[ \t]+__cplusplus.*\n)\}[ \t]*$!$1$extern_c_stop!gm; - # Protect backslashes in DATA() and wrapping in CATALOG() - $source =~ s!^((DATA|CATALOG)\(.*)$!/*$1*/!gm; + # Protect wrapping in CATALOG() + $source =~ s!^(CATALOG\(.*)$!/*$1*/!gm; return $source; } @@ -210,8 +210,8 @@ sub post_indent my $source = shift; my $source_filename = shift; - # Restore DATA/CATALOG lines - $source =~ s!^/\*((DATA|CATALOG)\(.*)\*/$!$1!gm; + # Restore CATALOG lines + $source =~ s!^/\*(CATALOG\(.*)\*/$!$1!gm; # Put back braces for extern "C" $source =~ s!^/\* Open extern "C" \*/$!{!gm; -- 2.7.4