Commit 3aa0395d authored by Tom Lane's avatar Tom Lane

Remove remaining hard-wired OID references in the initial catalog data.

In the v11-era commits that taught genbki.pl to resolve symbolic
OID references in the initial catalog data, we didn't bother to
make every last reference symbolic; some of the catalogs have so
few initial rows that it didn't seem worthwhile.

However, the new project policy that OIDs assigned by new patches
should be automatically renumberable changes this calculus.
A patch that wants to add a row in one of these catalogs would have
a problem when the OID it assigns gets renumbered.  Hence, do the
mop-up work needed to make all OID references in initial data be
symbolic, and establish an associated project policy that we'll
never again write a hard-wired OID reference there.

No catversion bump since the contents of postgres.bki aren't
actually changed by this commit.

Discussion: https://postgr.es/m/CAH2-WzmMTGMcPuph4OvsO7Ykut0AOCF_i-=eaochT0dd2BN9CQ@mail.gmail.com
parent a6417078
...@@ -187,11 +187,10 @@ ...@@ -187,11 +187,10 @@
# A comment could appear here. # A comment could appear here.
{ oid => '1', oid_symbol => 'TemplateDbOid', { oid => '1', oid_symbol => 'TemplateDbOid',
descr => 'database\'s default template', descr => 'database\'s default template',
datname => 'template1', datdba => 'PGUID', encoding => 'ENCODING', datname => 'template1', encoding => 'ENCODING', datcollate => 'LC_COLLATE',
datcollate => 'LC_COLLATE', datctype => 'LC_CTYPE', datistemplate => 't', datctype => 'LC_CTYPE', datistemplate => 't', datallowconn => 't',
datallowconn => 't', datconnlimit => '-1', datlastsysoid => '0', datconnlimit => '-1', datlastsysoid => '0', datfrozenxid => '0',
datfrozenxid => '0', datminmxid => '1', dattablespace => '1663', datminmxid => '1', dattablespace => 'pg_default', datacl => '_null_' },
datacl => '_null_' },
] ]
</programlisting> </programlisting>
...@@ -229,6 +228,9 @@ ...@@ -229,6 +228,9 @@
While the metadata keys are optional, the catalog's defined columns While the metadata keys are optional, the catalog's defined columns
must all be provided, except when the catalog's <literal>.h</literal> must all be provided, except when the catalog's <literal>.h</literal>
file specifies a default value for the column. file specifies a default value for the column.
(In the example above, the <structfield>datdba</structfield> field has
been omitted because <filename>pg_database.h</filename> supplies a
suitable default value for it.)
</para> </para>
</listitem> </listitem>
...@@ -264,8 +266,10 @@ ...@@ -264,8 +266,10 @@
<listitem> <listitem>
<para> <para>
To aid readability, field values that are OIDs of other catalog Field values that are OIDs of other catalog entries should be
entries can be represented by names rather than numeric OIDs. represented by symbolic names rather than actual numeric OIDs.
(In the example above, <structfield>dattablespace</structfield>
contains such a reference.)
This is described in <xref linkend="system-catalog-oid-references"/> This is described in <xref linkend="system-catalog-oid-references"/>
below. below.
</para> </para>
...@@ -438,13 +442,13 @@ ...@@ -438,13 +442,13 @@
<title>OID Reference Lookup</title> <title>OID Reference Lookup</title>
<para> <para>
Cross-references from one initial catalog row to another can be written In principle, cross-references from one initial catalog row to another
by just writing the preassigned OID of the referenced row. But could be written just by writing the preassigned OID of the referenced
that's error-prone and hard to understand, so for frequently-referenced row in the referencing field. However, that is against project
catalogs, <filename>genbki.pl</filename> provides mechanisms to write policy, because it is error-prone, hard to read, and subject to
symbolic references instead. Currently this is possible for references breakage if a newly-assigned OID is renumbered. Therefore
to access methods, functions, languages, <filename>genbki.pl</filename> provides mechanisms to write
operators, opclasses, opfamilies, types, and encodings. symbolic references instead.
The rules are as follows: The rules are as follows:
</para> </para>
...@@ -455,19 +459,20 @@ ...@@ -455,19 +459,20 @@
Use of symbolic references is enabled in a particular catalog column Use of symbolic references is enabled in a particular catalog column
by attaching <literal>BKI_LOOKUP(<replaceable>lookuprule</replaceable>)</literal> by attaching <literal>BKI_LOOKUP(<replaceable>lookuprule</replaceable>)</literal>
to the column's definition, where <replaceable>lookuprule</replaceable> to the column's definition, where <replaceable>lookuprule</replaceable>
is <literal>pg_am</literal>, <literal>pg_proc</literal>, is the name of the referenced catalog, e.g. <literal>pg_proc</literal>.
<literal>pg_language</literal>,
<literal>pg_operator</literal>, <literal>pg_opclass</literal>,
<literal>pg_opfamily</literal>,
<literal>pg_type</literal>,
or <literal>encoding</literal>.
<literal>BKI_LOOKUP</literal> can be attached to columns of <literal>BKI_LOOKUP</literal> can be attached to columns of
type <type>Oid</type>, <type>regproc</type>, <type>oidvector</type>, type <type>Oid</type>, <type>regproc</type>, <type>oidvector</type>,
or <type>Oid[]</type>; in the latter two cases it implies performing a or <type>Oid[]</type>; in the latter two cases it implies performing a
lookup on each element of the array. lookup on each element of the array.
It's also permissible to attach <literal>BKI_LOOKUP</literal> </para>
to integer columns; this should be done only for encodings, </listitem>
which are not currently represented as catalog OIDs.
<listitem>
<para>
It's also permissible to attach <literal>BKI_LOOKUP(encoding)</literal>
to integer columns to reference character set encodings, which are
not currently represented as catalog OIDs, but have a set of values
known to <filename>genbki.pl</filename>.
</para> </para>
</listitem> </listitem>
...@@ -483,10 +488,11 @@ ...@@ -483,10 +488,11 @@
<listitem> <listitem>
<para> <para>
Access methods are just represented by their names, as are types. Most kinds of catalog objects are simply referenced by their names.
Type names must match the referenced <structname>pg_type</structname> Note that type names must exactly match the
entry's <structfield>typname</structfield>; you do not get to use any referenced <structname>pg_type</structname>
aliases such as <literal>integer</literal> entry's <structfield>typname</structfield>; you do not get to use
any aliases such as <literal>integer</literal>
for <literal>int4</literal>. for <literal>int4</literal>.
</para> </para>
</listitem> </listitem>
...@@ -530,7 +536,18 @@ ...@@ -530,7 +536,18 @@
<para> <para>
In none of these cases is there any provision for In none of these cases is there any provision for
schema-qualification; all objects created during bootstrap are schema-qualification; all objects created during bootstrap are
expected to be in the pg_catalog schema. expected to be in the <literal>pg_catalog</literal> schema.
</para>
</listitem>
<listitem>
<para>
In addition to the generic lookup mechanisms, there is a special
convention that <literal>PGNSP</literal> is replaced by the OID of
the <literal>pg_catalog</literal> schema,
and <literal>PGUID</literal> is replaced by the OID of the bootstrap
superuser role. These usages are somewhat historical but so far
there hasn't been a need to generalize them.
</para> </para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
......
...@@ -160,9 +160,6 @@ my $C_COLLATION_OID = ...@@ -160,9 +160,6 @@ my $C_COLLATION_OID =
my $PG_CATALOG_NAMESPACE = my $PG_CATALOG_NAMESPACE =
Catalog::FindDefinedSymbolFromData($catalog_data{pg_namespace}, Catalog::FindDefinedSymbolFromData($catalog_data{pg_namespace},
'PG_CATALOG_NAMESPACE'); 'PG_CATALOG_NAMESPACE');
my $PG_HEAP_AM =
Catalog::FindDefinedSymbolFromData($catalog_data{pg_am},
'HEAP_TABLE_AM_OID');
# Build lookup tables. # Build lookup tables.
...@@ -174,6 +171,20 @@ foreach my $row (@{ $catalog_data{pg_am} }) ...@@ -174,6 +171,20 @@ foreach my $row (@{ $catalog_data{pg_am} })
$amoids{ $row->{amname} } = $row->{oid}; $amoids{ $row->{amname} } = $row->{oid};
} }
# class (relation) OID lookup (note this only covers bootstrap catalogs!)
my %classoids;
foreach my $row (@{ $catalog_data{pg_class} })
{
$classoids{ $row->{relname} } = $row->{oid};
}
# collation OID lookup
my %collationoids;
foreach my $row (@{ $catalog_data{pg_collation} })
{
$collationoids{ $row->{collname} } = $row->{oid};
}
# language OID lookup # language OID lookup
my %langoids; my %langoids;
foreach my $row (@{ $catalog_data{pg_language} }) foreach my $row (@{ $catalog_data{pg_language} })
...@@ -243,6 +254,41 @@ foreach my $row (@{ $catalog_data{pg_proc} }) ...@@ -243,6 +254,41 @@ foreach my $row (@{ $catalog_data{pg_proc} })
} }
} }
# tablespace OID lookup
my %tablespaceoids;
foreach my $row (@{ $catalog_data{pg_tablespace} })
{
$tablespaceoids{ $row->{spcname} } = $row->{oid};
}
# text search configuration OID lookup
my %tsconfigoids;
foreach my $row (@{ $catalog_data{pg_ts_config} })
{
$tsconfigoids{ $row->{cfgname} } = $row->{oid};
}
# text search dictionary OID lookup
my %tsdictoids;
foreach my $row (@{ $catalog_data{pg_ts_dict} })
{
$tsdictoids{ $row->{dictname} } = $row->{oid};
}
# text search parser OID lookup
my %tsparseroids;
foreach my $row (@{ $catalog_data{pg_ts_parser} })
{
$tsparseroids{ $row->{prsname} } = $row->{oid};
}
# text search template OID lookup
my %tstemplateoids;
foreach my $row (@{ $catalog_data{pg_ts_template} })
{
$tstemplateoids{ $row->{tmplname} } = $row->{oid};
}
# type lookups # type lookups
my %typeoids; my %typeoids;
my %types; my %types;
...@@ -288,11 +334,18 @@ close $ef; ...@@ -288,11 +334,18 @@ 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_class => \%classoids,
pg_collation => \%collationoids,
pg_language => \%langoids, pg_language => \%langoids,
pg_opclass => \%opcoids, pg_opclass => \%opcoids,
pg_operator => \%operoids, pg_operator => \%operoids,
pg_opfamily => \%opfoids, pg_opfamily => \%opfoids,
pg_proc => \%procoids, pg_proc => \%procoids,
pg_tablespace => \%tablespaceoids,
pg_ts_config => \%tsconfigoids,
pg_ts_dict => \%tsdictoids,
pg_ts_parser => \%tsparseroids,
pg_ts_template => \%tstemplateoids,
pg_type => \%typeoids, pg_type => \%typeoids,
encoding => \%encids); encoding => \%encids);
...@@ -467,7 +520,6 @@ EOM ...@@ -467,7 +520,6 @@ EOM
# (It's intentional that this can apply to parts of a field). # (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/\bPGUID\b/$BOOTSTRAP_SUPERUSERID/g;
$bki_values{$attname} =~ s/\bPGNSP\b/$PG_CATALOG_NAMESPACE/g; $bki_values{$attname} =~ s/\bPGNSP\b/$PG_CATALOG_NAMESPACE/g;
$bki_values{$attname} =~ s/\bPGHEAPAM\b/$PG_HEAP_AM/g;
# Replace OID synonyms with OIDs per the appropriate lookup rule. # Replace OID synonyms with OIDs per the appropriate lookup rule.
# #
...@@ -730,8 +782,8 @@ sub morph_row_for_pgattr ...@@ -730,8 +782,8 @@ sub morph_row_for_pgattr
$row->{attndims} = $type->{typcategory} eq 'A' ? '1' : '0'; $row->{attndims} = $type->{typcategory} eq 'A' ? '1' : '0';
# collation-aware catalog columns must use C collation # collation-aware catalog columns must use C collation
$row->{attcollation} = $type->{typcollation} != 0 ? $row->{attcollation} =
$C_COLLATION_OID : 0; $type->{typcollation} ne '0' ? $C_COLLATION_OID : 0;
if (defined $attr->{forcenotnull}) if (defined $attr->{forcenotnull})
{ {
......
...@@ -21,48 +21,44 @@ ...@@ -21,48 +21,44 @@
# similarly, "1" in relminmxid stands for FirstMultiXactId # similarly, "1" in relminmxid stands for FirstMultiXactId
{ oid => '1247', { oid => '1247',
relname => 'pg_type', relnamespace => 'PGNSP', reltype => '71', relname => 'pg_type', reltype => 'pg_type', relam => 'heap',
reloftype => '0', relowner => 'PGUID', relam => 'PGHEAPAM', relfilenode => '0', relpages => '0', reltuples => '0', relallvisible => '0',
relfilenode => '0', reltablespace => '0', relpages => '0', reltuples => '0', reltoastrelid => '0', relhasindex => 'f', relisshared => 'f',
relallvisible => '0', reltoastrelid => '0', relhasindex => 'f', relpersistence => 'p', relkind => 'r', relnatts => '31', relchecks => '0',
relisshared => 'f', relpersistence => 'p', relkind => 'r', relnatts => '31', relhasrules => 'f', relhastriggers => 'f', relhassubclass => 'f',
relchecks => '0', relhasrules => 'f', relhastriggers => 'f', relrowsecurity => 'f', relforcerowsecurity => 'f', relispopulated => 't',
relhassubclass => 'f', relrowsecurity => 'f', relforcerowsecurity => 'f', relreplident => 'n', relispartition => 'f', relrewrite => '0',
relispopulated => 't', relreplident => 'n', relispartition => 'f', relfrozenxid => '3', relminmxid => '1', relacl => '_null_',
relrewrite => '0', relfrozenxid => '3', relminmxid => '1', relacl => '_null_',
reloptions => '_null_', relpartbound => '_null_' }, reloptions => '_null_', relpartbound => '_null_' },
{ oid => '1249', { oid => '1249',
relname => 'pg_attribute', relnamespace => 'PGNSP', reltype => '75', relname => 'pg_attribute', reltype => 'pg_attribute', relam => 'heap',
reloftype => '0', relowner => 'PGUID', relam => 'PGHEAPAM', relfilenode => '0', relpages => '0', reltuples => '0', relallvisible => '0',
relfilenode => '0', reltablespace => '0', relpages => '0', reltuples => '0', reltoastrelid => '0', relhasindex => 'f', relisshared => 'f',
relallvisible => '0', reltoastrelid => '0', relhasindex => 'f', relpersistence => 'p', relkind => 'r', relnatts => '24', relchecks => '0',
relisshared => 'f', relpersistence => 'p', relkind => 'r', relnatts => '24', relhasrules => 'f', relhastriggers => 'f', relhassubclass => 'f',
relchecks => '0', relhasrules => 'f', relhastriggers => 'f', relrowsecurity => 'f', relforcerowsecurity => 'f', relispopulated => 't',
relhassubclass => 'f', relrowsecurity => 'f', relforcerowsecurity => 'f', relreplident => 'n', relispartition => 'f', relrewrite => '0',
relispopulated => 't', relreplident => 'n', relispartition => 'f', relfrozenxid => '3', relminmxid => '1', relacl => '_null_',
relrewrite => '0', relfrozenxid => '3', relminmxid => '1', relacl => '_null_',
reloptions => '_null_', relpartbound => '_null_' }, reloptions => '_null_', relpartbound => '_null_' },
{ oid => '1255', { oid => '1255',
relname => 'pg_proc', relnamespace => 'PGNSP', reltype => '81', relname => 'pg_proc', reltype => 'pg_proc', relam => 'heap',
reloftype => '0', relowner => 'PGUID', relam => 'PGHEAPAM', relfilenode => '0', relpages => '0', reltuples => '0', relallvisible => '0',
relfilenode => '0', reltablespace => '0', relpages => '0', reltuples => '0', reltoastrelid => '0', relhasindex => 'f', relisshared => 'f',
relallvisible => '0', reltoastrelid => '0', relhasindex => 'f', relpersistence => 'p', relkind => 'r', relnatts => '29', relchecks => '0',
relisshared => 'f', relpersistence => 'p', relkind => 'r', relnatts => '29', relhasrules => 'f', relhastriggers => 'f', relhassubclass => 'f',
relchecks => '0', relhasrules => 'f', relhastriggers => 'f', relrowsecurity => 'f', relforcerowsecurity => 'f', relispopulated => 't',
relhassubclass => 'f', relrowsecurity => 'f', relforcerowsecurity => 'f', relreplident => 'n', relispartition => 'f', relrewrite => '0',
relispopulated => 't', relreplident => 'n', relispartition => 'f', relfrozenxid => '3', relminmxid => '1', relacl => '_null_',
relrewrite => '0', relfrozenxid => '3', relminmxid => '1', relacl => '_null_',
reloptions => '_null_', relpartbound => '_null_' }, reloptions => '_null_', relpartbound => '_null_' },
{ oid => '1259', { oid => '1259',
relname => 'pg_class', relnamespace => 'PGNSP', reltype => '83', relname => 'pg_class', reltype => 'pg_class', relam => 'heap',
reloftype => '0', relowner => 'PGUID', relam => 'PGHEAPAM', relfilenode => '0', relpages => '0', reltuples => '0', relallvisible => '0',
relfilenode => '0', reltablespace => '0', relpages => '0', reltuples => '0', reltoastrelid => '0', relhasindex => 'f', relisshared => 'f',
relallvisible => '0', reltoastrelid => '0', relhasindex => 'f', relpersistence => 'p', relkind => 'r', relnatts => '33', relchecks => '0',
relisshared => 'f', relpersistence => 'p', relkind => 'r', relnatts => '33', relhasrules => 'f', relhastriggers => 'f', relhassubclass => 'f',
relchecks => '0', relhasrules => 'f', relhastriggers => 'f', relrowsecurity => 'f', relforcerowsecurity => 'f', relispopulated => 't',
relhassubclass => 'f', relrowsecurity => 'f', relforcerowsecurity => 'f', relreplident => 'n', relispartition => 'f', relrewrite => '0',
relispopulated => 't', relreplident => 'n', relispartition => 'f', relfrozenxid => '3', relminmxid => '1', relacl => '_null_',
relrewrite => '0', relfrozenxid => '3', relminmxid => '1', relacl => '_null_',
reloptions => '_null_', relpartbound => '_null_' }, reloptions => '_null_', relpartbound => '_null_' },
] ]
...@@ -28,56 +28,113 @@ ...@@ -28,56 +28,113 @@
*/ */
CATALOG(pg_class,1259,RelationRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83,RelationRelation_Rowtype_Id) BKI_SCHEMA_MACRO CATALOG(pg_class,1259,RelationRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83,RelationRelation_Rowtype_Id) BKI_SCHEMA_MACRO
{ {
Oid oid; /* oid */ /* oid */
NameData relname; /* class name */ Oid oid;
Oid relnamespace; /* OID of namespace containing this class */
Oid reltype; /* OID of entry in pg_type for table's
* implicit row type */
Oid reloftype; /* OID of entry in pg_type for underlying
* composite type */
Oid relowner; /* class owner */
Oid relam; /* access method; 0 if not a table / index */
Oid relfilenode; /* identifier of physical storage file */
/* class name */
NameData relname;
/* OID of namespace containing this class */
Oid relnamespace BKI_DEFAULT(PGNSP);
/* OID of entry in pg_type for table's implicit row type */
Oid reltype BKI_LOOKUP(pg_type);
/* OID of entry in pg_type for underlying composite type */
Oid reloftype BKI_DEFAULT(0) BKI_LOOKUP(pg_type);
/* class owner */
Oid relowner BKI_DEFAULT(PGUID);
/* access method; 0 if not a table / index */
Oid relam BKI_LOOKUP(pg_am);
/* 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 reltablespace; /* identifier of table space for relation */ Oid relfilenode;
int32 relpages; /* # of blocks (not always up-to-date) */
float4 reltuples; /* # of tuples (not always up-to-date) */ /* identifier of table space for relation (0 means default for database) */
int32 relallvisible; /* # of all-visible blocks (not always Oid reltablespace BKI_DEFAULT(0) BKI_LOOKUP(pg_tablespace);
* up-to-date) */
Oid reltoastrelid; /* OID of toast table; 0 if none */ /* # of blocks (not always up-to-date) */
bool relhasindex; /* T if has (or has had) any indexes */ int32 relpages;
bool relisshared; /* T if shared across databases */
char relpersistence; /* see RELPERSISTENCE_xxx constants below */ /* # of tuples (not always up-to-date) */
char relkind; /* see RELKIND_xxx constants below */ float4 reltuples;
int16 relnatts; /* number of user attributes */
/* # of all-visible blocks (not always up-to-date) */
int32 relallvisible;
/* OID of toast table; 0 if none */
Oid reltoastrelid;
/* T if has (or has had) any indexes */
bool relhasindex;
/* T if shared across databases */
bool relisshared;
/* see RELPERSISTENCE_xxx constants below */
char relpersistence;
/* see RELKIND_xxx constants below */
char relkind;
/* number of user attributes */
int16 relnatts;
/* /*
* Class pg_attribute must contain exactly "relnatts" user attributes * Class pg_attribute must contain exactly "relnatts" user attributes
* (with attnums ranging from 1 to relnatts) for this class. It may also * (with attnums ranging from 1 to relnatts) for this class. It may also
* contain entries with negative attnums for system attributes. * contain entries with negative attnums for system attributes.
*/ */
int16 relchecks; /* # of CHECK constraints for class */
bool relhasrules; /* has (or has had) any rules */ /* # of CHECK constraints for class */
bool relhastriggers; /* has (or has had) any TRIGGERs */ int16 relchecks;
bool relhassubclass; /* has (or has had) child tables or indexes */
bool relrowsecurity; /* row security is enabled or not */ /* has (or has had) any rules */
bool relforcerowsecurity; /* row security forced for owners or bool relhasrules;
* not */
bool relispopulated; /* matview currently holds query results */ /* has (or has had) any TRIGGERs */
char relreplident; /* see REPLICA_IDENTITY_xxx constants */ bool relhastriggers;
bool relispartition; /* is relation a partition? */
Oid relrewrite; /* heap for rewrite during DDL, link to /* has (or has had) child tables or indexes */
* original rel */ bool relhassubclass;
TransactionId relfrozenxid; /* all Xids < this are frozen in this rel */
TransactionId relminmxid; /* all multixacts in this rel are >= this. /* row security is enabled or not */
* this is really a MultiXactId */ bool relrowsecurity;
/* row security forced for owners or not */
bool relforcerowsecurity;
/* matview currently holds query results */
bool relispopulated;
/* see REPLICA_IDENTITY_xxx constants */
char relreplident;
/* is relation a partition? */
bool relispartition;
/* heap for rewrite during DDL, link to original rel */
Oid relrewrite;
/* all Xids < this are frozen in this rel */
TransactionId relfrozenxid;
/* all multixacts in this rel are >= this; it is really a MultiXactId */
TransactionId relminmxid;
#ifdef CATALOG_VARLEN /* variable-length fields start here */ #ifdef CATALOG_VARLEN /* variable-length fields start here */
/* NOTE: These fields are not present in a relcache entry's rd_rel field. */ /* NOTE: These fields are not present in a relcache entry's rd_rel field. */
aclitem relacl[1]; /* access permissions */ /* access permissions */
text reloptions[1]; /* access-method-specific options */ aclitem relacl[1];
pg_node_tree relpartbound; /* partition bound node tree */
/* access-method-specific options */
text reloptions[1];
/* partition bound node tree */
pg_node_tree relpartbound;
#endif #endif
} FormData_pg_class; } FormData_pg_class;
......
...@@ -14,10 +14,9 @@ ...@@ -14,10 +14,9 @@
{ oid => '1', oid_symbol => 'TemplateDbOid', { oid => '1', oid_symbol => 'TemplateDbOid',
descr => 'default template for new databases', descr => 'default template for new databases',
datname => 'template1', datdba => 'PGUID', encoding => 'ENCODING', datname => 'template1', encoding => 'ENCODING', datcollate => 'LC_COLLATE',
datcollate => 'LC_COLLATE', datctype => 'LC_CTYPE', datistemplate => 't', datctype => 'LC_CTYPE', datistemplate => 't', datallowconn => 't',
datallowconn => 't', datconnlimit => '-1', datlastsysoid => '0', datconnlimit => '-1', datlastsysoid => '0', datfrozenxid => '0',
datfrozenxid => '0', datminmxid => '1', dattablespace => '1663', datminmxid => '1', dattablespace => 'pg_default', datacl => '_null_' },
datacl => '_null_' },
] ]
...@@ -28,22 +28,48 @@ ...@@ -28,22 +28,48 @@
*/ */
CATALOG(pg_database,1262,DatabaseRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(1248,DatabaseRelation_Rowtype_Id) BKI_SCHEMA_MACRO CATALOG(pg_database,1262,DatabaseRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(1248,DatabaseRelation_Rowtype_Id) BKI_SCHEMA_MACRO
{ {
Oid oid; /* oid */ /* oid */
NameData datname; /* database name */ Oid oid;
Oid datdba; /* owner of database */
int32 encoding; /* character encoding */ /* database name */
NameData datcollate; /* LC_COLLATE setting */ NameData datname;
NameData datctype; /* LC_CTYPE setting */
bool datistemplate; /* allowed as CREATE DATABASE template? */ /* owner of database */
bool datallowconn; /* new connections allowed? */ Oid datdba BKI_DEFAULT(PGUID);
int32 datconnlimit; /* max connections allowed (-1=no limit) */
Oid datlastsysoid; /* highest OID to consider a system OID */ /* character encoding */
TransactionId datfrozenxid; /* all Xids < this are frozen in this DB */ int32 encoding;
TransactionId datminmxid; /* all multixacts in the DB are >= this */
Oid dattablespace; /* default table space for this DB */ /* LC_COLLATE setting */
NameData datcollate;
/* LC_CTYPE setting */
NameData datctype;
/* allowed as CREATE DATABASE template? */
bool datistemplate;
/* new connections allowed? */
bool datallowconn;
/* max connections allowed (-1=no limit) */
int32 datconnlimit;
/* highest OID to consider a system OID */
Oid datlastsysoid;
/* all Xids < this are frozen in this DB */
TransactionId datfrozenxid;
/* all multixacts in the DB are >= this */
TransactionId datminmxid;
/* default table space for this DB */
Oid dattablespace BKI_LOOKUP(pg_tablespace);
#ifdef CATALOG_VARLEN /* variable-length fields start here */ #ifdef CATALOG_VARLEN /* variable-length fields start here */
aclitem datacl[1]; /* access permissions */ /* access permissions */
aclitem datacl[1];
#endif #endif
} FormData_pg_database; } FormData_pg_database;
......
...@@ -5227,9 +5227,10 @@ ...@@ -5227,9 +5227,10 @@
proname => 'pg_stat_get_db_deadlocks', provolatile => 's', proparallel => 'r', proname => 'pg_stat_get_db_deadlocks', provolatile => 's', proparallel => 'r',
prorettype => 'int8', proargtypes => 'oid', prorettype => 'int8', proargtypes => 'oid',
prosrc => 'pg_stat_get_db_deadlocks' }, prosrc => 'pg_stat_get_db_deadlocks' },
{ oid => '3426', descr => 'statistics: checksum failures detected in database', { oid => '3426',
proname => 'pg_stat_get_db_checksum_failures', provolatile => 's', proparallel => 'r', descr => 'statistics: checksum failures detected in database',
prorettype => 'int8', proargtypes => 'oid', proname => 'pg_stat_get_db_checksum_failures', provolatile => 's',
proparallel => 'r', prorettype => 'int8', proargtypes => 'oid',
prosrc => 'pg_stat_get_db_checksum_failures' }, prosrc => 'pg_stat_get_db_checksum_failures' },
{ oid => '3074', descr => 'statistics: last reset for a database', { oid => '3074', descr => 'statistics: last reset for a database',
proname => 'pg_stat_get_db_stat_reset_time', provolatile => 's', proname => 'pg_stat_get_db_stat_reset_time', provolatile => 's',
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
[ [
{ oid => '3748', descr => 'simple configuration', { oid => '3748', descr => 'simple configuration',
cfgname => 'simple', cfgnamespace => 'PGNSP', cfgowner => 'PGUID', cfgname => 'simple', cfgparser => 'default' },
cfgparser => '3722' },
] ]
...@@ -29,11 +29,20 @@ ...@@ -29,11 +29,20 @@
*/ */
CATALOG(pg_ts_config,3602,TSConfigRelationId) CATALOG(pg_ts_config,3602,TSConfigRelationId)
{ {
Oid oid; /* oid */ /* oid */
NameData cfgname; /* name of configuration */ Oid oid;
Oid cfgnamespace; /* name space */
Oid cfgowner; /* owner */ /* name of configuration */
Oid cfgparser; /* OID of parser (in pg_ts_parser) */ NameData cfgname;
/* name space */
Oid cfgnamespace BKI_DEFAULT(PGNSP);
/* owner */
Oid cfgowner BKI_DEFAULT(PGUID);
/* OID of parser */
Oid cfgparser BKI_LOOKUP(pg_ts_parser);
} FormData_pg_ts_config; } FormData_pg_ts_config;
typedef FormData_pg_ts_config *Form_pg_ts_config; typedef FormData_pg_ts_config *Form_pg_ts_config;
......
...@@ -12,24 +12,43 @@ ...@@ -12,24 +12,43 @@
[ [
{ mapcfg => '3748', maptokentype => '1', mapseqno => '1', mapdict => '3765' }, { mapcfg => 'simple', maptokentype => '1', mapseqno => '1',
{ mapcfg => '3748', maptokentype => '2', mapseqno => '1', mapdict => '3765' }, mapdict => 'simple' },
{ mapcfg => '3748', maptokentype => '3', mapseqno => '1', mapdict => '3765' }, { mapcfg => 'simple', maptokentype => '2', mapseqno => '1',
{ mapcfg => '3748', maptokentype => '4', mapseqno => '1', mapdict => '3765' }, mapdict => 'simple' },
{ mapcfg => '3748', maptokentype => '5', mapseqno => '1', mapdict => '3765' }, { mapcfg => 'simple', maptokentype => '3', mapseqno => '1',
{ mapcfg => '3748', maptokentype => '6', mapseqno => '1', mapdict => '3765' }, mapdict => 'simple' },
{ mapcfg => '3748', maptokentype => '7', mapseqno => '1', mapdict => '3765' }, { mapcfg => 'simple', maptokentype => '4', mapseqno => '1',
{ mapcfg => '3748', maptokentype => '8', mapseqno => '1', mapdict => '3765' }, mapdict => 'simple' },
{ mapcfg => '3748', maptokentype => '9', mapseqno => '1', mapdict => '3765' }, { mapcfg => 'simple', maptokentype => '5', mapseqno => '1',
{ mapcfg => '3748', maptokentype => '10', mapseqno => '1', mapdict => '3765' }, mapdict => 'simple' },
{ mapcfg => '3748', maptokentype => '11', mapseqno => '1', mapdict => '3765' }, { mapcfg => 'simple', maptokentype => '6', mapseqno => '1',
{ mapcfg => '3748', maptokentype => '15', mapseqno => '1', mapdict => '3765' }, mapdict => 'simple' },
{ mapcfg => '3748', maptokentype => '16', mapseqno => '1', mapdict => '3765' }, { mapcfg => 'simple', maptokentype => '7', mapseqno => '1',
{ mapcfg => '3748', maptokentype => '17', mapseqno => '1', mapdict => '3765' }, mapdict => 'simple' },
{ mapcfg => '3748', maptokentype => '18', mapseqno => '1', mapdict => '3765' }, { mapcfg => 'simple', maptokentype => '8', mapseqno => '1',
{ mapcfg => '3748', maptokentype => '19', mapseqno => '1', mapdict => '3765' }, mapdict => 'simple' },
{ mapcfg => '3748', maptokentype => '20', mapseqno => '1', mapdict => '3765' }, { mapcfg => 'simple', maptokentype => '9', mapseqno => '1',
{ mapcfg => '3748', maptokentype => '21', mapseqno => '1', mapdict => '3765' }, mapdict => 'simple' },
{ mapcfg => '3748', maptokentype => '22', mapseqno => '1', mapdict => '3765' }, { mapcfg => 'simple', maptokentype => '10', mapseqno => '1',
mapdict => 'simple' },
{ mapcfg => 'simple', maptokentype => '11', mapseqno => '1',
mapdict => 'simple' },
{ mapcfg => 'simple', maptokentype => '15', mapseqno => '1',
mapdict => 'simple' },
{ mapcfg => 'simple', maptokentype => '16', mapseqno => '1',
mapdict => 'simple' },
{ mapcfg => 'simple', maptokentype => '17', mapseqno => '1',
mapdict => 'simple' },
{ mapcfg => 'simple', maptokentype => '18', mapseqno => '1',
mapdict => 'simple' },
{ mapcfg => 'simple', maptokentype => '19', mapseqno => '1',
mapdict => 'simple' },
{ mapcfg => 'simple', maptokentype => '20', mapseqno => '1',
mapdict => 'simple' },
{ mapcfg => 'simple', maptokentype => '21', mapseqno => '1',
mapdict => 'simple' },
{ mapcfg => 'simple', maptokentype => '22', mapseqno => '1',
mapdict => 'simple' },
] ]
...@@ -29,10 +29,17 @@ ...@@ -29,10 +29,17 @@
*/ */
CATALOG(pg_ts_config_map,3603,TSConfigMapRelationId) CATALOG(pg_ts_config_map,3603,TSConfigMapRelationId)
{ {
Oid mapcfg; /* OID of configuration owning this entry */ /* OID of configuration owning this entry */
int32 maptokentype; /* token type from parser */ Oid mapcfg BKI_LOOKUP(pg_ts_config);
int32 mapseqno; /* order in which to consult dictionaries */
Oid mapdict; /* dictionary to consult */ /* token type from parser */
int32 maptokentype;
/* order in which to consult dictionaries */
int32 mapseqno;
/* dictionary to consult */
Oid mapdict BKI_LOOKUP(pg_ts_dict);
} FormData_pg_ts_config_map; } FormData_pg_ts_config_map;
typedef FormData_pg_ts_config_map *Form_pg_ts_config_map; typedef FormData_pg_ts_config_map *Form_pg_ts_config_map;
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
{ oid => '3765', { oid => '3765',
descr => 'simple dictionary: just lower case and check for stopword', descr => 'simple dictionary: just lower case and check for stopword',
dictname => 'simple', dictnamespace => 'PGNSP', dictowner => 'PGUID', dictname => 'simple', dicttemplate => 'simple', dictinitoption => '_null_' },
dicttemplate => '3727', dictinitoption => '_null_' },
] ]
...@@ -28,14 +28,24 @@ ...@@ -28,14 +28,24 @@
*/ */
CATALOG(pg_ts_dict,3600,TSDictionaryRelationId) CATALOG(pg_ts_dict,3600,TSDictionaryRelationId)
{ {
Oid oid; /* oid */ /* oid */
NameData dictname; /* dictionary name */ Oid oid;
Oid dictnamespace; /* name space */
Oid dictowner; /* owner */ /* dictionary name */
Oid dicttemplate; /* dictionary's template */ NameData dictname;
/* name space */
Oid dictnamespace BKI_DEFAULT(PGNSP);
/* owner */
Oid dictowner BKI_DEFAULT(PGUID);
/* dictionary's template */
Oid dicttemplate BKI_LOOKUP(pg_ts_template);
#ifdef CATALOG_VARLEN /* variable-length fields start here */ #ifdef CATALOG_VARLEN /* variable-length fields start here */
text dictinitoption; /* options passed to dict_init() */ /* options passed to dict_init() */
text dictinitoption;
#endif #endif
} FormData_pg_ts_dict; } FormData_pg_ts_dict;
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
typname => 'name', typlen => 'NAMEDATALEN', typbyval => 'f', typname => 'name', typlen => 'NAMEDATALEN', typbyval => 'f',
typcategory => 'S', typelem => 'char', typinput => 'namein', typcategory => 'S', typelem => 'char', typinput => 'namein',
typoutput => 'nameout', typreceive => 'namerecv', typsend => 'namesend', typoutput => 'nameout', typreceive => 'namerecv', typsend => 'namesend',
typalign => 'c', typcollation => '950' }, typalign => 'c', typcollation => 'C' },
{ oid => '20', array_type_oid => '1016', { oid => '20', array_type_oid => '1016',
descr => '~18 digit integer, 8-byte storage', descr => '~18 digit integer, 8-byte storage',
typname => 'int8', typlen => '8', typbyval => 'FLOAT8PASSBYVAL', typname => 'int8', typlen => '8', typbyval => 'FLOAT8PASSBYVAL',
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
typname => 'text', typlen => '-1', typbyval => 'f', typcategory => 'S', typname => 'text', typlen => '-1', typbyval => 'f', typcategory => 'S',
typispreferred => 't', typinput => 'textin', typoutput => 'textout', typispreferred => 't', typinput => 'textin', typoutput => 'textout',
typreceive => 'textrecv', typsend => 'textsend', typalign => 'i', typreceive => 'textrecv', typsend => 'textsend', typalign => 'i',
typstorage => 'x', typcollation => '100' }, typstorage => 'x', typcollation => 'default' },
{ oid => '26', array_type_oid => '1028', { oid => '26', array_type_oid => '1028',
descr => 'object identifier(oid), maximum 4 billion', descr => 'object identifier(oid), maximum 4 billion',
typname => 'oid', typlen => '4', typbyval => 't', typcategory => 'N', typname => 'oid', typlen => '4', typbyval => 't', typcategory => 'N',
...@@ -115,22 +115,22 @@ ...@@ -115,22 +115,22 @@
# NB: OIDs assigned here must match the BKI_ROWTYPE_OID declarations # NB: OIDs assigned here must match the BKI_ROWTYPE_OID declarations
{ oid => '71', { oid => '71',
typname => 'pg_type', typlen => '-1', typbyval => 'f', typtype => 'c', typname => 'pg_type', typlen => '-1', typbyval => 'f', typtype => 'c',
typcategory => 'C', typrelid => '1247', typinput => 'record_in', typcategory => 'C', typrelid => 'pg_type', typinput => 'record_in',
typoutput => 'record_out', typreceive => 'record_recv', typoutput => 'record_out', typreceive => 'record_recv',
typsend => 'record_send', typalign => 'd', typstorage => 'x' }, typsend => 'record_send', typalign => 'd', typstorage => 'x' },
{ oid => '75', { oid => '75',
typname => 'pg_attribute', typlen => '-1', typbyval => 'f', typtype => 'c', typname => 'pg_attribute', typlen => '-1', typbyval => 'f', typtype => 'c',
typcategory => 'C', typrelid => '1249', typinput => 'record_in', typcategory => 'C', typrelid => 'pg_attribute', typinput => 'record_in',
typoutput => 'record_out', typreceive => 'record_recv', typoutput => 'record_out', typreceive => 'record_recv',
typsend => 'record_send', typalign => 'd', typstorage => 'x' }, typsend => 'record_send', typalign => 'd', typstorage => 'x' },
{ oid => '81', { oid => '81',
typname => 'pg_proc', typlen => '-1', typbyval => 'f', typtype => 'c', typname => 'pg_proc', typlen => '-1', typbyval => 'f', typtype => 'c',
typcategory => 'C', typrelid => '1255', typinput => 'record_in', typcategory => 'C', typrelid => 'pg_proc', typinput => 'record_in',
typoutput => 'record_out', typreceive => 'record_recv', typoutput => 'record_out', typreceive => 'record_recv',
typsend => 'record_send', typalign => 'd', typstorage => 'x' }, typsend => 'record_send', typalign => 'd', typstorage => 'x' },
{ oid => '83', { oid => '83',
typname => 'pg_class', typlen => '-1', typbyval => 'f', typtype => 'c', typname => 'pg_class', typlen => '-1', typbyval => 'f', typtype => 'c',
typcategory => 'C', typrelid => '1259', typinput => 'record_in', typcategory => 'C', typrelid => 'pg_class', typinput => 'record_in',
typoutput => 'record_out', typreceive => 'record_recv', typoutput => 'record_out', typreceive => 'record_recv',
typsend => 'record_send', typalign => 'd', typstorage => 'x' }, typsend => 'record_send', typalign => 'd', typstorage => 'x' },
...@@ -150,21 +150,21 @@ ...@@ -150,21 +150,21 @@
typcategory => 'S', typinput => 'pg_node_tree_in', typcategory => 'S', typinput => 'pg_node_tree_in',
typoutput => 'pg_node_tree_out', typreceive => 'pg_node_tree_recv', typoutput => 'pg_node_tree_out', typreceive => 'pg_node_tree_recv',
typsend => 'pg_node_tree_send', typalign => 'i', typstorage => 'x', typsend => 'pg_node_tree_send', typalign => 'i', typstorage => 'x',
typcollation => '100' }, typcollation => 'default' },
{ oid => '3361', oid_symbol => 'PGNDISTINCTOID', { oid => '3361', oid_symbol => 'PGNDISTINCTOID',
descr => 'multivariate ndistinct coefficients', descr => 'multivariate ndistinct coefficients',
typname => 'pg_ndistinct', typlen => '-1', typbyval => 'f', typname => 'pg_ndistinct', typlen => '-1', typbyval => 'f',
typcategory => 'S', typinput => 'pg_ndistinct_in', typcategory => 'S', typinput => 'pg_ndistinct_in',
typoutput => 'pg_ndistinct_out', typreceive => 'pg_ndistinct_recv', typoutput => 'pg_ndistinct_out', typreceive => 'pg_ndistinct_recv',
typsend => 'pg_ndistinct_send', typalign => 'i', typstorage => 'x', typsend => 'pg_ndistinct_send', typalign => 'i', typstorage => 'x',
typcollation => '100' }, typcollation => 'default' },
{ oid => '3402', oid_symbol => 'PGDEPENDENCIESOID', { oid => '3402', oid_symbol => 'PGDEPENDENCIESOID',
descr => 'multivariate dependencies', descr => 'multivariate dependencies',
typname => 'pg_dependencies', typlen => '-1', typbyval => 'f', typname => 'pg_dependencies', typlen => '-1', typbyval => 'f',
typcategory => 'S', typinput => 'pg_dependencies_in', typcategory => 'S', typinput => 'pg_dependencies_in',
typoutput => 'pg_dependencies_out', typreceive => 'pg_dependencies_recv', typoutput => 'pg_dependencies_out', typreceive => 'pg_dependencies_recv',
typsend => 'pg_dependencies_send', typalign => 'i', typstorage => 'x', typsend => 'pg_dependencies_send', typalign => 'i', typstorage => 'x',
typcollation => '100' }, typcollation => 'default' },
{ oid => '32', oid_symbol => 'PGDDLCOMMANDOID', { oid => '32', oid_symbol => 'PGDDLCOMMANDOID',
descr => 'internal type for passing CollectedCommand', descr => 'internal type for passing CollectedCommand',
typname => 'pg_ddl_command', typlen => 'SIZEOF_POINTER', typbyval => 't', typname => 'pg_ddl_command', typlen => 'SIZEOF_POINTER', typbyval => 't',
...@@ -269,14 +269,14 @@ ...@@ -269,14 +269,14 @@
typinput => 'bpcharin', typoutput => 'bpcharout', typreceive => 'bpcharrecv', typinput => 'bpcharin', typoutput => 'bpcharout', typreceive => 'bpcharrecv',
typsend => 'bpcharsend', typmodin => 'bpchartypmodin', typsend => 'bpcharsend', typmodin => 'bpchartypmodin',
typmodout => 'bpchartypmodout', typalign => 'i', typstorage => 'x', typmodout => 'bpchartypmodout', typalign => 'i', typstorage => 'x',
typcollation => '100' }, typcollation => 'default' },
{ oid => '1043', array_type_oid => '1015', { oid => '1043', array_type_oid => '1015',
descr => 'varchar(length), non-blank-padded string, variable storage length', descr => 'varchar(length), non-blank-padded string, variable storage length',
typname => 'varchar', typlen => '-1', typbyval => 'f', typcategory => 'S', typname => 'varchar', typlen => '-1', typbyval => 'f', typcategory => 'S',
typinput => 'varcharin', typoutput => 'varcharout', typinput => 'varcharin', typoutput => 'varcharout',
typreceive => 'varcharrecv', typsend => 'varcharsend', typreceive => 'varcharrecv', typsend => 'varcharsend',
typmodin => 'varchartypmodin', typmodout => 'varchartypmodout', typmodin => 'varchartypmodin', typmodout => 'varchartypmodout',
typalign => 'i', typstorage => 'x', typcollation => '100' }, typalign => 'i', typstorage => 'x', typcollation => 'default' },
{ oid => '1082', array_type_oid => '1182', descr => 'date', { oid => '1082', array_type_oid => '1182', descr => 'date',
typname => 'date', typlen => '4', typbyval => 't', typcategory => 'D', typname => 'date', typlen => '4', typbyval => 't', typcategory => 'D',
typinput => 'date_in', typoutput => 'date_out', typreceive => 'date_recv', typinput => 'date_in', typoutput => 'date_out', typreceive => 'date_recv',
......
...@@ -99,7 +99,7 @@ CATALOG(pg_type,1247,TypeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71,TypeRelati ...@@ -99,7 +99,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); Oid typrelid BKI_DEFAULT(0) BKI_ARRAY_DEFAULT(0) BKI_LOOKUP(pg_class);
/* /*
* If typelem is not 0 then it identifies another row in pg_type. The * If typelem is not 0 then it identifies another row in pg_type. The
...@@ -215,7 +215,7 @@ CATALOG(pg_type,1247,TypeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71,TypeRelati ...@@ -215,7 +215,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); Oid typcollation BKI_DEFAULT(0) BKI_LOOKUP(pg_collation);
#ifdef CATALOG_VARLEN /* variable-length fields start here */ #ifdef CATALOG_VARLEN /* variable-length fields start here */
......
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