Re: [PATCH] Add roman support for to_number function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Hunaid Sohail <hunaidpgml(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Maciek Sakrejda <m(dot)sakrejda(at)gmail(dot)com>, Tomas Vondra <tomas(at)vondra(dot)me>
Subject: Re: [PATCH] Add roman support for to_number function
Date: 2025-01-22 20:29:04
Message-ID: 4072617.1737577744@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hunaid Sohail <hunaidpgml(at)gmail(dot)com> writes:
> I have attached a new patch v8 with the following changes:
> 1. Fixed cases reported by Maciek.
> 2. Handles leading spaces in input string.

I pushed this after fooling with it a bit more:

* The way you did the leading-space skip would actually skip
anything whatsoever until it found a valid roman character.
I don't think that's what's wanted here. We just want to
skip whitespace --- the idea more or less is to consume
leading whitespace that to_char('RN') might have emitted.

* You'd also re-introduced failure on trailing whitespace
(or indeed trailing anything), which I still don't agree with.
It's not appropriate for RN to dictate that nothing can follow it.
There's a separate discussion to be had about whether to_number
is too lax about trailing garbage, but the policy should not be
different for RN than it is for other format codes.

* I made some other cosmetic changes such as rearranging the
error checks into an order that made more sense to me.

Thanks for submitting this patch!

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Noah Misch 2025-01-22 20:12:30 Re: Issue with markers in isolation tester? Or not?