Re: [PATCH] Add roman support for to_number function - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Re: [PATCH] Add roman support for to_number function
Date
Msg-id CAJ7c6TPf5wCB=xiBybGXYED3+jBqhMP2qtRWMMLgKgxn2KrYrw@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Add roman support for to_number function  (Maciek Sakrejda <m.sakrejda@gmail.com>)
Responses Re: [PATCH] Add roman support for to_number function
List pgsql-hackers
Hi,

> I have attached a new patch v2 with following changes:
>
> - Handled invalid cases like 'viv', 'lxl', and 'dcd'.
> - Changed errcode to 22P07 because 22P06 was already taken.
> - Removed TODO.
> - Added a few positive & negative tests.
> - Updated documentation.
>
> Looking forward to your feedback.

While playing with the patch I noticed that to_char(..., 'RN') doesn't
seem to be test-covered. I suggest adding the following test:

```
WITH rows AS (
    SELECT i, to_char(i, 'FMRN') AS roman
    FROM generate_series(1, 3999) AS i
) SELECT bool_and(to_number(roman, 'RN') = i) FROM rows;

 bool_and
----------
 t
```

... in order to fix this while on it. The query takes ~12 ms on my laptop.

-- 
Best regards,
Aleksander Alekseev



pgsql-hackers by date:

Previous
From: Nazir Bilal Yavuz
Date:
Subject: Re: meson vs. llvm bitcode files
Next
From: Amit Kapila
Date:
Subject: Re: long-standing data loss bug in initial sync of logical replication