Re: Domain check taking place unnecessarily?

From: Mark Hills <mark(at)xwax(dot)org>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: Domain check taking place unnecessarily?
Date: 2023-02-09 11:01:41
Message-ID: 2302091056380.14752@stax.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Wed, 8 Feb 2023, David G. Johnston wrote:

> On Wed, Feb 8, 2023 at 11:01 AM Mark Hills <mark(at)xwax(dot)org> wrote:
>
> >
> > CREATE DOMAIN hash AS text
> > CHECK (VALUE ~ E'^[a-zA-Z0-9]{8,32}$');
> >
> > devstats=> ALTER TABLE invite ADD COLUMN test hash;
> > ALTER TABLE
> > Time: 30923.380 ms (00:30.923)
> >
>
> Necessarily, I presume because if you decided that the check on the domain
> should be "value is not null" (don't do this though...) the column addition
> would have to fail for existing rows (modulo defaults...).

I'm not sure I'm parsing this paragraph correctly, but the existing rows
don't provide any data to the domain check. Perhaps you could clarify.

Many thanks

--
Mark

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2023-02-09 15:10:01 Re: Domain check taking place unnecessarily?
Previous Message Mark Hills 2023-02-09 10:56:35 Re: Domain check taking place unnecessarily?