From: | Douglas Doole <dougdoole(at)gmail(dot)com> |
---|---|
To: | Oliver Ford <ojford(at)gmail(dot)com> |
Cc: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Add Roman numeral conversion to to_number |
Date: | 2017-09-16 22:42:49 |
Message-ID: | CADE5jYJE2dCzcgERCzHzkDiERqg+--ChxzoS-47n6vy71c3knQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Oliver, I took a look at your tests and they look thorough to me.
One recommendation, instead of having 3999 separate selects to test every
legal roman numeral, why not just do something like this:
do $$
declare
i int;
rn text;
rn_val int;
begin
for i in 1..3999 loop
rn := trim(to_char(i, 'rn'));
rn_val := to_number(rn, 'rn');
if (i <> rn_val) then
raise notice 'Mismatch: i=% rn=% rn_val=%', i, rn, rn_val;
end if;
end loop;
raise notice 'Tested roman numerals 1..3999';
end;
$$;
It's a lot easier to maintain than separate selects.
From | Date | Subject | |
---|---|---|---|
Next Message | Douglas Doole | 2017-09-16 23:29:54 | Re: Add Roman numeral conversion to to_number |
Previous Message | Peter Geoghegan | 2017-09-16 22:33:53 | ICU locales and text/char(n) SortSupport on Windows |