pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: oytf@drivetagdev.com
Subject: BUG #16512: Character considered as a number by regex but can not convert to numeric
Date: Fri, 26 Jun 2020 10:44:03 +0000
Message-ID: <16512-edabb2cd446b9c51@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      16512
Logged by:          tester375
Email address:      oytf@drivetagdev.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



view thread (2+ messages)  latest in thread

Message-ID: <16512-edabb2cd446b9c51@postgresql.org>
Permalink:  ../16512-edabb2cd446b9c51@postgresql.org/
Also on:    postgresql.org/message-id/16512-edabb2cd446b9c51@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, oytf@drivetagdev.com
  Subject: Re: BUG #16512: Character considered as a number by regex but can not convert to numeric
  In-Reply-To: <16512-edabb2cd446b9c51@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox