ECPG timestamp '%j'
От | Stephen Frost |
---|---|
Тема | ECPG timestamp '%j' |
Дата | |
Msg-id | 20130714233329.GE2511@tamriel.snowman.net обсуждение исходный текст |
Список | pgsql-hackers |
Michael, While looking at complaints from the Coverity scanner system, it looks like it's detected a case in ECPG where we providea "day-of-year" format option (%j), but we never actually calculate what the day of year *is*, resulting in an uninitializedvalue. Other parts of the code (non-ECPG) appears to realize that timestamp2tm doesn't fill in day-of-year in the struct and theycalculate it afterwards. Perhaps ECPG needs to adopt that approach also, perhaps either in dttofmtasc_replace() or PGTYPEStimestamp_fmt_asc()..? I was able to get what I believe is an incorrect result through a bit of hacking on the ECPG test cases: timestamp_fmt_asc: 0: 10922-abc% after adding: out = (char*) malloc(32); i = PGTYPEStimestamp_fmt_asc(&ts1, out, 31, "%j-abc%%"); printf("timestamp_fmt_asc: %d:%s\n", i, out); free(out); into pgtypeslib/dt_test.pgc. If you don't have time to look into this, let me know and I'll try and get back to it soon. Thanks! Stephen
В списке pgsql-hackers по дате отправления: