Re: BUG #16512: Character considered as a number by regex but can not convert to numeric - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #16512: Character considered as a number by regex but can not convert to numeric
Date
Msg-id 2355328.1593178382@sss.pgh.pa.us
Whole thread Raw
In response to BUG #16512: Character considered as a number by regex but can not convert to numeric  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #16512: Character considered as a number by regex but can not convert to numeric  (tester357 <tester357.postgres@email.cz>)
List pgsql-bugs
PG Bug reporting form <noreply@postgresql.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



pgsql-bugs by date:

Previous
From: NG Chia Wee
Date:
Subject: Re: install SQL issue
Next
From: Sandeep Thakkar
Date:
Subject: Re: install SQL issue