Replace time_t with pg_time_t (same values, but always int64) in on-disk
Tom Lane <tgl@sss.pgh.pa.us>
Replace time_t with pg_time_t (same values, but always int64) in on-disk data structures and backend internal APIs. This solves problems we've seen recently with inconsistent layout of pg_control between machines that have 32-bit time_t and those that have already migrated to 64-bit time_t. Also, we can get out from under the problem that Windows' Unix-API emulation is not consistent about the width of time_t. There are a few remaining places where local time_t variables are used to hold the current or recent result of time(NULL). I didn't bother changing these since they do not affect any cross-module APIs and surely all platforms will have 64-bit time_t before overflow becomes an actual risk. time_t should be avoided for anything visible to extension modules, however.
Files
| Path | Change | +/− |
|---|---|---|
| contrib/pgcrypto/internal.c | modified | +3 −2 |
| src/backend/access/transam/xlog.c | modified | +13 −13 |
| src/backend/postmaster/bgwriter.c | modified | +11 −11 |
| src/backend/postmaster/syslogger.c | modified | +2 −2 |
| src/backend/utils/adt/date.c | modified | +6 −5 |
| src/backend/utils/adt/datetime.c | modified | +6 −4 |
| src/backend/utils/adt/nabstime.c | modified | +4 −7 |
| src/backend/utils/adt/timestamp.c | modified | +16 −6 |
| src/backend/utils/init/globals.c | modified | +2 −2 |
| src/bin/pg_controldata/pg_controldata.c | modified | +11 −3 |
| src/bin/pg_resetxlog/pg_resetxlog.c | modified | +5 −5 |
| src/include/access/xlog_internal.h | modified | +4 −5 |
| src/include/catalog/pg_control.h | modified | +5 −6 |
| src/include/miscadmin.h | modified | +3 −3 |
| src/include/port/win32.h | modified | +2 −12 |
| src/include/utils/timestamp.h | modified | +3 −3 |
| src/tools/msvc/Project.pm | modified | +2 −2 |