From c2b8ec4f3371c34e5020d247cf5da563393bac05 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 13 Nov 2026 10:58:53 +0100 Subject: [PATCH 2/5] Remove strftime workaround for MinGW MinGW used to warn about the strftime placeholders %G and %V (and possibly %g, but that was already covered by the y2k workaround). This was essentially correct because the msvcrt runtime didn't support those. So the PostgreSQL code was contorted to avoid the warnings (commit c49e4ae1f88), similar to the -Wformat-y2k workarounds. But this seems to be obsolete. The UCRT runtime supports these formats, and as of gcc 14, the warnings are gone. --- src/interfaces/ecpg/pgtypeslib/timestamp.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/interfaces/ecpg/pgtypeslib/timestamp.c b/src/interfaces/ecpg/pgtypeslib/timestamp.c index 98f8a98d028..0d8ceaa5cce 100644 --- a/src/interfaces/ecpg/pgtypeslib/timestamp.c +++ b/src/interfaces/ecpg/pgtypeslib/timestamp.c @@ -416,11 +416,8 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm *tm, */ case 'G': { - /* Keep compiler quiet - Don't use a literal format */ - const char *fmt = "%G"; - tm->tm_mon -= 1; - i = strftime(q, *pstr_len, fmt, tm); + i = strftime(q, *pstr_len, "%G", tm); if (i == 0) return -1; while (*q) @@ -594,10 +591,7 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm *tm, */ case 'V': { - /* Keep compiler quiet - Don't use a literal format */ - const char *fmt = "%V"; - - i = strftime(q, *pstr_len, fmt, tm); + i = strftime(q, *pstr_len, "%V", tm); if (i == 0) return -1; while (*q) -- 2.56.0