Commit 62f34097 authored by Tom Lane's avatar Tom Lane

Build in some knowledge about foreign-key relationships in the catalogs.

This follows in the spirit of commit dfb75e47, which created primary
key and uniqueness constraints to improve the visibility of constraints
imposed on the system catalogs.  While our catalogs contain many
foreign-key-like relationships, they don't quite follow SQL semantics,
in that the convention for an omitted reference is to write zero not
NULL.  Plus, we have some cases in which there are arrays each of whose
elements is supposed to be an FK reference; SQL has no way to model that.
So we can't create actual foreign key constraints to describe the
situation.  Nonetheless, we can collect and use knowledge about these
relationships.

This patch therefore adds annotations to the catalog header files to
declare foreign-key relationships.  (The BKI_LOOKUP annotations cover
simple cases, but we weren't previously distinguishing which such
columns are allowed to contain zeroes; we also need new markings for
multi-column FK references.)  Then, Catalog.pm and genbki.pl are
taught to collect this information into a table in a new generated
header "system_fk_info.h".  The only user of that at the moment is
a new SQL function pg_get_catalog_foreign_keys(), which exposes the
table to SQL.  The oidjoins regression test is rewritten to use
pg_get_catalog_foreign_keys() to find out which columns to check.
Aside from removing the need for manual maintenance of that test
script, this allows it to cover numerous relationships that were not
checked by the old implementation based on findoidjoins.  (As of this
commit, 217 relationships are checked by the test, versus 181 before.)

