BUG #17352: Column CHECK regex error

Поиск
Список
Период
Сортировка
Искать
От
PG Bug reporting form
Тема
BUG #17352: Column CHECK regex error
Дата
Msg-id
17352-7564a4d9c118056d@postgresql.org
Список
Дерево обсуждения
BUG #17352: Column CHECK regex error PG Bug reporting form <noreply@postgresql.org>
Re: BUG #17352: Column CHECK regex error Vik Fearing <vik@postgresfriends.org>
Re: BUG #17352: Column CHECK regex error Francisco Olarte <folarte@peoplecall.com>
The following bug has been logged on the website:

Bug reference:      17352
Logged by:          Serge Salamatin
Email address:      salamsp@gmail.com
PostgreSQL version: 13.5
Operating system:   Ubuntu 13.5-2.pgdg20.04+1
Description:        

select '01' ~ '^[\d-]{2,8}$'  -> true, 

but in next

CREATE TABLE IF NOT EXISTS public.mnu
(
    mnunm character(10) COLLATE pg_catalog."default" NOT NULL,
    code character(8) COLLATE pg_catalog."default" NOT NULL
      CONSTRAINT "Only digits" CHECK (code ~ '^[\d-]{2,8}$'),
    txt citext COLLATE pg_catalog."default" NOT NULL,
    ui_id bigint,
    action citext COLLATE pg_catalog."default",
    tip citext COLLATE pg_catalog."default",
    CONSTRAINT mnu_pkey PRIMARY KEY (mnunm, code, txt)
);

INSERT INTO public.mnu (
mnunm , code , txt , ui_id , action , tip 
  )
  OVERRIDING USER VALUE VALUES(
  'p977main' , '01' , 'Tables def' , DEFAULT , '' , '' 
  );

returns  ->

"ERROR:  new row for relation "mnu" violates check constraint "Only
digits"
DETAIL:  Failing row contains (p977main  , 01      , Tables def, null, ,
).
SQL state: 23514"

If we drop CONSTRAINT "Only digits" that insert will be done properly.
If we change  column into character varying(8) and left CONSTRAINT "Only
digits" 
that insert will be done without error.

В списке pgsql-bugs по дате отправления
От: Alexander Lakhin
Дата:
От: Francisco Olarte
Дата:
FAQ