mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
Index tuple data arrays using Anum_xxx symbolic constants instead of "i++".
We had already converted most places to this style, but this patch gets the last few that were still doing it the old way. The main advantage is that this exposes a greppable name for each target column, rather than having to rely on comments (which a couple of places failed to provide anyhow). Richard Hopkins, additional work by me to clean up update_attstats() too
This commit is contained in:
@ -1603,21 +1603,23 @@ update_attstats(Oid relid, bool inh, int natts, VacAttrStats **vacattrstats)
|
||||
replaces[i] = true;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
values[i++] = ObjectIdGetDatum(relid); /* starelid */
|
||||
values[i++] = Int16GetDatum(stats->attr->attnum); /* staattnum */
|
||||
values[i++] = BoolGetDatum(inh); /* stainherit */
|
||||
values[i++] = Float4GetDatum(stats->stanullfrac); /* stanullfrac */
|
||||
values[i++] = Int32GetDatum(stats->stawidth); /* stawidth */
|
||||
values[i++] = Float4GetDatum(stats->stadistinct); /* stadistinct */
|
||||
values[Anum_pg_statistic_starelid - 1] = ObjectIdGetDatum(relid);
|
||||
values[Anum_pg_statistic_staattnum - 1] = Int16GetDatum(stats->attr->attnum);
|
||||
values[Anum_pg_statistic_stainherit - 1] = BoolGetDatum(inh);
|
||||
values[Anum_pg_statistic_stanullfrac - 1] = Float4GetDatum(stats->stanullfrac);
|
||||
values[Anum_pg_statistic_stawidth - 1] = Int32GetDatum(stats->stawidth);
|
||||
values[Anum_pg_statistic_stadistinct - 1] = Float4GetDatum(stats->stadistinct);
|
||||
i = Anum_pg_statistic_stakind1 - 1;
|
||||
for (k = 0; k < STATISTIC_NUM_SLOTS; k++)
|
||||
{
|
||||
values[i++] = Int16GetDatum(stats->stakind[k]); /* stakindN */
|
||||
}
|
||||
i = Anum_pg_statistic_staop1 - 1;
|
||||
for (k = 0; k < STATISTIC_NUM_SLOTS; k++)
|
||||
{
|
||||
values[i++] = ObjectIdGetDatum(stats->staop[k]); /* staopN */
|
||||
}
|
||||
i = Anum_pg_statistic_stanumbers1 - 1;
|
||||
for (k = 0; k < STATISTIC_NUM_SLOTS; k++)
|
||||
{
|
||||
int nnum = stats->numnumbers[k];
|
||||
@ -1641,6 +1643,7 @@ update_attstats(Oid relid, bool inh, int natts, VacAttrStats **vacattrstats)
|
||||
values[i++] = (Datum) 0;
|
||||
}
|
||||
}
|
||||
i = Anum_pg_statistic_stavalues1 - 1;
|
||||
for (k = 0; k < STATISTIC_NUM_SLOTS; k++)
|
||||
{
|
||||
if (stats->numvalues[k] > 0)
|
||||
|
Reference in New Issue
Block a user