Re: BUG #16512: Character considered as a number by regex but can not convert to numeric

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: oytf(at)drivetagdev(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16512: Character considered as a number by regex but can not convert to numeric
Date: 2020-06-26 13:33:02
Message-ID: 2355328.1593178382@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> When installed Postgresql 12.3 for testing purposes we have discovered
> following possible bug:
> Character "8" (different from standard number 8) is treated as a number by
> regular expression
> ~'\d+'
> but can not be converted to numeric by
> ::numeric

I see no reason to consider this a bug.

The set of characters matched by \d is, as documented, dependent on
your collation choice or locale settings (LC_CTYPE in particular).
We are not going to try to guess at what random Unicode glyphs might
be included in a particular locale, much less make numeric_in take
them all.

If you want to know whether a string is acceptable to numeric_in
I'd suggest writing something based around [0-9] not \d.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Sandeep Thakkar 2020-06-26 14:05:31 Re: install SQL issue
Previous Message NG Chia Wee 2020-06-26 13:27:34 Re: install SQL issue