mirror of
https://github.com/postgres/postgres.git
synced 2025-07-11 10:01:57 +03:00
Add index OID macro argument to DECLARE_INDEX
Instead of defining symbols such as AmOidIndexId explicitly, include them as an argument of DECLARE_INDEX() and have genbki.pl generate the way as the table OID symbols from the CATALOG() declaration. Reviewed-by: John Naylor <john.naylor@enterprisedb.com> Discussion: https://www.postgresql.org/message-id/flat/ccef1e46-a404-25b1-9b4c-85f2c08e1f28%40enterprisedb.com
This commit is contained in:
@ -95,7 +95,7 @@ sub ParseHeader
|
||||
{ parent_table => $1, toast_oid => $2, toast_index_oid => $3 };
|
||||
}
|
||||
elsif (
|
||||
/^DECLARE_(UNIQUE_)?INDEX(_PKEY)?\(\s*(\w+),\s*(\d+),\s*(.+)\)/)
|
||||
/^DECLARE_(UNIQUE_)?INDEX(_PKEY)?\(\s*(\w+),\s*(\d+),\s*(\w+),\s*(.+)\)/)
|
||||
{
|
||||
push @{ $catalog{indexing} },
|
||||
{
|
||||
@ -103,7 +103,8 @@ sub ParseHeader
|
||||
is_pkey => $2 ? 1 : 0,
|
||||
index_name => $3,
|
||||
index_oid => $4,
|
||||
index_decl => $5
|
||||
index_oid_macro => $5,
|
||||
index_decl => $6
|
||||
};
|
||||
}
|
||||
elsif (
|
||||
|
@ -469,6 +469,14 @@ EOM
|
||||
printf $def "#define %s %s\n",
|
||||
$catalog->{rowtype_oid_macro}, $catalog->{rowtype_oid}
|
||||
if $catalog->{rowtype_oid_macro};
|
||||
|
||||
foreach my $index (@{ $catalog->{indexing} })
|
||||
{
|
||||
printf $def "#define %s %s\n",
|
||||
$index->{index_oid_macro}, $index->{index_oid}
|
||||
if $index->{index_oid_macro};
|
||||
}
|
||||
|
||||
print $def "\n";
|
||||
|
||||
# .bki CREATE command for this catalog
|
||||
|
4
src/backend/utils/cache/syscache.c
vendored
4
src/backend/utils/cache/syscache.c
vendored
@ -96,8 +96,8 @@
|
||||
|
||||
There must be a unique index underlying each syscache (ie, an index
|
||||
whose key is the same as that of the cache). If there is not one
|
||||
already, add definitions for it to include/catalog/pg_*.h: you need
|
||||
to add a DECLARE_UNIQUE_INDEX macro and a #define for the index OID.
|
||||
already, add the definition for it to include/catalog/pg_*.h using
|
||||
DECLARE_UNIQUE_INDEX.
|
||||
(Adding an index requires a catversion.h update, while simply
|
||||
adding/deleting caches only requires a recompile.)
|
||||
|
||||
|
Reference in New Issue
Block a user