Test improvements and minor code fixes for formatting.c.
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Cc: Maciek Sakrejda <m.sakrejda@gmail.com>,
Hunaid Sohail <hunaidpgml@gmail.com>
Date: 2024-09-08T21:32:16Z
Lists: pgsql-hackers
Attachments
- v1-formatting-test-improvements.patch (text/x-diff) patch v1
Over in the thread about teaching to_number() to handle Roman numerals [1], it was noted that we currently have precisely zero test coverage for to_char()'s existing Roman-numeral code, except in the timestamp code path which shares nothing with the numeric code path. In looking at this, I found that there's also no test coverage for the EEEE, V, or PL format codes. Also, the possibility of overflow while converting an input value to int in order to pass it to int_to_roman was ignored. Attached is a patch that adds more test coverage and cleans up the Roman-numeral code a little bit. BTW, I also discovered that there is a little bit of support for a "B" format code: we can parse it, but then we ignore it. And it's not documented. Oracle defines this code as a flag that: Returns blanks for the integer part of a fixed-point number when the integer part is zero (regardless of zeros in the format model). It doesn't seem super hard to implement that, but given the complete lack of complaints about it being missing, maybe we should just rip out the incomplete support instead? regards, tom lane [1] https://www.postgresql.org/message-id/flat/CAMWA6ybh4M1VQqpmnu2tfSwO%2B3gAPeA8YKnMHVADeB%3DXDEvT_A%40mail.gmail.com
Commits
-
Modernize to_char's Roman-numeral code, fixing overflow problems.
- 147bbc90f757 18.0 landed