Re: [HACKERS] Add Roman numeral conversion to to_number
| От | Douglas Doole |
|---|---|
| Тема | Re: [HACKERS] Add Roman numeral conversion to to_number |
| Дата | |
| Msg-id | CADE5jYJE2dCzcgERCzHzkDiERqg+--ChxzoS-47n6vy71c3knQ@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: [HACKERS] Add Roman numeral conversion to to_number (Douglas Doole <dougdoole@gmail.com>) |
| Ответы |
Re: [HACKERS] Add Roman numeral conversion to to_number
Re: [HACKERS] Add Roman numeral conversion to to_number |
| Список | 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.
В списке pgsql-hackers по дате отправления: