1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-28 18:48:04 +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:
Tom Lane
2011-06-16 17:03:58 -04:00
parent 7357558fc8
commit bfcb9328e5
5 changed files with 114 additions and 121 deletions

View File

@@ -157,11 +157,10 @@ CreateComments(Oid oid, Oid classoid, int32 subid, char *comment)
nulls[i] = false;
replaces[i] = true;
}
i = 0;
values[i++] = ObjectIdGetDatum(oid);
values[i++] = ObjectIdGetDatum(classoid);
values[i++] = Int32GetDatum(subid);
values[i++] = CStringGetTextDatum(comment);
values[Anum_pg_description_objoid - 1] = ObjectIdGetDatum(oid);
values[Anum_pg_description_classoid - 1] = ObjectIdGetDatum(classoid);
values[Anum_pg_description_objsubid - 1] = Int32GetDatum(subid);
values[Anum_pg_description_description - 1] = CStringGetTextDatum(comment);
}
/* Use the index to search for a matching old tuple */
@@ -257,10 +256,9 @@ CreateSharedComments(Oid oid, Oid classoid, char *comment)
nulls[i] = false;
replaces[i] = true;
}
i = 0;
values[i++] = ObjectIdGetDatum(oid);
values[i++] = ObjectIdGetDatum(classoid);
values[i++] = CStringGetTextDatum(comment);
values[Anum_pg_shdescription_objoid - 1] = ObjectIdGetDatum(oid);
values[Anum_pg_shdescription_classoid - 1] = ObjectIdGetDatum(classoid);
values[Anum_pg_shdescription_description - 1] = CStringGetTextDatum(comment);
}
/* Use the index to search for a matching old tuple */