Thread
Commits
-
Avoid portability issues in autoprewarm.c.
- cddc4dc6c6c9 11.0 landed
-
Unportable code in autoprewarm.c
Tom Lane <tgl@sss.pgh.pa.us> — 2018-05-02T19:21:49Z
I've been going through compiler warnings from the buildfarm, and I notice jacana is unhappy about this: /* First line of the file is a record count. */ if (fscanf(file, "<<" INT64_FORMAT ">>\n", &num_elements) != 1) It's entirely correct to complain, because we only guarantee that INT64_FORMAT works with snprintf, not with the scanf family of functions. Is there a reason why this record count needs to be int64 rather than plain int, and if so what? This code is not exactly well documented, but it looks to me like the number of records should be bounded by NBuffers, which is an int and is unlikely ever to not be an int. So I'm inclined to just flush autoprewarm.c's use of int64 counters altogether. regards, tom lane
-
Re: Unportable code in autoprewarm.c
Robert Haas <robertmhaas@gmail.com> — 2018-05-03T00:24:38Z
On Wed, May 2, 2018 at 3:21 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > Is there a reason why this record count needs to be int64 rather than > plain int, and if so what? This code is not exactly well documented, > but it looks to me like the number of records should be bounded by > NBuffers, which is an int and is unlikely ever to not be an int. > So I'm inclined to just flush autoprewarm.c's use of int64 counters > altogether. I don't know of a reason not to make that change. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company