summaryrefslogtreecommitdiff
path: root/src/include/utils
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2021-02-10 13:09:12 +0900
committerMichael Paquier <michael@paquier.xyz>2021-02-10 13:09:12 +0900
commit85edb1f2615d48bdc2420b00c55286eef3a3244c (patch)
treeceef87f0f2c394b3f60a0e6926f2aa59aed16c00 /src/include/utils
parent1b9eb7cde7e9cdacd62d206b75ab66bfe6a9a0a4 (diff)
Preserve pg_attribute.attstattarget across REINDEX CONCURRENTLY
For an index, attstattarget can be updated using ALTER INDEX SET STATISTICS. This data was lost on the new index after REINDEX CONCURRENTLY. The update of this field is done when the old and new indexes are swapped to make the fix back-patchable. Another approach we could look after in the long-term is to change index_create() to pass the wanted values of attstattarget when creating the new relation, but, as this would cause an ABI breakage this can be done only on HEAD. Reported-by: Ronan Dunklau Author: Michael Paquier Reviewed-by: Ronan Dunklau, Tomas Vondra Discussion: https://postgr.es/m/16628084.uLZWGnKmhe@laptop-ronand Backpatch-through: 12
Diffstat (limited to 'src/include/utils')
-rw-r--r--src/include/utils/lsyscache.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h
index 7c858be98df..53d4a2d1093 100644
--- a/src/include/utils/lsyscache.h
+++ b/src/include/utils/lsyscache.h
@@ -86,6 +86,7 @@ extern Oid get_opfamily_proc(Oid opfamily, Oid lefttype, Oid righttype,
int16 procnum);
extern char *get_attname(Oid relid, AttrNumber attnum, bool missing_ok);
extern AttrNumber get_attnum(Oid relid, const char *attname);
+extern int get_attstattarget(Oid relid, AttrNumber attnum);
extern char get_attgenerated(Oid relid, AttrNumber attnum);
extern Oid get_atttype(Oid relid, AttrNumber attnum);
extern void get_atttypetypmodcoll(Oid relid, AttrNumber attnum,