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

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: oytf(at)drivetagdev(dot)com
Subject: BUG #16512: Character considered as a number by regex but can not convert to numeric
Date: 2020-06-26 10:44:03
Message-ID: 16512-edabb2cd446b9c51@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 16512
Logged by: tester375
Email address: oytf(at)drivetagdev(dot)com
PostgreSQL version: 12.3
Operating system: Windows 10
Description:

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

How to reproduce the bug:
Command:
SELECT '8' ~ '\d+'
returns "false" for PostgreSQL 10.4 on both Windows 10 and CentOS Linux 7
returns "false" for PostgreSQL 11.5 on CentOS Linux 7
returns "true" for PostgreSQL 12.3 on Windows 10 - but in this case,
character still can not be converted to numeric.

This behavior causes obvious problems when using data type conversion
like:
CASE WHEN column1 ~ '\d+' THEN column1::numeric AS column2
Error: '8' can not be cast to numeric

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Sandeep Thakkar 2020-06-26 11:34:28 Re: install SQL issue
Previous Message Tom Lane 2020-06-25 18:00:37 Re: BUG #16511: Using '= all ( )' with empty table returns true