PostgreSQL: How to return roman date with single space delimitation elegantly?

Viewed 97

If I use the standard way to receive a date with roman-numeric months ...

SELECT to_char(DATE '2000 12 05', 'DD RM YYYY') 

PostgreSQL returns multi-spaced (1 to 4) delimited dates:

"05 XII  2000"
"02 VIII 1976"
"02 V    1976"

I notice that RM always returns 5 characters for all possibilities of the month (from small: I to big: VIII)

This was not what I expected. I want single-spaced delimited dates returned. I already came with a solution using regex_replace which might be overkill (?)

SELECT regexp_replace(to_char(DATE '2000 12 05', 'DD RM YYYY'),
                     '(\d+)\s+([IVX]+)\s+(\d+)',E'\\1 \\2 \\3','g');

Which returns single-spaced date results:

"05 XII 2000"
"02 VIII 1976"
"02 V 1976"

Is there a more elegant way to do this? (...Or post a bug in PostgreSQL?)

1 Answers
Related