diff options
| author | Tom Lane | 2025-02-26 21:36:11 +0000 |
|---|---|---|
| committer | Tom Lane | 2025-02-26 21:36:20 +0000 |
| commit | 40e27d04b4f643cfb78af8db42a1f2e700ec9876 (patch) | |
| tree | 80c8df6b40ca3eaec64fcebfff9eb4c3cd2fd824 /src/bin/pg_dump/pg_dump.h | |
| parent | f734c9fc3a91959c2473a1e33fd9b60116902175 (diff) | |
Use attnum to identify index columns in pg_restore_attribute_stats().
Previously we used attname for both table and index columns, but
that is problematic for indexes because their attnames are assigned
by internal rules that don't guarantee to preserve the names across
dump and reload. (This is what's causing the remaining buildfarm
failures in cross-version-upgrade tests.) Fortunately we can use
attnum instead, since there's no such thing as adding or dropping
columns in an existing index. We met this same problem previously
with ALTER INDEX ... SET STATISTICS, and solved it the same way,
cf commit 5b6d13eec.
In pg_restore_attribute_stats() itself, we accept either attnum or
attname, but the policy used by pg_dump is to always use attname
for tables and attnum for indexes.
Author: Tom Lane <[email protected]>
Author: Corey Huinker <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/bin/pg_dump/pg_dump.h')
| -rw-r--r-- | src/bin/pg_dump/pg_dump.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/bin/pg_dump/pg_dump.h b/src/bin/pg_dump/pg_dump.h index 9d6a4857c4b..ca32f167878 100644 --- a/src/bin/pg_dump/pg_dump.h +++ b/src/bin/pg_dump/pg_dump.h @@ -442,6 +442,13 @@ typedef struct _relStatsInfo float reltuples; int32 relallvisible; char relkind; /* 'r', 'm', 'i', etc */ + + /* + * indAttNames/nindAttNames are populated only if the relation is an index + * with at least one expression column; we don't need them otherwise. + */ + char **indAttNames; /* attnames of the index, in order */ + int32 nindAttNames; /* number of attnames stored (can be 0) */ bool postponed_def; /* stats must be postponed into post-data */ } RelStatsInfo; |
