Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pQ4gY-00036s-Av for pgsql-performance@arkaria.postgresql.org; Thu, 09 Feb 2023 11:01:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pQ4gX-0003Ot-3x for pgsql-performance@arkaria.postgresql.org; Thu, 09 Feb 2023 11:01:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pQ4gW-0003Ob-Ql for pgsql-performance@lists.postgresql.org; Thu, 09 Feb 2023 11:01:48 +0000 Received: from disco.pogo.org.uk ([93.93.128.62]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pQ4gT-00015E-KM for pgsql-performance@lists.postgresql.org; Thu, 09 Feb 2023 11:01:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xwax.org; s=swing; h=Content-Type:MIME-Version:References:Message-ID:In-Reply-To: Subject:cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=QVTQInXdGYUp1lZ6vyFT+aSGhMww/ayvCB0o+rFVuc8=; b=th2uBv7FIkycTorpFmhu3w55mg 3WyeRyk9SF8hHWTdvpBljTIDqMrdYo7cEWTmZc9PY5TYXZFPi60YoZf5BD4sQv2zADInohh1DmdS8 5AVvD5NENzgrUhgUhmkdxPe1btFvADLpts98+/TcV5/mv17+qZnpmbrTu6xoV4u3Feoo=; Received: from [2001:470:1d21:0:428d:5cff:fe1b:f3e5] (helo=stax) by disco.pogo.org.uk with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.95 (FreeBSD)) (envelope-from ) id 1pQ4gI-000HE2-Nc; Thu, 09 Feb 2023 11:01:43 +0000 Received: from localhost (stax.localdomain [local]) by stax.localdomain (OpenSMTPD) with ESMTPA id 35d19a7b; Thu, 9 Feb 2023 11:01:41 +0000 (UTC) Date: Thu, 9 Feb 2023 11:01:41 +0000 (GMT) From: Mark Hills To: "David G. Johnston" cc: pgsql-performance@lists.postgresql.org Subject: Re: Domain check taking place unnecessarily? In-Reply-To: Message-ID: <2302091056380.14752@stax.localdomain> References: <2302081605290.5352@stax.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 8 Feb 2023, David G. Johnston wrote: > On Wed, Feb 8, 2023 at 11:01 AM Mark Hills 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