Discussion: https://postgr.es/m/3240355.1612129197@sss.pgh.pa.us
parent 47933140
...@@ -474,10 +474,15 @@ ...@@ -474,10 +474,15 @@
<listitem> <listitem>
<para> <para>
In such a column, all entries must use the symbolic format except In some catalog columns, it's allowed for entries to be zero instead
when writing <literal>0</literal> for InvalidOid. (If the column is of a valid reference. If this is allowed, write
<literal>BKI_LOOKUP_OPT</literal> instead
of <literal>BKI_LOOKUP</literal>. Then you can
write <literal>0</literal> for an entry. (If the column is
declared <type>regproc</type>, you can optionally declared <type>regproc</type>, you can optionally
write <literal>-</literal> instead of <literal>0</literal>.) write <literal>-</literal> instead of <literal>0</literal>.)
Except for this special case, all entries in
a <literal>BKI_LOOKUP</literal> column must be symbolic references.
<filename>genbki.pl</filename> will warn about unrecognized names. <filename>genbki.pl</filename> will warn about unrecognized names.
</para> </para>
</listitem> </listitem>
...@@ -554,6 +559,22 @@ ...@@ -554,6 +559,22 @@
therefore no need for the bootstrap backend to deal with symbolic therefore no need for the bootstrap backend to deal with symbolic
references. references.
</para> </para>
<para>
It's desirable to mark OID reference columns
with <literal>BKI_LOOKUP</literal> or <literal>BKI_LOOKUP_OPT</literal>
even if the catalog has no initial data that requires lookup. This
allows <filename>genbki.pl</filename> to record the foreign key
relationships that exist in the system catalogs. That information is
used in the regression tests to check for incorrect entries. See also
the macros <literal>DECLARE_FOREIGN_KEY</literal>,
<literal>DECLARE_FOREIGN_KEY_OPT</literal>,
<literal>DECLARE_ARRAY_FOREIGN_KEY</literal>,
and <literal>DECLARE_ARRAY_FOREIGN_KEY_OPT</literal>, which are
used to declare foreign key relationships that are too complex
for <literal>BKI_LOOKUP</literal> (typically, multi-column foreign
keys).
</para>
</sect2> </sect2>
<sect2 id="system-catalog-auto-array-types"> <sect2 id="system-catalog-auto-array-types">
......
...@@ -22789,6 +22789,38 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); ...@@ -22789,6 +22789,38 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
</para></entry> </para></entry>
</row> </row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>pg_get_catalog_foreign_keys</primary>
</indexterm>
<function>pg_get_catalog_foreign_keys</function> ()
<returnvalue>setof record</returnvalue>
( <parameter>fktable</parameter> <type>regclass</type>,
<parameter>fkcols</parameter> <type>text[]</type>,
<parameter>pktable</parameter> <type>regclass</type>,
<parameter>pkcols</parameter> <type>text[]</type>,
<parameter>is_array</parameter> <type>boolean</type>,
<parameter>is_opt</parameter> <type>boolean</type> )
</para>
<para>
Returns a set of records describing the foreign key relationships
that exist within the <productname>PostgreSQL</productname> system
catalogs.
The <parameter>fktable</parameter> column contains the name of the
referencing catalog, and the <parameter>fkcols</parameter> column
contains the name(s) of the referencing column(s). Similarly,
the <parameter>pktable</parameter> column contains the name of the
referenced catalog, and the <parameter>pkcols</parameter> column
contains the name(s) of the referenced column(s).
If <parameter>is_array</parameter> is true, the last referencing
column is an array, each of whose elements should match some entry
in the referenced catalog.
If <parameter>is_opt</parameter> is true, the referencing column(s)
are allowed to contain zeroes instead of a valid reference.
</para></entry>
</row>
<row> <row>
<entry role="func_table_entry"><para role="func_signature"> <entry role="func_table_entry"><para role="func_signature">
<indexterm> <indexterm>
......
/postgres.bki /postgres.bki
/schemapg.h /schemapg.h
/system_fk_info.h
/system_constraints.sql /system_constraints.sql
/pg_*_d.h /pg_*_d.h
/bki-stamp /bki-stamp
...@@ -105,6 +105,17 @@ sub ParseHeader ...@@ -105,6 +105,17 @@ sub ParseHeader
index_decl => $5 index_decl => $5
}; };
} }
elsif (/^DECLARE_(ARRAY_)?FOREIGN_KEY(_OPT)?\(\s*\(([^)]+)\),\s*(\w+),\s*\(([^)]+)\)\)/)
{
push @{ $catalog{foreign_keys} },
{
is_array => $1 ? 1 : 0,
is_opt => $2 ? 1 : 0,
fk_cols => $3,
pk_table => $4,
pk_cols => $5
};
}
elsif (/^CATALOG\((\w+),(\d+),(\w+)\)/) elsif (/^CATALOG\((\w+),(\d+),(\w+)\)/)
{ {
$catalog{catname} = $1; $catalog{catname} = $1;
...@@ -197,9 +208,22 @@ sub ParseHeader ...@@ -197,9 +208,22 @@ sub ParseHeader
{ {
$column{array_default} = $1; $column{array_default} = $1;
} }
elsif ($attopt =~ /BKI_LOOKUP\((\w+)\)/) elsif ($attopt =~ /BKI_LOOKUP(_OPT)?\((\w+)\)/)
{ {
$column{lookup} = $1; $column{lookup} = $2;
$column{lookup_opt} = $1 ? 1 : 0;
# BKI_LOOKUP implicitly makes an FK reference
push @{ $catalog{foreign_keys} },
{
is_array =>
($atttype eq 'oidvector' || $atttype eq '_oid')
? 1
: 0,
is_opt => $column{lookup_opt},
fk_cols => $attname,
pk_table => $column{lookup},
pk_cols => 'oid'
};
} }
else else
{ {
......
...@@ -70,7 +70,7 @@ CATALOG_HEADERS := \ ...@@ -70,7 +70,7 @@ CATALOG_HEADERS := \
pg_sequence.h pg_publication.h pg_publication_rel.h pg_subscription.h \ pg_sequence.h pg_publication.h pg_publication_rel.h pg_subscription.h \
pg_subscription_rel.h pg_subscription_rel.h
GENERATED_HEADERS := $(CATALOG_HEADERS:%.h=%_d.h) schemapg.h GENERATED_HEADERS := $(CATALOG_HEADERS:%.h=%_d.h) schemapg.h system_fk_info.h
POSTGRES_BKI_SRCS := $(addprefix $(top_srcdir)/src/include/catalog/, $(CATALOG_HEADERS)) POSTGRES_BKI_SRCS := $(addprefix $(top_srcdir)/src/include/catalog/, $(CATALOG_HEADERS))
......
...@@ -213,6 +213,12 @@ foreach my $row (@{ $catalog_data{pg_am} }) ...@@ -213,6 +213,12 @@ foreach my $row (@{ $catalog_data{pg_am} })
$amoids{ $row->{amname} } = $row->{oid}; $amoids{ $row->{amname} } = $row->{oid};
} }
# There is only one authid at bootstrap time, and we handle it specially:
# the usually-defaulted symbol PGUID becomes the bootstrap superuser's OID.
# (We could drop this in favor of writing out BKI_DEFAULT(POSTGRES) ...)
my %authidoids;
$authidoids{'PGUID'} = $BOOTSTRAP_SUPERUSERID;
# class (relation) OID lookup (note this only covers bootstrap catalogs!) # class (relation) OID lookup (note this only covers bootstrap catalogs!)
my %classoids; my %classoids;
foreach my $row (@{ $catalog_data{pg_class} }) foreach my $row (@{ $catalog_data{pg_class} })
...@@ -234,6 +240,12 @@ foreach my $row (@{ $catalog_data{pg_language} }) ...@@ -234,6 +240,12 @@ foreach my $row (@{ $catalog_data{pg_language} })
$langoids{ $row->{lanname} } = $row->{oid}; $langoids{ $row->{lanname} } = $row->{oid};
} }
# There is only one namespace at bootstrap time, and we handle it specially:
# the usually-defaulted symbol PGNSP becomes the pg_catalog namespace's OID.
# (We could drop this in favor of writing out BKI_DEFAULT(pg_catalog) ...)
my %namespaceoids;
$namespaceoids{'PGNSP'} = $PG_CATALOG_NAMESPACE;
# opclass OID lookup # opclass OID lookup
my %opcoids; my %opcoids;
foreach my $row (@{ $catalog_data{pg_opclass} }) foreach my $row (@{ $catalog_data{pg_opclass} })
...@@ -376,9 +388,11 @@ close $ef; ...@@ -376,9 +388,11 @@ close $ef;
# Map lookup name to the corresponding hash table. # Map lookup name to the corresponding hash table.
my %lookup_kind = ( my %lookup_kind = (
pg_am => \%amoids, pg_am => \%amoids,
pg_authid => \%authidoids,
pg_class => \%classoids, pg_class => \%classoids,
pg_collation => \%collationoids, pg_collation => \%collationoids,
pg_language => \%langoids, pg_language => \%langoids,
pg_namespace => \%namespaceoids,
pg_opclass => \%opcoids, pg_opclass => \%opcoids,
pg_operator => \%operoids, pg_operator => \%operoids,
pg_opfamily => \%opfoids, pg_opfamily => \%opfoids,
...@@ -400,6 +414,9 @@ open my $bki, '>', $bkifile . $tmpext ...@@ -400,6 +414,9 @@ open my $bki, '>', $bkifile . $tmpext
my $schemafile = $output_path . 'schemapg.h'; my $schemafile = $output_path . 'schemapg.h';
open my $schemapg, '>', $schemafile . $tmpext open my $schemapg, '>', $schemafile . $tmpext
or die "can't open $schemafile$tmpext: $!"; or die "can't open $schemafile$tmpext: $!";
my $fk_info_file = $output_path . 'system_fk_info.h';
open my $fk_info, '>', $fk_info_file . $tmpext
or die "can't open $fk_info_file$tmpext: $!";
my $constraints_file = $output_path . 'system_constraints.sql'; my $constraints_file = $output_path . 'system_constraints.sql';
open my $constraints, '>', $constraints_file . $tmpext open my $constraints, '>', $constraints_file . $tmpext
or die "can't open $constraints_file$tmpext: $!"; or die "can't open $constraints_file$tmpext: $!";
...@@ -554,18 +571,14 @@ EOM ...@@ -554,18 +571,14 @@ EOM
$GenbkiNextOid++; $GenbkiNextOid++;
} }
# Substitute constant values we acquired above.
# (It's intentional that this can apply to parts of a field).
$bki_values{$attname} =~ s/\bPGUID\b/$BOOTSTRAP_SUPERUSERID/g;
$bki_values{$attname} =~ s/\bPGNSP\b/$PG_CATALOG_NAMESPACE/g;
# Replace OID synonyms with OIDs per the appropriate lookup rule. # Replace OID synonyms with OIDs per the appropriate lookup rule.
# #
# If the column type is oidvector or _oid, we have to replace # If the column type is oidvector or _oid, we have to replace
# each element of the array as per the lookup rule. # each element of the array as per the lookup rule.
if ($column->{lookup}) if ($column->{lookup})
{ {
my $lookup = $lookup_kind{ $column->{lookup} }; my $lookup = $lookup_kind{ $column->{lookup} };
my $lookup_opt = $column->{lookup_opt};
my @lookupnames; my @lookupnames;
my @lookupoids; my @lookupoids;
...@@ -575,8 +588,9 @@ EOM ...@@ -575,8 +588,9 @@ EOM
if ($atttype eq 'oidvector') if ($atttype eq 'oidvector')
{ {
@lookupnames = split /\s+/, $bki_values{$attname}; @lookupnames = split /\s+/, $bki_values{$attname};
@lookupoids = lookup_oids($lookup, $catname, \%bki_values, @lookupoids =
@lookupnames); lookup_oids($lookup, $catname, $attname, $lookup_opt,
\%bki_values, @lookupnames);
$bki_values{$attname} = join(' ', @lookupoids); $bki_values{$attname} = join(' ', @lookupoids);
} }
elsif ($atttype eq '_oid') elsif ($atttype eq '_oid')
...@@ -586,8 +600,8 @@ EOM ...@@ -586,8 +600,8 @@ EOM
$bki_values{$attname} =~ s/[{}]//g; $bki_values{$attname} =~ s/[{}]//g;
@lookupnames = split /,/, $bki_values{$attname}; @lookupnames = split /,/, $bki_values{$attname};
@lookupoids = @lookupoids =
lookup_oids($lookup, $catname, \%bki_values, lookup_oids($lookup, $catname, $attname,
@lookupnames); $lookup_opt, \%bki_values, @lookupnames);
$bki_values{$attname} = sprintf "{%s}", $bki_values{$attname} = sprintf "{%s}",
join(',', @lookupoids); join(',', @lookupoids);
} }
...@@ -595,8 +609,9 @@ EOM ...@@ -595,8 +609,9 @@ EOM
else else
{ {
$lookupnames[0] = $bki_values{$attname}; $lookupnames[0] = $bki_values{$attname};
@lookupoids = lookup_oids($lookup, $catname, \%bki_values, @lookupoids =
@lookupnames); lookup_oids($lookup, $catname, $attname, $lookup_opt,
\%bki_values, @lookupnames);
$bki_values{$attname} = $lookupoids[0]; $bki_values{$attname} = $lookupoids[0];
} }
} }
...@@ -706,14 +721,78 @@ foreach my $table_name (@tables_needing_macros) ...@@ -706,14 +721,78 @@ foreach my $table_name (@tables_needing_macros)
# Closing boilerplate for schemapg.h # Closing boilerplate for schemapg.h
print $schemapg "\n#endif\t\t\t\t\t\t\t/* SCHEMAPG_H */\n"; print $schemapg "\n#endif\t\t\t\t\t\t\t/* SCHEMAPG_H */\n";
# Now generate system_fk_info.h
# Opening boilerplate for system_fk_info.h
print $fk_info <<EOM;
/*-------------------------------------------------------------------------
*
* system_fk_info.h
* Data about the foreign-key relationships in the system catalogs
*
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* NOTES
* ******************************
* *** DO NOT EDIT THIS FILE! ***
* ******************************
*
* It has been GENERATED by src/backend/catalog/genbki.pl
*
*-------------------------------------------------------------------------
*/
#ifndef SYSTEM_FK_INFO_H
#define SYSTEM_FK_INFO_H
typedef struct SysFKRelationship
{
Oid fk_table; /* referencing catalog */
Oid pk_table; /* referenced catalog */
const char *fk_columns; /* referencing column name(s) */
const char *pk_columns; /* referenced column name(s) */
bool is_array; /* if true, last fk_column is an array */
bool is_opt; /* if true, fk_column can be zero */
} SysFKRelationship;
static const SysFKRelationship sys_fk_relationships[] = {
EOM
# Emit system_fk_info data
foreach my $catname (@catnames)
{
my $catalog = $catalogs{$catname};
foreach my $fkinfo (@{ $catalog->{foreign_keys} })
{
my $pktabname = $fkinfo->{pk_table};
# We use BKI_LOOKUP for encodings, but there's no real catalog there
next if $pktabname eq 'encoding';
printf $fk_info
"\t{ /* %s */ %s, /* %s */ %s, \"{%s}\", \"{%s}\", %s, %s},\n",
$catname, $catalog->{relation_oid},
$pktabname, $catalogs{$pktabname}->{relation_oid},
$fkinfo->{fk_cols},
$fkinfo->{pk_cols},
($fkinfo->{is_array} ? "true" : "false"),
($fkinfo->{is_opt} ? "true" : "false");
}
}
# Closing boilerplate for system_fk_info.h
print $fk_info "};\n\n#endif\t\t\t\t\t\t\t/* SYSTEM_FK_INFO_H */\n";
# We're done emitting data # We're done emitting data
close $bki; close $bki;
close $schemapg; close $schemapg;
close $fk_info;
close $constraints; close $constraints;
# Finally, rename the completed files into place. # Finally, rename the completed files into place.
Catalog::RenameTempFile($bkifile, $tmpext); Catalog::RenameTempFile($bkifile, $tmpext);
Catalog::RenameTempFile($schemafile, $tmpext); Catalog::RenameTempFile($schemafile, $tmpext);
Catalog::RenameTempFile($fk_info_file, $tmpext);
Catalog::RenameTempFile($constraints_file, $tmpext); Catalog::RenameTempFile($constraints_file, $tmpext);
exit 0; exit 0;
...@@ -948,7 +1027,8 @@ sub morph_row_for_schemapg ...@@ -948,7 +1027,8 @@ sub morph_row_for_schemapg
# within this genbki.pl run.) # within this genbki.pl run.)
sub lookup_oids sub lookup_oids
{ {
my ($lookup, $catname, $bki_values, @lookupnames) = @_; my ($lookup, $catname, $attname, $lookup_opt, $bki_values, @lookupnames)
= @_;
my @lookupoids; my @lookupoids;
foreach my $lookupname (@lookupnames) foreach my $lookupname (@lookupnames)
...@@ -961,10 +1041,19 @@ sub lookup_oids ...@@ -961,10 +1041,19 @@ sub lookup_oids
else else
{ {
push @lookupoids, $lookupname; push @lookupoids, $lookupname;
warn sprintf if ($lookupname eq '-' or $lookupname eq '0')
"unresolved OID reference \"%s\" in %s.dat line %s\n", {
$lookupname, $catname, $bki_values->{line_number} warn sprintf
if $lookupname ne '-' and $lookupname ne '0'; "invalid zero OID reference in %s.dat field %s line %s\n",
$catname, $attname, $bki_values->{line_number}
if !$lookup_opt;
}
else
{
warn sprintf
"unresolved OID reference \"%s\" in %s.dat field %s line %s\n",
$lookupname, $catname, $attname, $bki_values->{line_number};
}
} }
} }
return @lookupoids; return @lookupoids;
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "catalog/catalog.h" #include "catalog/catalog.h"
#include "catalog/pg_tablespace.h" #include "catalog/pg_tablespace.h"
#include "catalog/pg_type.h" #include "catalog/pg_type.h"
#include "catalog/system_fk_info.h"
#include "commands/dbcommands.h" #include "commands/dbcommands.h"
#include "commands/tablespace.h" #include "commands/tablespace.h"
#include "common/keywords.h" #include "common/keywords.h"
...@@ -37,6 +38,7 @@ ...@@ -37,6 +38,7 @@
#include "storage/fd.h" #include "storage/fd.h"
#include "tcop/tcopprot.h" #include "tcop/tcopprot.h"
#include "utils/builtins.h" #include "utils/builtins.h"
#include "utils/fmgroids.h"
#include "utils/lsyscache.h" #include "utils/lsyscache.h"
#include "utils/ruleutils.h" #include "utils/ruleutils.h"
#include "utils/timestamp.h" #include "utils/timestamp.h"
...@@ -489,6 +491,84 @@ pg_get_keywords(PG_FUNCTION_ARGS) ...@@ -489,6 +491,84 @@ pg_get_keywords(PG_FUNCTION_ARGS)
} }
/* Function to return the list of catalog foreign key relationships */
Datum
pg_get_catalog_foreign_keys(PG_FUNCTION_ARGS)
{
FuncCallContext *funcctx;
FmgrInfo *arrayinp;
if (SRF_IS_FIRSTCALL())
{
MemoryContext oldcontext;
TupleDesc tupdesc;
funcctx = SRF_FIRSTCALL_INIT();
oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
tupdesc = CreateTemplateTupleDesc(6);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "fktable",
REGCLASSOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "fkcols",
TEXTARRAYOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 3, "pktable",
REGCLASSOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 4, "pkcols",
TEXTARRAYOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 5, "is_array",
BOOLOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 6, "is_opt",
BOOLOID, -1, 0);
funcctx->tuple_desc = BlessTupleDesc(tupdesc);
/*
* We use array_in to convert the C strings in sys_fk_relationships[]
* to text arrays. But we cannot use DirectFunctionCallN to call
* array_in, and it wouldn't be very efficient if we could. Fill an
* FmgrInfo to use for the call.
*/
arrayinp = (FmgrInfo *) palloc(sizeof(FmgrInfo));
fmgr_info(F_ARRAY_IN, arrayinp);
funcctx->user_fctx = arrayinp;
MemoryContextSwitchTo(oldcontext);
}
funcctx = SRF_PERCALL_SETUP();
arrayinp = (FmgrInfo *) funcctx->user_fctx;
if (funcctx->call_cntr < lengthof(sys_fk_relationships))
{
const SysFKRelationship *fkrel = &sys_fk_relationships[funcctx->call_cntr];
Datum values[6];
bool nulls[6];
HeapTuple tuple;
memset(nulls, false, sizeof(nulls));
values[0] = ObjectIdGetDatum(fkrel->fk_table);
values[1] = FunctionCall3(arrayinp,
CStringGetDatum(fkrel->fk_columns),
ObjectIdGetDatum(TEXTOID),
Int32GetDatum(-1));
values[2] = ObjectIdGetDatum(fkrel->pk_table);
values[3] = FunctionCall3(arrayinp,
CStringGetDatum(fkrel->pk_columns),
ObjectIdGetDatum(TEXTOID),
Int32GetDatum(-1));
values[4] = BoolGetDatum(fkrel->is_array);
values[5] = BoolGetDatum(fkrel->is_opt);
tuple = heap_form_tuple(funcctx->tuple_desc, values, nulls);
SRF_RETURN_NEXT(funcctx, HeapTupleGetDatum(tuple));
}
SRF_RETURN_DONE(funcctx);
}
/* /*
* Return the type of the argument. * Return the type of the argument.
*/ */
......
...@@ -54,7 +54,7 @@ install: all installdirs ...@@ -54,7 +54,7 @@ install: all installdirs
cp $(srcdir)/$$dir/*.h '$(DESTDIR)$(includedir_server)'/$$dir/ || exit; \ cp $(srcdir)/$$dir/*.h '$(DESTDIR)$(includedir_server)'/$$dir/ || exit; \
done done
ifeq ($(vpath_build),yes) ifeq ($(vpath_build),yes)
for file in catalog/schemapg.h catalog/pg_*_d.h parser/gram.h storage/lwlocknames.h utils/probes.h; do \ for file in catalog/schemapg.h catalog/system_fk_info.h catalog/pg_*_d.h parser/gram.h storage/lwlocknames.h utils/probes.h; do \
cp $$file '$(DESTDIR)$(includedir_server)'/$$file || exit; \ cp $$file '$(DESTDIR)$(includedir_server)'/$$file || exit; \
done done
endif endif
...@@ -79,7 +79,8 @@ uninstall: ...@@ -79,7 +79,8 @@ uninstall:
clean: clean:
rm -f utils/fmgroids.h utils/fmgrprotos.h utils/errcodes.h utils/header-stamp rm -f utils/fmgroids.h utils/fmgrprotos.h utils/errcodes.h utils/header-stamp
rm -f parser/gram.h storage/lwlocknames.h utils/probes.h rm -f parser/gram.h storage/lwlocknames.h utils/probes.h
rm -f catalog/schemapg.h catalog/pg_*_d.h catalog/header-stamp rm -f catalog/schemapg.h catalog/system_fk_info.h
rm -f catalog/pg_*_d.h catalog/header-stamp
distclean maintainer-clean: clean distclean maintainer-clean: clean
rm -f pg_config.h pg_config_ext.h pg_config_os.h stamp-h stamp-ext-h rm -f pg_config.h pg_config_ext.h pg_config_os.h stamp-h stamp-ext-h
/schemapg.h /schemapg.h
/system_fk_info.h
/pg_*_d.h /pg_*_d.h
/header-stamp /header-stamp
...@@ -53,6 +53,6 @@ ...@@ -53,6 +53,6 @@
*/ */
/* yyyymmddN */ /* yyyymmddN */
#define CATALOG_VERSION_NO 202101311 #define CATALOG_VERSION_NO 202102021
#endif #endif
...@@ -36,10 +36,15 @@ ...@@ -36,10 +36,15 @@
/* Specifies a default value for auto-generated array types */ /* Specifies a default value for auto-generated array types */
#define BKI_ARRAY_DEFAULT(value) #define BKI_ARRAY_DEFAULT(value)
/* /*
* Indicates how to perform name lookups, typically for an OID or * Indicates that the attribute contains OIDs referencing the named catalog;
* OID-array field * can be applied to columns of oid, regproc, oid[], or oidvector type.
* genbki.pl uses this to know how to perform name lookups in the initial
* data (if any), and it also feeds into regression-test validity checks.
* The _OPT suffix indicates that values can be zero instead of
* a valid OID reference.
*/ */
#define BKI_LOOKUP(catalog) #define BKI_LOOKUP(catalog)
#define BKI_LOOKUP_OPT(catalog)
/* /*
* These lines are processed by genbki.pl to create the statements * These lines are processed by genbki.pl to create the statements
...@@ -75,6 +80,33 @@ ...@@ -75,6 +80,33 @@
#define DECLARE_UNIQUE_INDEX(name,oid,decl) extern int no_such_variable #define DECLARE_UNIQUE_INDEX(name,oid,decl) extern int no_such_variable
#define DECLARE_UNIQUE_INDEX_PKEY(name,oid,decl) extern int no_such_variable #define DECLARE_UNIQUE_INDEX_PKEY(name,oid,decl) extern int no_such_variable
/*
* These lines are processed by genbki.pl to create a table for use
* by the pg_get_catalog_foreign_keys() function. We do not have any
* mechanism that actually enforces foreign-key relationships in the
* system catalogs, but it is still useful to record the intended
* relationships in a machine-readable form.
*
* The keyword is DECLARE_FOREIGN_KEY[_OPT] or DECLARE_ARRAY_FOREIGN_KEY[_OPT].
* The first argument is a parenthesized list of the referencing columns;
* the second, the name of the referenced table; the third, a parenthesized
* list of the referenced columns. Use of the ARRAY macros means that the
* last referencing column is an array, each of whose elements is supposed
* to match some entry in the last referenced column. Use of the OPT suffix
* indicates that the referencing column(s) can be zero instead of a valid
* reference.
*
* Columns that are marked with a BKI_LOOKUP rule do not need an explicit
* DECLARE_FOREIGN_KEY macro, as genbki.pl can infer the FK relationship
* from that. Thus, these macros are only needed in special cases.
*
* The macro definitions are just to keep the C compiler from spitting up.
*/
#define DECLARE_FOREIGN_KEY(cols,reftbl,refcols) extern int no_such_variable
#define DECLARE_FOREIGN_KEY_OPT(cols,reftbl,refcols) extern int no_such_variable
#define DECLARE_ARRAY_FOREIGN_KEY(cols,reftbl,refcols) extern int no_such_variable
#define DECLARE_ARRAY_FOREIGN_KEY_OPT(cols,reftbl,refcols) extern int no_such_variable
/* The following are never defined; they are here only for documentation. */ /* The following are never defined; they are here only for documentation. */
/* /*
......
...@@ -44,25 +44,25 @@ CATALOG(pg_aggregate,2600,AggregateRelationId) ...@@ -44,25 +44,25 @@ CATALOG(pg_aggregate,2600,AggregateRelationId)
regproc aggtransfn BKI_LOOKUP(pg_proc); regproc aggtransfn BKI_LOOKUP(pg_proc);
/* final function (0 if none) */ /* final function (0 if none) */
regproc aggfinalfn BKI_DEFAULT(-) BKI_LOOKUP(pg_proc); regproc aggfinalfn BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc);
/* combine function (0 if none) */ /* combine function (0 if none) */
regproc aggcombinefn BKI_DEFAULT(-) BKI_LOOKUP(pg_proc); regproc aggcombinefn BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc);
/* function to convert transtype to bytea (0 if none) */ /* function to convert transtype to bytea (0 if none) */
regproc aggserialfn BKI_DEFAULT(-) BKI_LOOKUP(pg_proc); regproc aggserialfn BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc);
/* function to convert bytea to transtype (0 if none) */ /* function to convert bytea to transtype (0 if none) */
regproc aggdeserialfn BKI_DEFAULT(-) BKI_LOOKUP(pg_proc); regproc aggdeserialfn BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc);
/* forward function for moving-aggregate mode (0 if none) */ /* forward function for moving-aggregate mode (0 if none) */
regproc aggmtransfn BKI_DEFAULT(-) BKI_LOOKUP(pg_proc); regproc aggmtransfn BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc);
/* inverse function for moving-aggregate mode (0 if none) */ /* inverse function for moving-aggregate mode (0 if none) */
regproc aggminvtransfn BKI_DEFAULT(-) BKI_LOOKUP(pg_proc); regproc aggminvtransfn BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc);
/* final function for moving-aggregate mode (0 if none) */ /* final function for moving-aggregate mode (0 if none) */
regproc aggmfinalfn BKI_DEFAULT(-) BKI_LOOKUP(pg_proc); regproc aggmfinalfn BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc);
/* true to pass extra dummy arguments to aggfinalfn */ /* true to pass extra dummy arguments to aggfinalfn */
bool aggfinalextra BKI_DEFAULT(f); bool aggfinalextra BKI_DEFAULT(f);
...@@ -77,7 +77,7 @@ CATALOG(pg_aggregate,2600,AggregateRelationId) ...@@ -77,7 +77,7 @@ CATALOG(pg_aggregate,2600,AggregateRelationId)
char aggmfinalmodify BKI_DEFAULT(r); char aggmfinalmodify BKI_DEFAULT(r);
/* associated sort operator (0 if none) */ /* associated sort operator (0 if none) */
Oid aggsortop BKI_DEFAULT(0) BKI_LOOKUP(pg_operator); Oid aggsortop BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_operator);
/* type of aggregate's transition (state) data */ /* type of aggregate's transition (state) data */
Oid aggtranstype BKI_LOOKUP(pg_type); Oid aggtranstype BKI_LOOKUP(pg_type);
...@@ -86,7 +86,7 @@ CATALOG(pg_aggregate,2600,AggregateRelationId) ...@@ -86,7 +86,7 @@ CATALOG(pg_aggregate,2600,AggregateRelationId)
int32 aggtransspace BKI_DEFAULT(0); int32 aggtransspace BKI_DEFAULT(0);
/* type of moving-aggregate state data (0 if none) */ /* type of moving-aggregate state data (0 if none) */
Oid aggmtranstype BKI_DEFAULT(0) BKI_LOOKUP(pg_type); Oid aggmtranstype BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_type);
/* estimated size of moving-agg state (0 for default est) */ /* estimated size of moving-agg state (0 for default est) */
int32 aggmtransspace BKI_DEFAULT(0); int32 aggmtransspace BKI_DEFAULT(0);
......
...@@ -77,7 +77,7 @@ CATALOG(pg_amop,2602,AccessMethodOperatorRelationId) ...@@ -77,7 +77,7 @@ CATALOG(pg_amop,2602,AccessMethodOperatorRelationId)
Oid amopmethod BKI_LOOKUP(pg_am); Oid amopmethod BKI_LOOKUP(pg_am);
/* ordering opfamily OID, or 0 if search op */ /* ordering opfamily OID, or 0 if search op */
Oid amopsortfamily BKI_DEFAULT(0) BKI_LOOKUP(pg_opfamily); Oid amopsortfamily BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_opfamily);
} FormData_pg_amop; } FormData_pg_amop;
/* ---------------- /* ----------------
......
...@@ -30,7 +30,8 @@ CATALOG(pg_attrdef,2604,AttrDefaultRelationId) ...@@ -30,7 +30,8 @@ CATALOG(pg_attrdef,2604,AttrDefaultRelationId)
{ {
Oid oid; /* oid */ Oid oid; /* oid */
Oid adrelid; /* OID of table containing attribute */ Oid adrelid BKI_LOOKUP(pg_class); /* OID of table containing
* attribute */
int16 adnum; /* attnum of attribute */ int16 adnum; /* attnum of attribute */
#ifdef CATALOG_VARLEN /* variable-length fields start here */ #ifdef CATALOG_VARLEN /* variable-length fields start here */
...@@ -53,4 +54,6 @@ DECLARE_UNIQUE_INDEX(pg_attrdef_adrelid_adnum_index, 2656, on pg_attrdef using b ...@@ -53,4 +54,6 @@ DECLARE_UNIQUE_INDEX(pg_attrdef_adrelid_adnum_index, 2656, on pg_attrdef using b
DECLARE_UNIQUE_INDEX_PKEY(pg_attrdef_oid_index, 2657, on pg_attrdef using btree(oid oid_ops)); DECLARE_UNIQUE_INDEX_PKEY(pg_attrdef_oid_index, 2657, on pg_attrdef using btree(oid oid_ops));
#define AttrDefaultOidIndexId 2657 #define AttrDefaultOidIndexId 2657
DECLARE_FOREIGN_KEY((adrelid, adnum), pg_attribute, (attrelid, attnum));
#endif /* PG_ATTRDEF_H */ #endif /* PG_ATTRDEF_H */
...@@ -36,7 +36,8 @@ ...@@ -36,7 +36,8 @@
*/ */
CATALOG(pg_attribute,1249,AttributeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(75,AttributeRelation_Rowtype_Id) BKI_SCHEMA_MACRO CATALOG(pg_attribute,1249,AttributeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(75,AttributeRelation_Rowtype_Id) BKI_SCHEMA_MACRO
{ {
Oid attrelid; /* OID of relation containing this attribute */ Oid attrelid BKI_LOOKUP(pg_class); /* OID of relation containing
* this attribute */
NameData attname; /* name of attribute */ NameData attname; /* name of attribute */
/* /*
...@@ -44,9 +45,12 @@ CATALOG(pg_attribute,1249,AttributeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(75, ...@@ -44,9 +45,12 @@ CATALOG(pg_attribute,1249,AttributeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(75,
* defines the data type of this attribute (e.g. int4). Information in * defines the data type of this attribute (e.g. int4). Information in
* that instance is redundant with the attlen, attbyval, and attalign * that instance is redundant with the attlen, attbyval, and attalign
* attributes of this instance, so they had better match or Postgres will * attributes of this instance, so they had better match or Postgres will
* fail. * fail. In an entry for a dropped column, this field is set to zero
* since the pg_type entry may no longer exist; but we rely on attlen,
* attbyval, and attalign to still tell us how large the values in the
* table are.
*/ */
Oid atttypid; Oid atttypid BKI_LOOKUP_OPT(pg_type);
/* /*
* attstattarget is the target number of statistics datapoints to collect * attstattarget is the target number of statistics datapoints to collect
...@@ -153,8 +157,8 @@ CATALOG(pg_attribute,1249,AttributeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(75, ...@@ -153,8 +157,8 @@ CATALOG(pg_attribute,1249,AttributeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(75,
/* Number of times inherited from direct parent relation(s) */ /* Number of times inherited from direct parent relation(s) */
int32 attinhcount BKI_DEFAULT(0); int32 attinhcount BKI_DEFAULT(0);
/* attribute's collation */ /* attribute's collation, if any */
Oid attcollation; Oid attcollation BKI_LOOKUP_OPT(pg_collation);
#ifdef CATALOG_VARLEN /* variable-length fields start here */ #ifdef CATALOG_VARLEN /* variable-length fields start here */
/* NOTE: The following fields are not present in tuple descriptors. */ /* NOTE: The following fields are not present in tuple descriptors. */
......
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
*/ */
CATALOG(pg_auth_members,1261,AuthMemRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(2843,AuthMemRelation_Rowtype_Id) BKI_SCHEMA_MACRO CATALOG(pg_auth_members,1261,AuthMemRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(2843,AuthMemRelation_Rowtype_Id) BKI_SCHEMA_MACRO
{ {
Oid roleid; /* ID of a role */ Oid roleid BKI_LOOKUP(pg_authid); /* ID of a role */
Oid member; /* ID of a member of that role */ Oid member BKI_LOOKUP(pg_authid); /* ID of a member of that role */
Oid grantor; /* who granted the membership */ Oid grantor BKI_LOOKUP(pg_authid); /* who granted the membership */
bool admin_option; /* granted with admin option? */ bool admin_option; /* granted with admin option? */
} FormData_pg_auth_members; } FormData_pg_auth_members;
......
...@@ -40,7 +40,7 @@ CATALOG(pg_cast,2605,CastRelationId) ...@@ -40,7 +40,7 @@ CATALOG(pg_cast,2605,CastRelationId)
Oid casttarget BKI_LOOKUP(pg_type); Oid casttarget BKI_LOOKUP(pg_type);
/* cast function; 0 = binary coercible */ /* cast function; 0 = binary coercible */
Oid castfunc BKI_LOOKUP(pg_proc); Oid castfunc BKI_LOOKUP_OPT(pg_proc);
/* contexts in which cast can be used */ /* contexts in which cast can be used */
char castcontext; char castcontext;
......
...@@ -38,26 +38,26 @@ CATALOG(pg_class,1259,RelationRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83,Relat ...@@ -38,26 +38,26 @@ CATALOG(pg_class,1259,RelationRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83,Relat
NameData relname; NameData relname;
/* OID of namespace containing this class */ /* OID of namespace containing this class */
Oid relnamespace BKI_DEFAULT(PGNSP); Oid relnamespace BKI_DEFAULT(PGNSP) BKI_LOOKUP(pg_namespace);
/* OID of entry in pg_type for table's implicit row type */ /* OID of entry in pg_type for relation's implicit row type, if any */
Oid reltype BKI_LOOKUP(pg_type); Oid reltype BKI_LOOKUP_OPT(pg_type);
/* OID of entry in pg_type for underlying composite type */ /* OID of entry in pg_type for underlying composite type, if any */
Oid reloftype BKI_DEFAULT(0) BKI_LOOKUP(pg_type); Oid reloftype BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_type);
/* class owner */ /* class owner */
Oid relowner BKI_DEFAULT(PGUID); Oid relowner BKI_DEFAULT(PGUID) BKI_LOOKUP(pg_authid);
/* access method; 0 if not a table / index */ /* access method; 0 if not a table / index */
Oid relam BKI_DEFAULT(heap) BKI_LOOKUP(pg_am); Oid relam BKI_DEFAULT(heap) BKI_LOOKUP_OPT(pg_am);
/* identifier of physical storage file */ /* identifier of physical storage file */
/* relfilenode == 0 means it is a "mapped" relation, see relmapper.c */ /* relfilenode == 0 means it is a "mapped" relation, see relmapper.c */
Oid relfilenode BKI_DEFAULT(0); Oid relfilenode BKI_DEFAULT(0);
/* identifier of table space for relation (0 means default for database) */ /* identifier of table space for relation (0 means default for database) */
Oid reltablespace BKI_DEFAULT(0) BKI_LOOKUP(pg_tablespace); Oid reltablespace BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_tablespace);
/* # of blocks (not always up-to-date) */ /* # of blocks (not always up-to-date) */
int32 relpages BKI_DEFAULT(0); int32 relpages BKI_DEFAULT(0);
...@@ -69,7 +69,7 @@ CATALOG(pg_class,1259,RelationRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83,Relat ...@@ -69,7 +69,7 @@ CATALOG(pg_class,1259,RelationRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83,Relat
int32 relallvisible BKI_DEFAULT(0); int32 relallvisible BKI_DEFAULT(0);
/* OID of toast table; 0 if none */ /* OID of toast table; 0 if none */
Oid reltoastrelid BKI_DEFAULT(0); Oid reltoastrelid BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_class);
/* T if has (or has had) any indexes */ /* T if has (or has had) any indexes */
bool relhasindex BKI_DEFAULT(f); bool relhasindex BKI_DEFAULT(f);
...@@ -119,8 +119,8 @@ CATALOG(pg_class,1259,RelationRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83,Relat ...@@ -119,8 +119,8 @@ CATALOG(pg_class,1259,RelationRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83,Relat
/* is relation a partition? */ /* is relation a partition? */
bool relispartition BKI_DEFAULT(f); bool relispartition BKI_DEFAULT(f);
/* heap for rewrite during DDL, link to original rel */ /* link to original rel during table rewrite; otherwise 0 */
Oid relrewrite BKI_DEFAULT(0); Oid relrewrite BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_class);
/* all Xids < this are frozen in this rel */ /* all Xids < this are frozen in this rel */
TransactionId relfrozenxid BKI_DEFAULT(3); /* FirstNormalTransactionId */ TransactionId relfrozenxid BKI_DEFAULT(3); /* FirstNormalTransactionId */
......
...@@ -14,18 +14,15 @@ ...@@ -14,18 +14,15 @@
{ oid => '100', oid_symbol => 'DEFAULT_COLLATION_OID', { oid => '100', oid_symbol => 'DEFAULT_COLLATION_OID',
descr => 'database\'s default collation', descr => 'database\'s default collation',
collname => 'default', collnamespace => 'PGNSP', collowner => 'PGUID', collname => 'default', collprovider => 'd', collencoding => '-1',
collprovider => 'd', collencoding => '-1', collcollate => '', collcollate => '', collctype => '' },
collctype => '' },
{ oid => '950', oid_symbol => 'C_COLLATION_OID', { oid => '950', oid_symbol => 'C_COLLATION_OID',
descr => 'standard C collation', descr => 'standard C collation',
collname => 'C', collnamespace => 'PGNSP', collowner => 'PGUID', collname => 'C', collprovider => 'c', collencoding => '-1',
collprovider => 'c', collencoding => '-1', collcollate => 'C', collcollate => 'C', collctype => 'C' },
collctype => 'C' },
{ oid => '951', oid_symbol => 'POSIX_COLLATION_OID', { oid => '951', oid_symbol => 'POSIX_COLLATION_OID',
descr => 'standard POSIX collation', descr => 'standard POSIX collation',
collname => 'POSIX', collnamespace => 'PGNSP', collowner => 'PGUID', collname => 'POSIX', collprovider => 'c', collencoding => '-1',
collprovider => 'c', collencoding => '-1', collcollate => 'POSIX', collcollate => 'POSIX', collctype => 'POSIX' },
collctype => 'POSIX' },
] ]
...@@ -30,8 +30,9 @@ CATALOG(pg_collation,3456,CollationRelationId) ...@@ -30,8 +30,9 @@ CATALOG(pg_collation,3456,CollationRelationId)
{ {
Oid oid; /* oid */ Oid oid; /* oid */
NameData collname; /* collation name */ NameData collname; /* collation name */
Oid collnamespace; /* OID of namespace containing collation */ Oid collnamespace BKI_DEFAULT(PGNSP) BKI_LOOKUP(pg_namespace); /* OID of namespace
Oid collowner; /* owner of collation */ * containing collation */
Oid collowner BKI_DEFAULT(PGUID) BKI_LOOKUP(pg_authid); /* owner of collation */
char collprovider; /* see constants below */ char collprovider; /* see constants below */
bool collisdeterministic BKI_DEFAULT(t); bool collisdeterministic BKI_DEFAULT(t);
int32 collencoding; /* encoding for this collation; -1 = "all" */ int32 collencoding; /* encoding for this collation; -1 = "all" */
......
...@@ -46,7 +46,8 @@ CATALOG(pg_constraint,2606,ConstraintRelationId) ...@@ -46,7 +46,8 @@ CATALOG(pg_constraint,2606,ConstraintRelationId)
* conrelid + contypid + conname. * conrelid + contypid + conname.
*/ */
NameData conname; /* name of this constraint */ NameData conname; /* name of this constraint */
Oid connamespace; /* OID of namespace containing constraint */ Oid connamespace BKI_LOOKUP(pg_namespace); /* OID of namespace
* containing constraint */
char contype; /* constraint type; see codes below */ char contype; /* constraint type; see codes below */
bool condeferrable; /* deferrable constraint? */ bool condeferrable; /* deferrable constraint? */
bool condeferred; /* deferred by default? */ bool condeferred; /* deferred by default? */
...@@ -57,7 +58,8 @@ CATALOG(pg_constraint,2606,ConstraintRelationId) ...@@ -57,7 +58,8 @@ CATALOG(pg_constraint,2606,ConstraintRelationId)
* specific relation (this excludes domain constraints and assertions). * specific relation (this excludes domain constraints and assertions).
* Otherwise conrelid is 0 and conkey is NULL. * Otherwise conrelid is 0 and conkey is NULL.
*/ */
Oid conrelid; /* relation this constraint constrains */ Oid conrelid BKI_LOOKUP_OPT(pg_class); /* relation this
* constraint constrains */
/* /*
* contypid links to the pg_type row for a domain if this is a domain * contypid links to the pg_type row for a domain if this is a domain
...@@ -66,7 +68,8 @@ CATALOG(pg_constraint,2606,ConstraintRelationId) ...@@ -66,7 +68,8 @@ CATALOG(pg_constraint,2606,ConstraintRelationId)
* For SQL-style global ASSERTIONs, both conrelid and contypid would be * For SQL-style global ASSERTIONs, both conrelid and contypid would be
* zero. This is not presently supported, however. * zero. This is not presently supported, however.
*/ */
Oid contypid; /* domain this constraint constrains */ Oid contypid BKI_LOOKUP_OPT(pg_type); /* domain this constraint
* constrains */
/* /*
* conindid links to the index supporting the constraint, if any; * conindid links to the index supporting the constraint, if any;
...@@ -76,19 +79,21 @@ CATALOG(pg_constraint,2606,ConstraintRelationId) ...@@ -76,19 +79,21 @@ CATALOG(pg_constraint,2606,ConstraintRelationId)
* columns). Notice that the index is on conrelid in the first case but * columns). Notice that the index is on conrelid in the first case but
* confrelid in the second. * confrelid in the second.
*/ */
Oid conindid; /* index supporting this constraint */ Oid conindid BKI_LOOKUP_OPT(pg_class); /* index supporting this
* constraint */
/* /*
* If this constraint is on a partition inherited from a partitioned * If this constraint is on a partition inherited from a partitioned
* table, this is the OID of the corresponding constraint in the parent. * table, this is the OID of the corresponding constraint in the parent.
*/ */
Oid conparentid; Oid conparentid BKI_LOOKUP_OPT(pg_constraint);
/* /*
* These fields, plus confkey, are only meaningful for a foreign-key * These fields, plus confkey, are only meaningful for a foreign-key
* constraint. Otherwise confrelid is 0 and the char fields are spaces. * constraint. Otherwise confrelid is 0 and the char fields are spaces.
*/ */
Oid confrelid; /* relation referenced by foreign key */ Oid confrelid BKI_LOOKUP_OPT(pg_class); /* relation referenced by
* foreign key */
char confupdtype; /* foreign key's ON UPDATE action */ char confupdtype; /* foreign key's ON UPDATE action */
char confdeltype; /* foreign key's ON DELETE action */ char confdeltype; /* foreign key's ON DELETE action */
char confmatchtype; /* foreign key's match type */ char confmatchtype; /* foreign key's match type */
...@@ -119,25 +124,25 @@ CATALOG(pg_constraint,2606,ConstraintRelationId) ...@@ -119,25 +124,25 @@ CATALOG(pg_constraint,2606,ConstraintRelationId)
* If a foreign key, the OIDs of the PK = FK equality operators for each * If a foreign key, the OIDs of the PK = FK equality operators for each
* column of the constraint * column of the constraint
*/ */
Oid conpfeqop[1]; Oid conpfeqop[1] BKI_LOOKUP(pg_operator);
/* /*
* If a foreign key, the OIDs of the PK = PK equality operators for each * If a foreign key, the OIDs of the PK = PK equality operators for each
* column of the constraint (i.e., equality for the referenced columns) * column of the constraint (i.e., equality for the referenced columns)
*/ */
Oid conppeqop[1]; Oid conppeqop[1] BKI_LOOKUP(pg_operator);
/* /*
* If a foreign key, the OIDs of the FK = FK equality operators for each * If a foreign key, the OIDs of the FK = FK equality operators for each
* column of the constraint (i.e., equality for the referencing columns) * column of the constraint (i.e., equality for the referencing columns)
*/ */
Oid conffeqop[1]; Oid conffeqop[1] BKI_LOOKUP(pg_operator);
/* /*
* If an exclusion constraint, the OIDs of the exclusion operators for * If an exclusion constraint, the OIDs of the exclusion operators for
* each column of the constraint * each column of the constraint
*/ */
Oid conexclop[1]; Oid conexclop[1] BKI_LOOKUP(pg_operator);
/* /*
* If a check constraint, nodeToString representation of expression * If a check constraint, nodeToString representation of expression
...@@ -166,6 +171,10 @@ DECLARE_UNIQUE_INDEX_PKEY(pg_constraint_oid_index, 2667, on pg_constraint using ...@@ -166,6 +171,10 @@ DECLARE_UNIQUE_INDEX_PKEY(pg_constraint_oid_index, 2667, on pg_constraint using
DECLARE_INDEX(pg_constraint_conparentid_index, 2579, on pg_constraint using btree(conparentid oid_ops)); DECLARE_INDEX(pg_constraint_conparentid_index, 2579, on pg_constraint using btree(conparentid oid_ops));
#define ConstraintParentIndexId 2579 #define ConstraintParentIndexId 2579
/* conkey can contain zero (InvalidAttrNumber) if a whole-row Var is used */
DECLARE_ARRAY_FOREIGN_KEY_OPT((conrelid, conkey), pg_attribute, (attrelid, attnum));
DECLARE_ARRAY_FOREIGN_KEY((confrelid, confkey), pg_attribute, (attrelid, attnum));
#ifdef EXPOSE_TO_CLIENT_CODE #ifdef EXPOSE_TO_CLIENT_CODE
/* Valid values for contype */ /* Valid values for contype */
......
...@@ -35,10 +35,10 @@ CATALOG(pg_conversion,2607,ConversionRelationId) ...@@ -35,10 +35,10 @@ CATALOG(pg_conversion,2607,ConversionRelationId)
NameData conname; NameData conname;
/* namespace that the conversion belongs to */ /* namespace that the conversion belongs to */
Oid connamespace BKI_DEFAULT(PGNSP); Oid connamespace BKI_DEFAULT(PGNSP) BKI_LOOKUP(pg_namespace);
/* owner of the conversion */ /* owner of the conversion */
Oid conowner BKI_DEFAULT(PGUID); Oid conowner BKI_DEFAULT(PGUID) BKI_LOOKUP(pg_authid);
/* FOR encoding id */ /* FOR encoding id */
int32 conforencoding BKI_LOOKUP(encoding); int32 conforencoding BKI_LOOKUP(encoding);
......
...@@ -35,7 +35,7 @@ CATALOG(pg_database,1262,DatabaseRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID ...@@ -35,7 +35,7 @@ CATALOG(pg_database,1262,DatabaseRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID
NameData datname; NameData datname;
/* owner of database */ /* owner of database */
Oid datdba BKI_DEFAULT(PGUID); Oid datdba BKI_DEFAULT(PGUID) BKI_LOOKUP(pg_authid);
/* character encoding */ /* character encoding */
int32 encoding; int32 encoding;
......
...@@ -33,8 +33,11 @@ ...@@ -33,8 +33,11 @@
*/ */
CATALOG(pg_db_role_setting,2964,DbRoleSettingRelationId) BKI_SHARED_RELATION CATALOG(pg_db_role_setting,2964,DbRoleSettingRelationId) BKI_SHARED_RELATION
{ {
Oid setdatabase; /* database */ /* database, or 0 for a role-specific setting */
Oid setrole; /* role */ Oid setdatabase BKI_LOOKUP_OPT(pg_database);
/* role, or 0 for a database-specific setting */
Oid setrole BKI_LOOKUP_OPT(pg_authid);
#ifdef CATALOG_VARLEN /* variable-length fields start here */ #ifdef CATALOG_VARLEN /* variable-length fields start here */
text setconfig[1]; /* GUC settings to apply at login */ text setconfig[1]; /* GUC settings to apply at login */
......
...@@ -30,8 +30,10 @@ ...@@ -30,8 +30,10 @@
CATALOG(pg_default_acl,826,DefaultAclRelationId) CATALOG(pg_default_acl,826,DefaultAclRelationId)
{ {
Oid oid; /* oid */ Oid oid; /* oid */
Oid defaclrole; /* OID of role owning this ACL */ Oid defaclrole BKI_LOOKUP(pg_authid); /* OID of role owning this
Oid defaclnamespace; /* OID of namespace, or 0 for all */ * ACL */
Oid defaclnamespace BKI_LOOKUP_OPT(pg_namespace); /* OID of namespace, or
* 0 for all */
char defaclobjtype; /* see DEFACLOBJ_xxx constants below */ char defaclobjtype; /* see DEFACLOBJ_xxx constants below */
#ifdef CATALOG_VARLEN /* variable-length fields start here */ #ifdef CATALOG_VARLEN /* variable-length fields start here */
......
...@@ -45,14 +45,16 @@ CATALOG(pg_depend,2608,DependRelationId) ...@@ -45,14 +45,16 @@ CATALOG(pg_depend,2608,DependRelationId)
* *
* These fields are all zeroes for a DEPENDENCY_PIN entry. * These fields are all zeroes for a DEPENDENCY_PIN entry.
*/ */
Oid classid; /* OID of table containing object */ Oid classid BKI_LOOKUP_OPT(pg_class); /* OID of table containing
* object */
Oid objid; /* OID of object itself */ Oid objid; /* OID of object itself */
int32 objsubid; /* column number, or 0 if not used */ int32 objsubid; /* column number, or 0 if not used */
/* /*
* Identification of the independent (referenced) object. * Identification of the independent (referenced) object.
*/ */
Oid refclassid; /* OID of table containing object */ Oid refclassid BKI_LOOKUP(pg_class); /* OID of table containing
* object */
Oid refobjid; /* OID of object itself */ Oid refobjid; /* OID of object itself */
int32 refobjsubid; /* column number, or 0 if not used */ int32 refobjsubid; /* column number, or 0 if not used */
......
...@@ -68,4 +68,7 @@ DECLARE_TOAST(pg_description, 2834, 2835); ...@@ -68,4 +68,7 @@ DECLARE_TOAST(pg_description, 2834, 2835);
DECLARE_UNIQUE_INDEX_PKEY(pg_description_o_c_o_index, 2675, on pg_description using btree(objoid oid_ops, classoid oid_ops, objsubid int4_ops)); DECLARE_UNIQUE_INDEX_PKEY(pg_description_o_c_o_index, 2675, on pg_description using btree(objoid oid_ops, classoid oid_ops, objsubid int4_ops));
#define DescriptionObjIndexId 2675 #define DescriptionObjIndexId 2675
/* We do not use BKI_LOOKUP here because it causes problems for genbki.pl */
DECLARE_FOREIGN_KEY((classoid), pg_class, (oid));
#endif /* PG_DESCRIPTION_H */ #endif /* PG_DESCRIPTION_H */
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
CATALOG(pg_enum,3501,EnumRelationId) CATALOG(pg_enum,3501,EnumRelationId)
{ {
Oid oid; /* oid */ Oid oid; /* oid */
Oid enumtypid; /* OID of owning enum type */ Oid enumtypid BKI_LOOKUP(pg_type); /* OID of owning enum type */
float4 enumsortorder; /* sort position of this enum value */ float4 enumsortorder; /* sort position of this enum value */
NameData enumlabel; /* text representation of enum value */ NameData enumlabel; /* text representation of enum value */
} FormData_pg_enum; } FormData_pg_enum;
......
...@@ -31,8 +31,9 @@ CATALOG(pg_event_trigger,3466,EventTriggerRelationId) ...@@ -31,8 +31,9 @@ CATALOG(pg_event_trigger,3466,EventTriggerRelationId)
Oid oid; /* oid */ Oid oid; /* oid */
NameData evtname; /* trigger's name */ NameData evtname; /* trigger's name */
NameData evtevent; /* trigger's event */ NameData evtevent; /* trigger's event */
Oid evtowner; /* trigger's owner */ Oid evtowner BKI_LOOKUP(pg_authid); /* trigger's owner */
Oid evtfoid; /* OID of function to be called */ Oid evtfoid BKI_LOOKUP(pg_proc); /* OID of function to be
* called */
char evtenabled; /* trigger's firing configuration WRT char evtenabled; /* trigger's firing configuration WRT
* session_replication_role */ * session_replication_role */
......
...@@ -30,14 +30,16 @@ CATALOG(pg_extension,3079,ExtensionRelationId) ...@@ -30,14 +30,16 @@ CATALOG(pg_extension,3079,ExtensionRelationId)
{ {
Oid oid; /* oid */ Oid oid; /* oid */
NameData extname; /* extension name */ NameData extname; /* extension name */
Oid extowner; /* extension owner */ Oid extowner BKI_LOOKUP(pg_authid); /* extension owner */
Oid extnamespace; /* namespace of contained objects */ Oid extnamespace BKI_LOOKUP(pg_namespace); /* namespace of
* contained objects */
bool extrelocatable; /* if true, allow ALTER EXTENSION SET SCHEMA */ bool extrelocatable; /* if true, allow ALTER EXTENSION SET SCHEMA */
#ifdef CATALOG_VARLEN /* variable-length fields start here */ #ifdef CATALOG_VARLEN /* variable-length fields start here */
/* extversion may never be null, but the others can be. */ /* extversion may never be null, but the others can be. */
text extversion BKI_FORCE_NOT_NULL; /* extension version name */ text extversion BKI_FORCE_NOT_NULL; /* extension version name */
Oid extconfig[1]; /* dumpable configuration tables */ Oid extconfig[1] BKI_LOOKUP(pg_class); /* dumpable configuration
* tables */
text extcondition[1]; /* WHERE clauses for config tables */ text extcondition[1]; /* WHERE clauses for config tables */
#endif #endif
} FormData_pg_extension; } FormData_pg_extension;
......
...@@ -30,9 +30,12 @@ CATALOG(pg_foreign_data_wrapper,2328,ForeignDataWrapperRelationId) ...@@ -30,9 +30,12 @@ CATALOG(pg_foreign_data_wrapper,2328,ForeignDataWrapperRelationId)
{ {
Oid oid; /* oid */ Oid oid; /* oid */
NameData fdwname; /* foreign-data wrapper name */ NameData fdwname; /* foreign-data wrapper name */
Oid fdwowner; /* FDW owner */ Oid fdwowner BKI_LOOKUP(pg_authid); /* FDW owner */
Oid fdwhandler; /* handler function, or 0 if none */ Oid fdwhandler BKI_LOOKUP_OPT(pg_proc); /* handler function, or 0
Oid fdwvalidator; /* option validation function, or 0 if none */ * if none */
Oid fdwvalidator BKI_LOOKUP_OPT(pg_proc); /* option validation
* function, or 0 if
* none */
#ifdef CATALOG_VARLEN /* variable-length fields start here */ #ifdef CATALOG_VARLEN /* variable-length fields start here */
aclitem fdwacl[1]; /* access permissions */ aclitem fdwacl[1]; /* access permissions */
......
...@@ -29,8 +29,8 @@ CATALOG(pg_foreign_server,1417,ForeignServerRelationId) ...@@ -29,8 +29,8 @@ CATALOG(pg_foreign_server,1417,ForeignServerRelationId)
{ {
Oid oid; /* oid */ Oid oid; /* oid */
NameData srvname; /* foreign server name */ NameData srvname; /* foreign server name */
Oid srvowner; /* server owner */ Oid srvowner BKI_LOOKUP(pg_authid); /* server owner */
Oid srvfdw; /* server FDW */ Oid srvfdw BKI_LOOKUP(pg_foreign_data_wrapper); /* server FDW */
#ifdef CATALOG_VARLEN /* variable-length fields start here */ #ifdef CATALOG_VARLEN /* variable-length fields start here */
text srvtype; text srvtype;
......
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
*/ */
CATALOG(pg_foreign_table,3118,ForeignTableRelationId) CATALOG(pg_foreign_table,3118,ForeignTableRelationId)
{ {
Oid ftrelid; /* OID of foreign table */ Oid ftrelid BKI_LOOKUP(pg_class); /* OID of foreign table */
Oid ftserver; /* OID of foreign server */ Oid ftserver BKI_LOOKUP(pg_foreign_server); /* OID of foreign server */
#ifdef CATALOG_VARLEN /* variable-length fields start here */ #ifdef CATALOG_VARLEN /* variable-length fields start here */
text ftoptions[1]; /* FDW-specific options */ text ftoptions[1]; /* FDW-specific options */
......
...@@ -28,8 +28,9 @@ ...@@ -28,8 +28,9 @@
*/ */
CATALOG(pg_index,2610,IndexRelationId) BKI_SCHEMA_MACRO CATALOG(pg_index,2610,IndexRelationId) BKI_SCHEMA_MACRO
{ {
Oid indexrelid; /* OID of the index */ Oid indexrelid BKI_LOOKUP(pg_class); /* OID of the index */
Oid indrelid; /* OID of the relation it indexes */ Oid indrelid BKI_LOOKUP(pg_class); /* OID of the relation it
* indexes */
int16 indnatts; /* total number of columns in index */ int16 indnatts; /* total number of columns in index */
int16 indnkeyatts; /* number of key columns in index */ int16 indnkeyatts; /* number of key columns in index */
bool indisunique; /* is this a unique index? */ bool indisunique; /* is this a unique index? */
...@@ -48,8 +49,8 @@ CATALOG(pg_index,2610,IndexRelationId) BKI_SCHEMA_MACRO ...@@ -48,8 +49,8 @@ CATALOG(pg_index,2610,IndexRelationId) BKI_SCHEMA_MACRO
* or 0 */ * or 0 */
#ifdef CATALOG_VARLEN #ifdef CATALOG_VARLEN
oidvector indcollation BKI_FORCE_NOT_NULL; /* collation identifiers */ oidvector indcollation BKI_LOOKUP_OPT(pg_collation) BKI_FORCE_NOT_NULL; /* collation identifiers */
oidvector indclass BKI_FORCE_NOT_NULL; /* opclass identifiers */ oidvector indclass BKI_LOOKUP(pg_opclass) BKI_FORCE_NOT_NULL; /* opclass identifiers */
int2vector indoption BKI_FORCE_NOT_NULL; /* per-column flags int2vector indoption BKI_FORCE_NOT_NULL; /* per-column flags
* (AM-specific meanings) */ * (AM-specific meanings) */
pg_node_tree indexprs; /* expression trees for index attributes that pg_node_tree indexprs; /* expression trees for index attributes that
...@@ -72,6 +73,9 @@ DECLARE_INDEX(pg_index_indrelid_index, 2678, on pg_index using btree(indrelid oi ...@@ -72,6 +73,9 @@ DECLARE_INDEX(pg_index_indrelid_index, 2678, on pg_index using btree(indrelid oi
DECLARE_UNIQUE_INDEX_PKEY(pg_index_indexrelid_index, 2679, on pg_index using btree(indexrelid oid_ops)); DECLARE_UNIQUE_INDEX_PKEY(pg_index_indexrelid_index, 2679, on pg_index using btree(indexrelid oid_ops));
#define IndexRelidIndexId 2679 #define IndexRelidIndexId 2679
/* indkey can contain zero (InvalidAttrNumber) to represent expressions */
DECLARE_ARRAY_FOREIGN_KEY_OPT((indrelid, indkey), pg_attribute, (attrelid, attnum));
#ifdef EXPOSE_TO_CLIENT_CODE #ifdef EXPOSE_TO_CLIENT_CODE
/* /*
......
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
*/ */
CATALOG(pg_inherits,2611,InheritsRelationId) CATALOG(pg_inherits,2611,InheritsRelationId)
{ {
Oid inhrelid; Oid inhrelid BKI_LOOKUP(pg_class);
Oid inhparent; Oid inhparent BKI_LOOKUP(pg_class);
int32 inhseqno; int32 inhseqno;
} FormData_pg_inherits; } FormData_pg_inherits;
......
...@@ -46,7 +46,8 @@ ...@@ -46,7 +46,8 @@
CATALOG(pg_init_privs,3394,InitPrivsRelationId) CATALOG(pg_init_privs,3394,InitPrivsRelationId)
{ {
Oid objoid; /* OID of object itself */ Oid objoid; /* OID of object itself */
Oid classoid; /* OID of table containing object */ Oid classoid BKI_LOOKUP(pg_class); /* OID of table containing
* object */
int32 objsubid; /* column number, or 0 if not used */ int32 objsubid; /* column number, or 0 if not used */
char privtype; /* from initdb or extension? */ char privtype; /* from initdb or extension? */
......
...@@ -34,7 +34,7 @@ CATALOG(pg_language,2612,LanguageRelationId) ...@@ -34,7 +34,7 @@ CATALOG(pg_language,2612,LanguageRelationId)
NameData lanname; NameData lanname;
/* Language's owner */ /* Language's owner */
Oid lanowner BKI_DEFAULT(PGUID); Oid lanowner BKI_DEFAULT(PGUID) BKI_LOOKUP(pg_authid);
/* Is a procedural language */ /* Is a procedural language */
bool lanispl BKI_DEFAULT(f); bool lanispl BKI_DEFAULT(f);
...@@ -43,13 +43,13 @@ CATALOG(pg_language,2612,LanguageRelationId) ...@@ -43,13 +43,13 @@ CATALOG(pg_language,2612,LanguageRelationId)
bool lanpltrusted BKI_DEFAULT(f); bool lanpltrusted BKI_DEFAULT(f);
/* Call handler, if it's a PL */ /* Call handler, if it's a PL */
Oid lanplcallfoid BKI_DEFAULT(0) BKI_LOOKUP(pg_proc); Oid lanplcallfoid BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_proc);
/* Optional anonymous-block handler function */ /* Optional anonymous-block handler function */
Oid laninline BKI_DEFAULT(0) BKI_LOOKUP(pg_proc); Oid laninline BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_proc);
/* Optional validation function */ /* Optional validation function */
Oid lanvalidator BKI_DEFAULT(0) BKI_LOOKUP(pg_proc); Oid lanvalidator BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_proc);
#ifdef CATALOG_VARLEN /* variable-length fields start here */ #ifdef CATALOG_VARLEN /* variable-length fields start here */
/* Access privileges */ /* Access privileges */
......
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
*/ */
CATALOG(pg_largeobject,2613,LargeObjectRelationId) CATALOG(pg_largeobject,2613,LargeObjectRelationId)
{ {
Oid loid; /* Identifier of large object */ Oid loid BKI_LOOKUP(pg_largeobject_metadata); /* Identifier of large
* object */
int32 pageno; /* Page number (starting from 0) */ int32 pageno; /* Page number (starting from 0) */
/* data has variable length, but we allow direct access; see inv_api.c */ /* data has variable length, but we allow direct access; see inv_api.c */
......
...@@ -31,7 +31,8 @@ CATALOG(pg_largeobject_metadata,2995,LargeObjectMetadataRelationId) ...@@ -31,7 +31,8 @@ CATALOG(pg_largeobject_metadata,2995,LargeObjectMetadataRelationId)
{ {
Oid oid; /* oid */ Oid oid; /* oid */
Oid lomowner; /* OID of the largeobject owner */ Oid lomowner BKI_LOOKUP(pg_authid); /* OID of the largeobject
* owner */
#ifdef CATALOG_VARLEN /* variable-length fields start here */ #ifdef CATALOG_VARLEN /* variable-length fields start here */
aclitem lomacl[1]; /* access permissions */ aclitem lomacl[1]; /* access permissions */
......
...@@ -14,12 +14,12 @@ ...@@ -14,12 +14,12 @@
{ oid => '11', oid_symbol => 'PG_CATALOG_NAMESPACE', { oid => '11', oid_symbol => 'PG_CATALOG_NAMESPACE',
descr => 'system catalog schema', descr => 'system catalog schema',
nspname => 'pg_catalog', nspowner => 'PGUID', nspacl => '_null_' }, nspname => 'pg_catalog', nspacl => '_null_' },
{ oid => '99', oid_symbol => 'PG_TOAST_NAMESPACE', { oid => '99', oid_symbol => 'PG_TOAST_NAMESPACE',
descr => 'reserved schema for TOAST tables', descr => 'reserved schema for TOAST tables',
nspname => 'pg_toast', nspowner => 'PGUID', nspacl => '_null_' }, nspname => 'pg_toast', nspacl => '_null_' },
{ oid => '2200', oid_symbol => 'PG_PUBLIC_NAMESPACE', { oid => '2200', oid_symbol => 'PG_PUBLIC_NAMESPACE',
descr => 'standard public schema', descr => 'standard public schema',
nspname => 'public', nspowner => 'PGUID', nspacl => '_null_' }, nspname => 'public', nspacl => '_null_' },
] ]
...@@ -37,7 +37,7 @@ CATALOG(pg_namespace,2615,NamespaceRelationId) ...@@ -37,7 +37,7 @@ CATALOG(pg_namespace,2615,NamespaceRelationId)
Oid oid; /* oid */ Oid oid; /* oid */
NameData nspname; NameData nspname;
Oid nspowner; Oid nspowner BKI_DEFAULT(PGUID) BKI_LOOKUP(pg_authid);
#ifdef CATALOG_VARLEN /* variable-length fields start here */ #ifdef CATALOG_VARLEN /* variable-length fields start here */
aclitem nspacl[1]; aclitem nspacl[1];
......
...@@ -57,10 +57,10 @@ CATALOG(pg_opclass,2616,OperatorClassRelationId) ...@@ -57,10 +57,10 @@ CATALOG(pg_opclass,2616,OperatorClassRelationId)
NameData opcname; NameData opcname;
/* namespace of this opclass */ /* namespace of this opclass */
Oid opcnamespace BKI_DEFAULT(PGNSP); Oid opcnamespace BKI_DEFAULT(PGNSP) BKI_LOOKUP(pg_namespace);
/* opclass owner */ /* opclass owner */
Oid opcowner BKI_DEFAULT(PGUID); Oid opcowner BKI_DEFAULT(PGUID) BKI_LOOKUP(pg_authid);
/* containing operator family */ /* containing operator family */
Oid opcfamily BKI_LOOKUP(pg_opfamily); Oid opcfamily BKI_LOOKUP(pg_opfamily);
...@@ -71,8 +71,8 @@ CATALOG(pg_opclass,2616,OperatorClassRelationId) ...@@ -71,8 +71,8 @@ CATALOG(pg_opclass,2616,OperatorClassRelationId)
/* T if opclass is default for opcintype */ /* T if opclass is default for opcintype */
bool opcdefault BKI_DEFAULT(t); bool opcdefault BKI_DEFAULT(t);
/* type of data in index, or InvalidOid */ /* type of data in index, or InvalidOid if same as input column type */
Oid opckeytype BKI_DEFAULT(0) BKI_LOOKUP(pg_type); Oid opckeytype BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_type);
} FormData_pg_opclass; } FormData_pg_opclass;
/* ---------------- /* ----------------
......
...@@ -36,10 +36,10 @@ CATALOG(pg_operator,2617,OperatorRelationId) ...@@ -36,10 +36,10 @@ CATALOG(pg_operator,2617,OperatorRelationId)
NameData oprname; NameData oprname;
/* OID of namespace containing this oper */ /* OID of namespace containing this oper */
Oid oprnamespace BKI_DEFAULT(PGNSP); Oid oprnamespace BKI_DEFAULT(PGNSP) BKI_LOOKUP(pg_namespace);
/* operator owner */ /* operator owner */
Oid oprowner BKI_DEFAULT(PGUID); Oid oprowner BKI_DEFAULT(PGUID) BKI_LOOKUP(pg_authid);
/* 'l' for prefix or 'b' for infix */ /* 'l' for prefix or 'b' for infix */
char oprkind BKI_DEFAULT(b); char oprkind BKI_DEFAULT(b);
...@@ -51,28 +51,28 @@ CATALOG(pg_operator,2617,OperatorRelationId) ...@@ -51,28 +51,28 @@ CATALOG(pg_operator,2617,OperatorRelationId)
bool oprcanhash BKI_DEFAULT(f); bool oprcanhash BKI_DEFAULT(f);
/* left arg type, or 0 if prefix operator */ /* left arg type, or 0 if prefix operator */
Oid oprleft BKI_LOOKUP(pg_type); Oid oprleft BKI_LOOKUP_OPT(pg_type);
/* right arg type */ /* right arg type */
Oid oprright BKI_LOOKUP(pg_type); Oid oprright BKI_LOOKUP(pg_type);
/* result datatype */ /* result datatype; can be 0 in a "shell" operator */
Oid oprresult BKI_LOOKUP(pg_type); Oid oprresult BKI_LOOKUP_OPT(pg_type);
/* OID of commutator oper, or 0 if none */ /* OID of commutator oper, or 0 if none */
Oid oprcom BKI_DEFAULT(0) BKI_LOOKUP(pg_operator); Oid oprcom BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_operator);
/* OID of negator oper, or 0 if none */ /* OID of negator oper, or 0 if none */
Oid oprnegate BKI_DEFAULT(0) BKI_LOOKUP(pg_operator); Oid oprnegate BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_operator);
/* OID of underlying function */ /* OID of underlying function; can be 0 in a "shell" operator */
regproc oprcode BKI_LOOKUP(pg_proc); regproc oprcode BKI_LOOKUP_OPT(pg_proc);
/* OID of restriction estimator, or 0 */ /* OID of restriction estimator, or 0 */
regproc oprrest BKI_DEFAULT(-) BKI_LOOKUP(pg_proc); regproc oprrest BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc);
/* OID of join estimator, or 0 */ /* OID of join estimator, or 0 */
regproc oprjoin BKI_DEFAULT(-) BKI_LOOKUP(pg_proc); regproc oprjoin BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc);
} FormData_pg_operator; } FormData_pg_operator;
/* ---------------- /* ----------------
......
...@@ -37,10 +37,10 @@ CATALOG(pg_opfamily,2753,OperatorFamilyRelationId) ...@@ -37,10 +37,10 @@ CATALOG(pg_opfamily,2753,OperatorFamilyRelationId)
NameData opfname; NameData opfname;
/* namespace of this opfamily */ /* namespace of this opfamily */
Oid opfnamespace BKI_DEFAULT(PGNSP); Oid opfnamespace BKI_DEFAULT(PGNSP) BKI_LOOKUP(pg_namespace);
/* opfamily owner */ /* opfamily owner */
Oid opfowner BKI_DEFAULT(PGUID); Oid opfowner BKI_DEFAULT(PGUID) BKI_LOOKUP(pg_authid);
} FormData_pg_opfamily; } FormData_pg_opfamily;
/* ---------------- /* ----------------
......
...@@ -29,11 +29,11 @@ ...@@ -29,11 +29,11 @@
*/ */
CATALOG(pg_partitioned_table,3350,PartitionedRelationId) CATALOG(pg_partitioned_table,3350,PartitionedRelationId)
{ {
Oid partrelid; /* partitioned table oid */ Oid partrelid BKI_LOOKUP(pg_class); /* partitioned table oid */
char partstrat; /* partitioning strategy */ char partstrat; /* partitioning strategy */
int16 partnatts; /* number of partition key columns */ int16 partnatts; /* number of partition key columns */
Oid partdefid; /* default partition oid; InvalidOid if there Oid partdefid BKI_LOOKUP_OPT(pg_class); /* default partition oid;
* isn't one */ * 0 if there isn't one */
/* /*
* variable-length fields start here, but we allow direct access to * variable-length fields start here, but we allow direct access to
...@@ -48,10 +48,10 @@ CATALOG(pg_partitioned_table,3350,PartitionedRelationId) ...@@ -48,10 +48,10 @@ CATALOG(pg_partitioned_table,3350,PartitionedRelationId)
* an expression */ * an expression */
#ifdef CATALOG_VARLEN #ifdef CATALOG_VARLEN
oidvector partclass BKI_FORCE_NOT_NULL; /* operator class to compare oidvector partclass BKI_LOOKUP(pg_opclass) BKI_FORCE_NOT_NULL; /* operator class to
* keys */ * compare keys */
oidvector partcollation BKI_FORCE_NOT_NULL; /* user-specified oidvector partcollation BKI_LOOKUP_OPT(pg_collation) BKI_FORCE_NOT_NULL; /* user-specified
* collation for keys */ * collation for keys */
pg_node_tree partexprs; /* list of expressions in the partition key; pg_node_tree partexprs; /* list of expressions in the partition key;
* one item for each zero entry in partattrs[] */ * one item for each zero entry in partattrs[] */
#endif #endif
...@@ -69,4 +69,7 @@ DECLARE_TOAST(pg_partitioned_table, 4165, 4166); ...@@ -69,4 +69,7 @@ DECLARE_TOAST(pg_partitioned_table, 4165, 4166);
DECLARE_UNIQUE_INDEX_PKEY(pg_partitioned_table_partrelid_index, 3351, on pg_partitioned_table using btree(partrelid oid_ops)); DECLARE_UNIQUE_INDEX_PKEY(pg_partitioned_table_partrelid_index, 3351, on pg_partitioned_table using btree(partrelid oid_ops));
#define PartitionedRelidIndexId 3351 #define PartitionedRelidIndexId 3351
/* partattrs can contain zero (InvalidAttrNumber) to represent expressions */
DECLARE_ARRAY_FOREIGN_KEY_OPT((partrelid, partattrs), pg_attribute, (attrelid, attnum));
#endif /* PG_PARTITIONED_TABLE_H */ #endif /* PG_PARTITIONED_TABLE_H */
...@@ -30,13 +30,14 @@ CATALOG(pg_policy,3256,PolicyRelationId) ...@@ -30,13 +30,14 @@ CATALOG(pg_policy,3256,PolicyRelationId)
{ {
Oid oid; /* oid */ Oid oid; /* oid */
NameData polname; /* Policy name. */ NameData polname; /* Policy name. */
Oid polrelid; /* Oid of the relation with policy. */ Oid polrelid BKI_LOOKUP(pg_class); /* Oid of the relation with
* policy. */
char polcmd; /* One of ACL_*_CHR, or '*' for all */ char polcmd; /* One of ACL_*_CHR, or '*' for all */
bool polpermissive; /* restrictive or permissive policy */ bool polpermissive; /* restrictive or permissive policy */
#ifdef CATALOG_VARLEN #ifdef CATALOG_VARLEN
Oid polroles[1] BKI_FORCE_NOT_NULL; /* Roles associated with /* Roles to which the policy is applied; zero means PUBLIC */
* policy */ Oid polroles[1] BKI_LOOKUP_OPT(pg_authid) BKI_FORCE_NOT_NULL;
pg_node_tree polqual; /* Policy quals. */ pg_node_tree polqual; /* Policy quals. */
pg_node_tree polwithcheck; /* WITH CHECK quals. */ pg_node_tree polwithcheck; /* WITH CHECK quals. */
#endif #endif
......
...@@ -2405,7 +2405,7 @@ ...@@ -2405,7 +2405,7 @@
{ oid => '1215', descr => 'get description for object id and catalog name', { oid => '1215', descr => 'get description for object id and catalog name',
proname => 'obj_description', prolang => 'sql', procost => '100', proname => 'obj_description', prolang => 'sql', procost => '100',
provolatile => 's', prorettype => 'text', proargtypes => 'oid name', provolatile => 's', prorettype => 'text', proargtypes => 'oid name',
prosrc => 'select description from pg_catalog.pg_description where objoid = $1 and classoid = (select oid from pg_catalog.pg_class where relname = $2 and relnamespace = PGNSP) and objsubid = 0' }, prosrc => 'select description from pg_catalog.pg_description where objoid = $1 and classoid = (select oid from pg_catalog.pg_class where relname = $2 and relnamespace = \'pg_catalog\'::pg_catalog.regnamespace) and objsubid = 0' },
{ oid => '1216', descr => 'get description for table column', { oid => '1216', descr => 'get description for table column',
proname => 'col_description', prolang => 'sql', procost => '100', proname => 'col_description', prolang => 'sql', procost => '100',
provolatile => 's', prorettype => 'text', proargtypes => 'oid int4', provolatile => 's', prorettype => 'text', proargtypes => 'oid int4',
...@@ -2414,7 +2414,7 @@ ...@@ -2414,7 +2414,7 @@
descr => 'get description for object id and shared catalog name', descr => 'get description for object id and shared catalog name',
proname => 'shobj_description', prolang => 'sql', procost => '100', proname => 'shobj_description', prolang => 'sql', procost => '100',
provolatile => 's', prorettype => 'text', proargtypes => 'oid name', provolatile => 's', prorettype => 'text', proargtypes => 'oid name',
prosrc => 'select description from pg_catalog.pg_shdescription where objoid = $1 and classoid = (select oid from pg_catalog.pg_class where relname = $2 and relnamespace = PGNSP)' }, prosrc => 'select description from pg_catalog.pg_shdescription where objoid = $1 and classoid = (select oid from pg_catalog.pg_class where relname = $2 and relnamespace = \'pg_catalog\'::pg_catalog.regnamespace)' },
{ oid => '1217', { oid => '1217',
descr => 'truncate timestamp with time zone to specified units', descr => 'truncate timestamp with time zone to specified units',
...@@ -3698,6 +3698,14 @@ ...@@ -3698,6 +3698,14 @@
proargnames => '{word,catcode,barelabel,catdesc,baredesc}', proargnames => '{word,catcode,barelabel,catdesc,baredesc}',
prosrc => 'pg_get_keywords' }, prosrc => 'pg_get_keywords' },
{ oid => '8103', descr => 'list of catalog foreign key relationships',
proname => 'pg_get_catalog_foreign_keys', procost => '10', prorows => '250',
proretset => 't', provolatile => 's', prorettype => 'record',
proargtypes => '', proallargtypes => '{regclass,_text,regclass,_text,bool,bool}',
proargmodes => '{o,o,o,o,o,o}',
proargnames => '{fktable,fkcols,pktable,pkcols,is_array,is_opt}',
prosrc => 'pg_get_catalog_foreign_keys' },
{ oid => '2289', descr => 'convert generic options array to name/value table', { oid => '2289', descr => 'convert generic options array to name/value table',
proname => 'pg_options_to_table', prorows => '3', proretset => 't', proname => 'pg_options_to_table', prorows => '3', proretset => 't',
provolatile => 's', prorettype => 'record', proargtypes => '_text', provolatile => 's', prorettype => 'record', proargtypes => '_text',
......
...@@ -35,10 +35,10 @@ CATALOG(pg_proc,1255,ProcedureRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(81,Proce ...@@ -35,10 +35,10 @@ CATALOG(pg_proc,1255,ProcedureRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(81,Proce
NameData proname; NameData proname;
/* OID of namespace containing this proc */ /* OID of namespace containing this proc */
Oid pronamespace BKI_DEFAULT(PGNSP); Oid pronamespace BKI_DEFAULT(PGNSP) BKI_LOOKUP(pg_namespace);
/* procedure owner */ /* procedure owner */
Oid proowner BKI_DEFAULT(PGUID); Oid proowner BKI_DEFAULT(PGUID) BKI_LOOKUP(pg_authid);
/* OID of pg_language entry */ /* OID of pg_language entry */
Oid prolang BKI_DEFAULT(internal) BKI_LOOKUP(pg_language); Oid prolang BKI_DEFAULT(internal) BKI_LOOKUP(pg_language);
...@@ -49,11 +49,11 @@ CATALOG(pg_proc,1255,ProcedureRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(81,Proce ...@@ -49,11 +49,11 @@ CATALOG(pg_proc,1255,ProcedureRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(81,Proce
/* estimated # of rows out (if proretset) */ /* estimated # of rows out (if proretset) */
float4 prorows BKI_DEFAULT(0); float4 prorows BKI_DEFAULT(0);
/* element type of variadic array, or 0 */ /* element type of variadic array, or 0 if not variadic */
Oid provariadic BKI_DEFAULT(0) BKI_LOOKUP(pg_type); Oid provariadic BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_type);
/* planner support function for this function, or 0 if none */ /* planner support function for this function, or 0 if none */
regproc prosupport BKI_DEFAULT(0) BKI_LOOKUP(pg_proc); regproc prosupport BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_proc);
/* see PROKIND_ categories below */ /* see PROKIND_ categories below */
char prokind BKI_DEFAULT(f); char prokind BKI_DEFAULT(f);
...@@ -109,7 +109,7 @@ CATALOG(pg_proc,1255,ProcedureRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(81,Proce ...@@ -109,7 +109,7 @@ CATALOG(pg_proc,1255,ProcedureRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(81,Proce
pg_node_tree proargdefaults BKI_DEFAULT(_null_); pg_node_tree proargdefaults BKI_DEFAULT(_null_);
/* types for which to apply transforms */ /* types for which to apply transforms */
Oid protrftypes[1] BKI_DEFAULT(_null_); Oid protrftypes[1] BKI_DEFAULT(_null_) BKI_LOOKUP(pg_type);
/* procedure source text */ /* procedure source text */
text prosrc BKI_FORCE_NOT_NULL; text prosrc BKI_FORCE_NOT_NULL;
......
...@@ -32,7 +32,7 @@ CATALOG(pg_publication,6104,PublicationRelationId) ...@@ -32,7 +32,7 @@ CATALOG(pg_publication,6104,PublicationRelationId)
NameData pubname; /* name of the publication */ NameData pubname; /* name of the publication */
Oid pubowner; /* publication owner */ Oid pubowner BKI_LOOKUP(pg_authid); /* publication owner */
/* /*
* indicates that this is special publication which should encompass all * indicates that this is special publication which should encompass all
......
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
CATALOG(pg_publication_rel,6106,PublicationRelRelationId) CATALOG(pg_publication_rel,6106,PublicationRelRelationId)
{ {
Oid oid; /* oid */ Oid oid; /* oid */
Oid prpubid; /* Oid of the publication */ Oid prpubid BKI_LOOKUP(pg_publication); /* Oid of the publication */
Oid prrelid; /* Oid of the relation */ Oid prrelid BKI_LOOKUP(pg_class); /* Oid of the relation */
} FormData_pg_publication_rel; } FormData_pg_publication_rel;
/* ---------------- /* ----------------
......
...@@ -38,16 +38,16 @@ CATALOG(pg_range,3541,RangeRelationId) ...@@ -38,16 +38,16 @@ CATALOG(pg_range,3541,RangeRelationId)
Oid rngmultitypid BKI_LOOKUP(pg_type); Oid rngmultitypid BKI_LOOKUP(pg_type);
/* collation for this range type, or 0 */ /* collation for this range type, or 0 */
Oid rngcollation BKI_DEFAULT(0); Oid rngcollation BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_collation);
/* subtype's btree opclass */ /* subtype's btree opclass */
Oid rngsubopc BKI_LOOKUP(pg_opclass); Oid rngsubopc BKI_LOOKUP(pg_opclass);
/* canonicalize range, or 0 */ /* canonicalize range, or 0 */
regproc rngcanonical BKI_LOOKUP(pg_proc); regproc rngcanonical BKI_LOOKUP_OPT(pg_proc);
/* subtype difference as a float8, or 0 */ /* subtype difference as a float8, or 0 */
regproc rngsubdiff BKI_LOOKUP(pg_proc); regproc rngsubdiff BKI_LOOKUP_OPT(pg_proc);
} FormData_pg_range; } FormData_pg_range;
/* ---------------- /* ----------------
......
...@@ -33,7 +33,7 @@ CATALOG(pg_rewrite,2618,RewriteRelationId) ...@@ -33,7 +33,7 @@ CATALOG(pg_rewrite,2618,RewriteRelationId)
{ {
Oid oid; /* oid */ Oid oid; /* oid */
NameData rulename; NameData rulename;
Oid ev_class; Oid ev_class BKI_LOOKUP(pg_class);
char ev_type; char ev_type;
char ev_enabled; char ev_enabled;
bool is_instead; bool is_instead;
......
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
CATALOG(pg_seclabel,3596,SecLabelRelationId) CATALOG(pg_seclabel,3596,SecLabelRelationId)
{ {
Oid objoid; /* OID of the object itself */ Oid objoid; /* OID of the object itself */
Oid classoid; /* OID of table containing the object */ Oid classoid BKI_LOOKUP(pg_class); /* OID of table containing the
* object */
int32 objsubid; /* column number, or 0 if not used */ int32 objsubid; /* column number, or 0 if not used */
#ifdef CATALOG_VARLEN /* variable-length fields start here */ #ifdef CATALOG_VARLEN /* variable-length fields start here */
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
CATALOG(pg_sequence,2224,SequenceRelationId) CATALOG(pg_sequence,2224,SequenceRelationId)
{ {
Oid seqrelid; Oid seqrelid BKI_LOOKUP(pg_class);
Oid seqtypid; Oid seqtypid BKI_LOOKUP(pg_type);
int64 seqstart; int64 seqstart;
int64 seqincrement; int64 seqincrement;
int64 seqmax; int64 seqmax;
......
...@@ -42,8 +42,10 @@ CATALOG(pg_shdepend,1214,SharedDependRelationId) BKI_SHARED_RELATION ...@@ -42,8 +42,10 @@ CATALOG(pg_shdepend,1214,SharedDependRelationId) BKI_SHARED_RELATION
* These fields are all zeroes for a DEPENDENCY_PIN entry. Also, dbid can * These fields are all zeroes for a DEPENDENCY_PIN entry. Also, dbid can
* be zero to denote a shared object. * be zero to denote a shared object.
*/ */
Oid dbid; /* OID of database containing object */ Oid dbid BKI_LOOKUP_OPT(pg_database); /* OID of database
Oid classid; /* OID of table containing object */ * containing object */
Oid classid BKI_LOOKUP_OPT(pg_class); /* OID of table containing
* object */
Oid objid; /* OID of object itself */ Oid objid; /* OID of object itself */
int32 objsubid; /* column number, or 0 if not used */ int32 objsubid; /* column number, or 0 if not used */
...@@ -52,7 +54,8 @@ CATALOG(pg_shdepend,1214,SharedDependRelationId) BKI_SHARED_RELATION ...@@ -52,7 +54,8 @@ CATALOG(pg_shdepend,1214,SharedDependRelationId) BKI_SHARED_RELATION
* a shared object, so we need no database ID field. We don't bother with * a shared object, so we need no database ID field. We don't bother with
* a sub-object ID either. * a sub-object ID either.
*/ */
Oid refclassid; /* OID of table containing object */ Oid refclassid BKI_LOOKUP(pg_class); /* OID of table containing
* object */
Oid refobjid; /* OID of object itself */ Oid refobjid; /* OID of object itself */
/* /*
......
...@@ -62,4 +62,7 @@ DECLARE_TOAST(pg_shdescription, 2846, 2847); ...@@ -62,4 +62,7 @@ DECLARE_TOAST(pg_shdescription, 2846, 2847);
DECLARE_UNIQUE_INDEX_PKEY(pg_shdescription_o_c_index, 2397, on pg_shdescription using btree(objoid oid_ops, classoid oid_ops)); DECLARE_UNIQUE_INDEX_PKEY(pg_shdescription_o_c_index, 2397, on pg_shdescription using btree(objoid oid_ops, classoid oid_ops));
#define SharedDescriptionObjIndexId 2397 #define SharedDescriptionObjIndexId 2397
/* We do not use BKI_LOOKUP here because it causes problems for genbki.pl */
DECLARE_FOREIGN_KEY((classoid), pg_class, (oid));
#endif /* PG_SHDESCRIPTION_H */ #endif /* PG_SHDESCRIPTION_H */
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
CATALOG(pg_shseclabel,3592,SharedSecLabelRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(4066,SharedSecLabelRelation_Rowtype_Id) BKI_SCHEMA_MACRO CATALOG(pg_shseclabel,3592,SharedSecLabelRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(4066,SharedSecLabelRelation_Rowtype_Id) BKI_SCHEMA_MACRO
{ {
Oid objoid; /* OID of the shared object itself */ Oid objoid; /* OID of the shared object itself */
Oid classoid; /* OID of table containing the shared object */ Oid classoid BKI_LOOKUP(pg_class); /* OID of table containing the
* shared object */
#ifdef CATALOG_VARLEN /* variable-length fields start here */ #ifdef CATALOG_VARLEN /* variable-length fields start here */
text provider BKI_FORCE_NOT_NULL; /* name of label provider */ text provider BKI_FORCE_NOT_NULL; /* name of label provider */
......
...@@ -29,7 +29,8 @@ ...@@ -29,7 +29,8 @@
CATALOG(pg_statistic,2619,StatisticRelationId) CATALOG(pg_statistic,2619,StatisticRelationId)
{ {
/* These fields form the unique key for the entry: */ /* These fields form the unique key for the entry: */
Oid starelid; /* relation containing attribute */ Oid starelid BKI_LOOKUP(pg_class); /* relation containing
* attribute */
int16 staattnum; /* attribute (column) stats are for */ int16 staattnum; /* attribute (column) stats are for */
bool stainherit; /* true if inheritance children are included */ bool stainherit; /* true if inheritance children are included */
...@@ -90,17 +91,17 @@ CATALOG(pg_statistic,2619,StatisticRelationId) ...@@ -90,17 +91,17 @@ CATALOG(pg_statistic,2619,StatisticRelationId)
int16 stakind4; int16 stakind4;
int16 stakind5; int16 stakind5;
Oid staop1; Oid staop1 BKI_LOOKUP_OPT(pg_operator);
Oid staop2; Oid staop2 BKI_LOOKUP_OPT(pg_operator);
Oid staop3; Oid staop3 BKI_LOOKUP_OPT(pg_operator);
Oid staop4; Oid staop4 BKI_LOOKUP_OPT(pg_operator);
Oid staop5; Oid staop5 BKI_LOOKUP_OPT(pg_operator);
Oid stacoll1; Oid stacoll1 BKI_LOOKUP_OPT(pg_collation);
Oid stacoll2; Oid stacoll2 BKI_LOOKUP_OPT(pg_collation);
Oid stacoll3; Oid stacoll3 BKI_LOOKUP_OPT(pg_collation);
Oid stacoll4; Oid stacoll4 BKI_LOOKUP_OPT(pg_collation);
Oid stacoll5; Oid stacoll5 BKI_LOOKUP_OPT(pg_collation);
#ifdef CATALOG_VARLEN /* variable-length fields start here */ #ifdef CATALOG_VARLEN /* variable-length fields start here */
float4 stanumbers1[1]; float4 stanumbers1[1];
...@@ -138,6 +139,8 @@ DECLARE_TOAST(pg_statistic, 2840, 2841); ...@@ -138,6 +139,8 @@ DECLARE_TOAST(pg_statistic, 2840, 2841);
DECLARE_UNIQUE_INDEX_PKEY(pg_statistic_relid_att_inh_index, 2696, on pg_statistic using btree(starelid oid_ops, staattnum int2_ops, stainherit bool_ops)); DECLARE_UNIQUE_INDEX_PKEY(pg_statistic_relid_att_inh_index, 2696, on pg_statistic using btree(starelid oid_ops, staattnum int2_ops, stainherit bool_ops));
#define StatisticRelidAttnumInhIndexId 2696 #define StatisticRelidAttnumInhIndexId 2696
DECLARE_FOREIGN_KEY((starelid, staattnum), pg_attribute, (attrelid, attnum));
#ifdef EXPOSE_TO_CLIENT_CODE #ifdef EXPOSE_TO_CLIENT_CODE
/* /*
......
...@@ -34,13 +34,15 @@ CATALOG(pg_statistic_ext,3381,StatisticExtRelationId) ...@@ -34,13 +34,15 @@ CATALOG(pg_statistic_ext,3381,StatisticExtRelationId)
{ {
Oid oid; /* oid */ Oid oid; /* oid */
Oid stxrelid; /* relation containing attributes */ Oid stxrelid BKI_LOOKUP(pg_class); /* relation containing
* attributes */
/* These two fields form the unique key for the entry: */ /* These two fields form the unique key for the entry: */
NameData stxname; /* statistics object name */ NameData stxname; /* statistics object name */
Oid stxnamespace; /* OID of statistics object's namespace */ Oid stxnamespace BKI_LOOKUP(pg_namespace); /* OID of statistics
* object's namespace */
Oid stxowner; /* statistics object's owner */ Oid stxowner BKI_LOOKUP(pg_authid); /* statistics object's owner */
int32 stxstattarget BKI_DEFAULT(-1); /* statistics target */ int32 stxstattarget BKI_DEFAULT(-1); /* statistics target */
/* /*
...@@ -72,6 +74,8 @@ DECLARE_UNIQUE_INDEX(pg_statistic_ext_name_index, 3997, on pg_statistic_ext usin ...@@ -72,6 +74,8 @@ DECLARE_UNIQUE_INDEX(pg_statistic_ext_name_index, 3997, on pg_statistic_ext usin
DECLARE_INDEX(pg_statistic_ext_relid_index, 3379, on pg_statistic_ext using btree(stxrelid oid_ops)); DECLARE_INDEX(pg_statistic_ext_relid_index, 3379, on pg_statistic_ext using btree(stxrelid oid_ops));
#define StatisticExtRelidIndexId 3379 #define StatisticExtRelidIndexId 3379
DECLARE_ARRAY_FOREIGN_KEY((stxrelid, stxkeys), pg_attribute, (attrelid, attnum));
#ifdef EXPOSE_TO_CLIENT_CODE #ifdef EXPOSE_TO_CLIENT_CODE
#define STATS_EXT_NDISTINCT 'd' #define STATS_EXT_NDISTINCT 'd'
......
...@@ -30,7 +30,8 @@ ...@@ -30,7 +30,8 @@
*/ */
CATALOG(pg_statistic_ext_data,3429,StatisticExtDataRelationId) CATALOG(pg_statistic_ext_data,3429,StatisticExtDataRelationId)
{ {
Oid stxoid; /* statistics object this data is for */ Oid stxoid BKI_LOOKUP(pg_statistic_ext); /* statistics object
* this data is for */
#ifdef CATALOG_VARLEN /* variable-length fields start here */ #ifdef CATALOG_VARLEN /* variable-length fields start here */
......
...@@ -40,10 +40,11 @@ CATALOG(pg_subscription,6100,SubscriptionRelationId) BKI_SHARED_RELATION BKI_ROW ...@@ -40,10 +40,11 @@ CATALOG(pg_subscription,6100,SubscriptionRelationId) BKI_SHARED_RELATION BKI_ROW
{ {
Oid oid; /* oid */ Oid oid; /* oid */
Oid subdbid; /* Database the subscription is in. */ Oid subdbid BKI_LOOKUP(pg_database); /* Database the
* subscription is in. */
NameData subname; /* Name of the subscription */ NameData subname; /* Name of the subscription */
Oid subowner; /* Owner of the subscription */ Oid subowner BKI_LOOKUP(pg_authid); /* Owner of the subscription */
bool subenabled; /* True if the subscription is enabled (the bool subenabled; /* True if the subscription is enabled (the
* worker should be running) */ * worker should be running) */
......
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
*/ */
CATALOG(pg_subscription_rel,6102,SubscriptionRelRelationId) CATALOG(pg_subscription_rel,6102,SubscriptionRelRelationId)
{ {
Oid srsubid; /* Oid of subscription */ Oid srsubid BKI_LOOKUP(pg_subscription); /* Oid of subscription */
Oid srrelid; /* Oid of relation */ Oid srrelid BKI_LOOKUP(pg_class); /* Oid of relation */
char srsubstate; /* state of the relation in subscription */ char srsubstate; /* state of the relation in subscription */
/* /*
......
...@@ -13,10 +13,8 @@ ...@@ -13,10 +13,8 @@
[ [
{ oid => '1663', oid_symbol => 'DEFAULTTABLESPACE_OID', { oid => '1663', oid_symbol => 'DEFAULTTABLESPACE_OID',
spcname => 'pg_default', spcowner => 'PGUID', spcacl => '_null_', spcname => 'pg_default', spcacl => '_null_', spcoptions => '_null_' },
spcoptions => '_null_' },
{ oid => '1664', oid_symbol => 'GLOBALTABLESPACE_OID', { oid => '1664', oid_symbol => 'GLOBALTABLESPACE_OID',
spcname => 'pg_global', spcowner => 'PGUID', spcacl => '_null_', spcname => 'pg_global', spcacl => '_null_', spcoptions => '_null_' },
spcoptions => '_null_' },
] ]
...@@ -30,7 +30,7 @@ CATALOG(pg_tablespace,1213,TableSpaceRelationId) BKI_SHARED_RELATION ...@@ -30,7 +30,7 @@ CATALOG(pg_tablespace,1213,TableSpaceRelationId) BKI_SHARED_RELATION
{ {
Oid oid; /* oid */ Oid oid; /* oid */
NameData spcname; /* tablespace name */ NameData spcname; /* tablespace name */
Oid spcowner; /* owner of tablespace */ Oid spcowner BKI_DEFAULT(PGUID) BKI_LOOKUP(pg_authid); /* owner of tablespace */
#ifdef CATALOG_VARLEN /* variable-length fields start here */ #ifdef CATALOG_VARLEN /* variable-length fields start here */
aclitem spcacl[1]; /* access permissions */ aclitem spcacl[1]; /* access permissions */
......
...@@ -29,10 +29,10 @@ ...@@ -29,10 +29,10 @@
CATALOG(pg_transform,3576,TransformRelationId) CATALOG(pg_transform,3576,TransformRelationId)
{ {
Oid oid; /* oid */ Oid oid; /* oid */
Oid trftype; Oid trftype BKI_LOOKUP(pg_type);
Oid trflang; Oid trflang BKI_LOOKUP(pg_language);
regproc trffromsql; regproc trffromsql BKI_LOOKUP_OPT(pg_proc);
regproc trftosql; regproc trftosql BKI_LOOKUP_OPT(pg_proc);
} FormData_pg_transform; } FormData_pg_transform;
/* ---------------- /* ----------------
......
...@@ -34,18 +34,25 @@ ...@@ -34,18 +34,25 @@
CATALOG(pg_trigger,2620,TriggerRelationId) CATALOG(pg_trigger,2620,TriggerRelationId)
{ {
Oid oid; /* oid */ Oid oid; /* oid */
Oid tgrelid; /* relation trigger is attached to */ Oid tgrelid BKI_LOOKUP(pg_class); /* relation trigger is
Oid tgparentid; /* OID of parent trigger, if any */ * attached to */
Oid tgparentid BKI_LOOKUP_OPT(pg_trigger); /* OID of parent
* trigger, if any */
NameData tgname; /* trigger's name */ NameData tgname; /* trigger's name */
Oid tgfoid; /* OID of function to be called */ Oid tgfoid BKI_LOOKUP(pg_proc); /* OID of function to be called */
int16 tgtype; /* BEFORE/AFTER/INSTEAD, UPDATE/DELETE/INSERT, int16 tgtype; /* BEFORE/AFTER/INSTEAD, UPDATE/DELETE/INSERT,
* ROW/STATEMENT; see below */ * ROW/STATEMENT; see below */
char tgenabled; /* trigger's firing configuration WRT char tgenabled; /* trigger's firing configuration WRT
* session_replication_role */ * session_replication_role */
bool tgisinternal; /* trigger is system-generated */ bool tgisinternal; /* trigger is system-generated */
Oid tgconstrrelid; /* constraint's FROM table, if any */ Oid tgconstrrelid BKI_LOOKUP_OPT(pg_class); /* constraint's FROM
Oid tgconstrindid; /* constraint's supporting index, if any */ * table, if any */
Oid tgconstraint; /* associated pg_constraint entry, if any */ Oid tgconstrindid BKI_LOOKUP_OPT(pg_class); /* constraint's
* supporting index, if
* any */
Oid tgconstraint BKI_LOOKUP_OPT(pg_constraint); /* associated
* pg_constraint entry,
* if any */
bool tgdeferrable; /* constraint trigger is deferrable */ bool tgdeferrable; /* constraint trigger is deferrable */
bool tginitdeferred; /* constraint trigger is deferred initially */ bool tginitdeferred; /* constraint trigger is deferred initially */
int16 tgnargs; /* # of extra arguments in tgargs */ int16 tgnargs; /* # of extra arguments in tgargs */
...@@ -81,6 +88,8 @@ DECLARE_UNIQUE_INDEX(pg_trigger_tgrelid_tgname_index, 2701, on pg_trigger using ...@@ -81,6 +88,8 @@ DECLARE_UNIQUE_INDEX(pg_trigger_tgrelid_tgname_index, 2701, on pg_trigger using
DECLARE_UNIQUE_INDEX_PKEY(pg_trigger_oid_index, 2702, on pg_trigger using btree(oid oid_ops)); DECLARE_UNIQUE_INDEX_PKEY(pg_trigger_oid_index, 2702, on pg_trigger using btree(oid oid_ops));
#define TriggerOidIndexId 2702 #define TriggerOidIndexId 2702
DECLARE_ARRAY_FOREIGN_KEY((tgrelid, tgattr), pg_attribute, (attrelid, attnum));
#ifdef EXPOSE_TO_CLIENT_CODE #ifdef EXPOSE_TO_CLIENT_CODE
/* Bits within tgtype */ /* Bits within tgtype */
......
...@@ -36,10 +36,10 @@ CATALOG(pg_ts_config,3602,TSConfigRelationId) ...@@ -36,10 +36,10 @@ CATALOG(pg_ts_config,3602,TSConfigRelationId)
NameData cfgname; NameData cfgname;
/* name space */ /* name space */
Oid cfgnamespace BKI_DEFAULT(PGNSP); Oid cfgnamespace BKI_DEFAULT(PGNSP) BKI_LOOKUP(pg_namespace);
/* owner */ /* owner */
Oid cfgowner BKI_DEFAULT(PGUID); Oid cfgowner BKI_DEFAULT(PGUID) BKI_LOOKUP(pg_authid);
/* OID of parser */ /* OID of parser */
Oid cfgparser BKI_LOOKUP(pg_ts_parser); Oid cfgparser BKI_LOOKUP(pg_ts_parser);
......
...@@ -35,10 +35,10 @@ CATALOG(pg_ts_dict,3600,TSDictionaryRelationId) ...@@ -35,10 +35,10 @@ CATALOG(pg_ts_dict,3600,TSDictionaryRelationId)
NameData dictname; NameData dictname;
/* name space */ /* name space */
Oid dictnamespace BKI_DEFAULT(PGNSP); Oid dictnamespace BKI_DEFAULT(PGNSP) BKI_LOOKUP(pg_namespace);
/* owner */ /* owner */
Oid dictowner BKI_DEFAULT(PGUID); Oid dictowner BKI_DEFAULT(PGUID) BKI_LOOKUP(pg_authid);
/* dictionary's template */ /* dictionary's template */
Oid dicttemplate BKI_LOOKUP(pg_ts_template); Oid dicttemplate BKI_LOOKUP(pg_ts_template);
......
...@@ -34,7 +34,7 @@ CATALOG(pg_ts_parser,3601,TSParserRelationId) ...@@ -34,7 +34,7 @@ CATALOG(pg_ts_parser,3601,TSParserRelationId)
NameData prsname; NameData prsname;
/* name space */ /* name space */
Oid prsnamespace BKI_DEFAULT(PGNSP); Oid prsnamespace BKI_DEFAULT(PGNSP) BKI_LOOKUP(pg_namespace);
/* init parsing session */ /* init parsing session */
regproc prsstart BKI_LOOKUP(pg_proc); regproc prsstart BKI_LOOKUP(pg_proc);
...@@ -46,7 +46,7 @@ CATALOG(pg_ts_parser,3601,TSParserRelationId) ...@@ -46,7 +46,7 @@ CATALOG(pg_ts_parser,3601,TSParserRelationId)
regproc prsend BKI_LOOKUP(pg_proc); regproc prsend BKI_LOOKUP(pg_proc);
/* return data for headline creation */ /* return data for headline creation */
regproc prsheadline BKI_LOOKUP(pg_proc); regproc prsheadline BKI_LOOKUP_OPT(pg_proc);
/* return descriptions of lexeme's types */ /* return descriptions of lexeme's types */
regproc prslextype BKI_LOOKUP(pg_proc); regproc prslextype BKI_LOOKUP(pg_proc);
......
...@@ -34,10 +34,10 @@ CATALOG(pg_ts_template,3764,TSTemplateRelationId) ...@@ -34,10 +34,10 @@ CATALOG(pg_ts_template,3764,TSTemplateRelationId)
NameData tmplname; NameData tmplname;
/* name space */ /* name space */
Oid tmplnamespace BKI_DEFAULT(PGNSP); Oid tmplnamespace BKI_DEFAULT(PGNSP) BKI_LOOKUP(pg_namespace);
/* initialization method of dict (may be 0) */ /* initialization method of dict (may be 0) */
regproc tmplinit BKI_LOOKUP(pg_proc); regproc tmplinit BKI_LOOKUP_OPT(pg_proc);
/* base method of dictionary */ /* base method of dictionary */
regproc tmpllexize BKI_LOOKUP(pg_proc); regproc tmpllexize BKI_LOOKUP(pg_proc);
......
...@@ -41,10 +41,10 @@ CATALOG(pg_type,1247,TypeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71,TypeRelati ...@@ -41,10 +41,10 @@ CATALOG(pg_type,1247,TypeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71,TypeRelati
NameData typname; NameData typname;
/* OID of namespace containing this type */ /* OID of namespace containing this type */
Oid typnamespace BKI_DEFAULT(PGNSP); Oid typnamespace BKI_DEFAULT(PGNSP) BKI_LOOKUP(pg_namespace);
/* type owner */ /* type owner */
Oid typowner BKI_DEFAULT(PGUID); Oid typowner BKI_DEFAULT(PGUID) BKI_LOOKUP(pg_authid);
/* /*
* For a fixed-size type, typlen is the number of bytes we use to * For a fixed-size type, typlen is the number of bytes we use to
...@@ -98,7 +98,7 @@ CATALOG(pg_type,1247,TypeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71,TypeRelati ...@@ -98,7 +98,7 @@ CATALOG(pg_type,1247,TypeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71,TypeRelati
char typdelim BKI_DEFAULT(','); char typdelim BKI_DEFAULT(',');
/* associated pg_class OID if a composite type, else 0 */ /* associated pg_class OID if a composite type, else 0 */
Oid typrelid BKI_DEFAULT(0) BKI_ARRAY_DEFAULT(0) BKI_LOOKUP(pg_class); Oid typrelid BKI_DEFAULT(0) BKI_ARRAY_DEFAULT(0) BKI_LOOKUP_OPT(pg_class);
/* /*
* Type-specific subscripting handler. If typsubscript is 0, it means * Type-specific subscripting handler. If typsubscript is 0, it means
...@@ -106,7 +106,7 @@ CATALOG(pg_type,1247,TypeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71,TypeRelati ...@@ -106,7 +106,7 @@ CATALOG(pg_type,1247,TypeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71,TypeRelati
* of the system deem types to be "true" array types only if their * of the system deem types to be "true" array types only if their
* typsubscript is array_subscript_handler. * typsubscript is array_subscript_handler.
*/ */
regproc typsubscript BKI_DEFAULT(-) BKI_ARRAY_DEFAULT(array_subscript_handler) BKI_LOOKUP(pg_proc); regproc typsubscript BKI_DEFAULT(-) BKI_ARRAY_DEFAULT(array_subscript_handler) BKI_LOOKUP_OPT(pg_proc);
/* /*
* If typelem is not 0 then it identifies another row in pg_type, defining * If typelem is not 0 then it identifies another row in pg_type, defining
...@@ -117,13 +117,13 @@ CATALOG(pg_type,1247,TypeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71,TypeRelati ...@@ -117,13 +117,13 @@ CATALOG(pg_type,1247,TypeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71,TypeRelati
* of the element type in this type; so DDL changes on the element type * of the element type in this type; so DDL changes on the element type
* might be restricted by the presence of this type. * might be restricted by the presence of this type.
*/ */
Oid typelem BKI_DEFAULT(0) BKI_LOOKUP(pg_type); Oid typelem BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_type);
/* /*
* If there is a "true" array type having this type as element type, * If there is a "true" array type having this type as element type,
* typarray links to it. Zero if no associated "true" array type. * typarray links to it. Zero if no associated "true" array type.
*/ */
Oid typarray BKI_DEFAULT(0) BKI_ARRAY_DEFAULT(0) BKI_LOOKUP(pg_type); Oid typarray BKI_DEFAULT(0) BKI_ARRAY_DEFAULT(0) BKI_LOOKUP_OPT(pg_type);
/* /*
* I/O conversion procedures for the datatype. * I/O conversion procedures for the datatype.
...@@ -134,19 +134,19 @@ CATALOG(pg_type,1247,TypeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71,TypeRelati ...@@ -134,19 +134,19 @@ CATALOG(pg_type,1247,TypeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71,TypeRelati
regproc typoutput BKI_ARRAY_DEFAULT(array_out) BKI_LOOKUP(pg_proc); regproc typoutput BKI_ARRAY_DEFAULT(array_out) BKI_LOOKUP(pg_proc);
/* binary format (optional) */ /* binary format (optional) */
regproc typreceive BKI_ARRAY_DEFAULT(array_recv) BKI_LOOKUP(pg_proc); regproc typreceive BKI_ARRAY_DEFAULT(array_recv) BKI_LOOKUP_OPT(pg_proc);
regproc typsend BKI_ARRAY_DEFAULT(array_send) BKI_LOOKUP(pg_proc); regproc typsend BKI_ARRAY_DEFAULT(array_send) BKI_LOOKUP_OPT(pg_proc);
/* /*
* I/O functions for optional type modifiers. * I/O functions for optional type modifiers.
*/ */
regproc typmodin BKI_DEFAULT(-) BKI_LOOKUP(pg_proc); regproc typmodin BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc);
regproc typmodout BKI_DEFAULT(-) BKI_LOOKUP(pg_proc); regproc typmodout BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc);
/* /*
* Custom ANALYZE procedure for the datatype (0 selects the default). * Custom ANALYZE procedure for the datatype (0 selects the default).
*/ */
regproc typanalyze BKI_DEFAULT(-) BKI_ARRAY_DEFAULT(array_typanalyze) BKI_LOOKUP(pg_proc); regproc typanalyze BKI_DEFAULT(-) BKI_ARRAY_DEFAULT(array_typanalyze) BKI_LOOKUP_OPT(pg_proc);
/* ---------------- /* ----------------
* typalign is the alignment required when storing a value of this * typalign is the alignment required when storing a value of this
...@@ -205,7 +205,7 @@ CATALOG(pg_type,1247,TypeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71,TypeRelati ...@@ -205,7 +205,7 @@ CATALOG(pg_type,1247,TypeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71,TypeRelati
* Domains use typbasetype to show the base (or domain) type that the * Domains use typbasetype to show the base (or domain) type that the
* domain is based on. Zero if the type is not a domain. * domain is based on. Zero if the type is not a domain.
*/ */
Oid typbasetype BKI_DEFAULT(0); Oid typbasetype BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_type);
/* /*
* Domains use typtypmod to record the typmod to be applied to their base * Domains use typtypmod to record the typmod to be applied to their base
...@@ -225,7 +225,7 @@ CATALOG(pg_type,1247,TypeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71,TypeRelati ...@@ -225,7 +225,7 @@ CATALOG(pg_type,1247,TypeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71,TypeRelati
* DEFAULT_COLLATION_OID) for collatable base types, possibly some other * DEFAULT_COLLATION_OID) for collatable base types, possibly some other
* OID for domains over collatable types * OID for domains over collatable types
*/ */
Oid typcollation BKI_DEFAULT(0) BKI_LOOKUP(pg_collation); Oid typcollation BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_collation);
#ifdef CATALOG_VARLEN /* variable-length fields start here */ #ifdef CATALOG_VARLEN /* variable-length fields start here */
......
...@@ -29,9 +29,11 @@ CATALOG(pg_user_mapping,1418,UserMappingRelationId) ...@@ -29,9 +29,11 @@ CATALOG(pg_user_mapping,1418,UserMappingRelationId)
{ {
Oid oid; /* oid */ Oid oid; /* oid */
Oid umuser; /* Id of the user, InvalidOid if PUBLIC is Oid umuser BKI_LOOKUP_OPT(pg_authid); /* Id of the user,
* wanted */ * InvalidOid if PUBLIC is
Oid umserver; /* server of this mapping */ * wanted */
Oid umserver BKI_LOOKUP(pg_foreign_server); /* server of this
* mapping */
#ifdef CATALOG_VARLEN /* variable-length fields start here */ #ifdef CATALOG_VARLEN /* variable-length fields start here */
text umoptions[1]; /* user mapping options */ text umoptions[1]; /* user mapping options */
......
This diff is collapsed.
...@@ -29,7 +29,7 @@ test: strings numerology point lseg line box path polygon circle date time timet ...@@ -29,7 +29,7 @@ test: strings numerology point lseg line box path polygon circle date time timet
# geometry depends on point, lseg, box, path, polygon and circle # geometry depends on point, lseg, box, path, polygon and circle
# horology depends on interval, timetz, timestamp, timestamptz # horology depends on interval, timetz, timestamp, timestamptz
# ---------- # ----------
test: geometry horology regex oidjoins type_sanity opr_sanity misc_sanity comments expressions unicode xid test: geometry horology regex type_sanity opr_sanity misc_sanity comments expressions unicode xid
# ---------- # ----------
# These four each depend on the previous one # These four each depend on the previous one
...@@ -117,7 +117,8 @@ test: plancache limit plpgsql copy2 temp domain rangefuncs prepare conversion tr ...@@ -117,7 +117,8 @@ test: plancache limit plpgsql copy2 temp domain rangefuncs prepare conversion tr
test: partition_join partition_prune reloptions hash_part indexing partition_aggregate partition_info tuplesort explain test: partition_join partition_prune reloptions hash_part indexing partition_aggregate partition_info tuplesort explain
# event triggers cannot run concurrently with any test that runs DDL # event triggers cannot run concurrently with any test that runs DDL
test: event_trigger # oidjoins is read-only, though, and should run late for best coverage
test: event_trigger oidjoins
# this test also uses event triggers, so likewise run it by itself # this test also uses event triggers, so likewise run it by itself
test: fast_default test: fast_default
......
...@@ -45,7 +45,6 @@ test: tstypes ...@@ -45,7 +45,6 @@ test: tstypes
test: geometry test: geometry
test: horology test: horology
test: regex test: regex
test: oidjoins
test: type_sanity test: type_sanity
test: opr_sanity test: opr_sanity
test: misc_sanity test: misc_sanity
...@@ -201,5 +200,6 @@ test: partition_info ...@@ -201,5 +200,6 @@ test: partition_info
test: tuplesort test: tuplesort
test: explain test: explain
test: event_trigger test: event_trigger
test: oidjoins
test: fast_default test: fast_default
test: stats test: stats
This diff is collapsed.
...@@ -818,6 +818,9 @@ EOF ...@@ -818,6 +818,9 @@ EOF
copyFile( copyFile(
'src/backend/catalog/schemapg.h', 'src/backend/catalog/schemapg.h',
'src/include/catalog/schemapg.h'); 'src/include/catalog/schemapg.h');
copyFile(
'src/backend/catalog/system_fk_info.h',
'src/include/catalog/system_fk_info.h');
open(my $chs, '>', 'src/include/catalog/header-stamp') open(my $chs, '>', 'src/include/catalog/header-stamp')
|| confess "Could not touch header-stamp"; || confess "Could not touch header-stamp";
close($chs); close($chs);
......
...@@ -47,6 +47,7 @@ if exist src\include\utils\fmgrprotos.h del /q src\include\utils\fmgrprotos.h ...@@ -47,6 +47,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\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\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\schemapg.h del /q src\include\catalog\schemapg.h
if exist src\include\catalog\system_fk_info.h del /q src\include\catalog\system_fk_info.h
if exist src\include\catalog\pg_*_d.h del /q src\include\catalog\pg_*_d.h if exist src\include\catalog\pg_*_d.h del /q src\include\catalog\pg_*_d.h
if exist src\include\catalog\header-stamp del /q src\include\catalog\header-stamp if exist src\include\catalog\header-stamp del /q src\include\catalog\header-stamp
if exist doc\src\sgml\version.sgml del /q doc\src\sgml\version.sgml if exist doc\src\sgml\version.sgml del /q doc\src\sgml\version.sgml
...@@ -73,6 +74,7 @@ if %DIST%==1 if exist src\interfaces\ecpg\preproc\preproc.y del /q src\interface ...@@ -73,6 +74,7 @@ if %DIST%==1 if exist src\interfaces\ecpg\preproc\preproc.y del /q src\interface
if %DIST%==1 if exist src\backend\catalog\postgres.bki del /q src\backend\catalog\postgres.bki if %DIST%==1 if exist src\backend\catalog\postgres.bki del /q src\backend\catalog\postgres.bki
if %DIST%==1 if exist src\backend\catalog\system_constraints.sql del /q src\backend\catalog\system_constraints.sql if %DIST%==1 if exist src\backend\catalog\system_constraints.sql del /q src\backend\catalog\system_constraints.sql
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\schemapg.h del /q src\backend\catalog\schemapg.h
if %DIST%==1 if exist src\backend\catalog\system_fk_info.h del /q src\backend\catalog\system_fk_info.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\catalog\pg_*_d.h del /q src\backend\catalog\pg_*_d.h
if %DIST%==1 if exist src\backend\catalog\bki-stamp del /q src\backend\catalog\bki-stamp if %DIST%==1 if exist src\backend\catalog\bki-stamp del /q src\backend\catalog\bki-stamp
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\scan.c del /q src\backend\parser\scan.c
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment