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: salamsp@gmail.com
Subject: BUG #17352: Column CHECK regex error
Date: Mon, 03 Jan 2022 10:38:48 +0000
Message-ID: <17352-7564a4d9c118056d@postgresql.org> (raw)

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.



view thread (3+ messages)  latest in thread

Message-ID: <17352-7564a4d9c118056d@postgresql.org>
Permalink:  ../17352-7564a4d9c118056d@postgresql.org/
Also on:    postgresql.org/message-id/17352-7564a4d9c118056d@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, salamsp@gmail.com
  Subject: Re: BUG #17352: Column CHECK regex error
  In-Reply-To: <17352-7564a4d9c118056d@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