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

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #16512: Character considered as a number by regex but can not convert to numeric
Дата
Msg-id 16512-edabb2cd446b9c51@postgresql.org
обсуждение исходный текст
Ответы Re: BUG #16512: Character considered as a number by regex but can not convert to numeric  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
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


В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #16511: Using '= all ( )' with empty table returns true
Следующее
От: Sandeep Thakkar
Дата:
Сообщение: Re: install SQL issue