1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Restructure DECLARE_INDEX arguments

Separate the table name from the index declaration.  We need that
anyway later for the ALTER TABLE / USING INDEX commands, so we might
as well structure the declarations like that to begin with.

Discussion: https://www.postgresql.org/message-id/flat/75ae5875-3abc-dafc-8aec-73247ed41cde@eisentraut.org
This commit is contained in:
Peter Eisentraut
2023-08-31 08:14:57 +02:00
parent b5934bfd60
commit 226d0a6b98
67 changed files with 133 additions and 133 deletions

View File

@@ -117,6 +117,7 @@ sub ParseHeader
(?<index_name>\w+),\s*
(?<index_oid>\d+),\s*
(?<index_oid_macro>\w+),\s*
(?<table_name>\w+),\s*
(?<index_decl>.+)\s*
\)/x
)

View File

@@ -135,19 +135,18 @@ foreach my $header (@ARGV)
foreach my $index (@{ $catalog->{indexing} })
{
push @index_decls,
sprintf "declare %sindex %s %s %s\n",
sprintf "declare %sindex %s %s on %s using %s\n",
$index->{is_unique} ? 'unique ' : '',
$index->{index_name}, $index->{index_oid},
$index->{table_name},
$index->{index_decl};
$oidcounts{ $index->{index_oid} }++;
if ($index->{is_unique})
{
$index->{index_decl} =~ /on (\w+) using/;
my $tblname = $1;
push @system_constraints,
sprintf "ALTER TABLE %s ADD %s USING INDEX %s;",
$tblname,
$index->{table_name},
$index->{is_pkey} ? "PRIMARY KEY" : "UNIQUE",
$index->{index_name};
}