pgsql: Remove hard coded formats for INT64 and use configured settings

Started by Andrew Dunstanabout 15 years ago2 messagescomitters
Jump to latest
#1Andrew Dunstan
andrew@dunslane.net

Remove hard coded formats for INT64 and use configured settings instead.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/9b1508af8971c1627cda5bb65f5e9eddb9a1a55e

Modified Files
--------------
src/backend/postmaster/postmaster.c | 2 +-
src/interfaces/ecpg/ecpglib/execute.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Dunstan (#1)
Re: pgsql: Remove hard coded formats for INT64 and use configured settings

Andrew Dunstan <andrew@dunslane.net> writes:

Remove hard coded formats for INT64 and use configured settings instead.

I don't find this patch to be a good idea. The code was unconditionally
correct before, and now it isn't:

-                       sprintf(mallocedval + strlen(mallocedval), "%lld,", ((long long int *) var->value)[element]);
+                       sprintf(mallocedval + strlen(mallocedval), INT64_FORMAT ",", ((long long int *) var->value)[element]);

"long long int" will match "%lld" by definition. It matches
INT64_FORMAT only if "long long int" is 64 bits. What's more,
this change will probably result in adding not subtracting warnings
on platforms where configure selects "%ld" for INT64_FORMAT.

Please revert.

regards, tom lane