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 1nbx02-0006UQ-Un for pgsql-sql@arkaria.postgresql.org; Wed, 06 Apr 2022 04:10:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nbx01-00056J-J3 for pgsql-sql@arkaria.postgresql.org; Wed, 06 Apr 2022 04:10:29 +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 1nbx01-00056A-AN for pgsql-sql@lists.postgresql.org; Wed, 06 Apr 2022 04:10:29 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nbwzy-0007W3-W8 for pgsql-sql@lists.postgresql.org; Wed, 06 Apr 2022 04:10:28 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 2364APPb2977558; Wed, 6 Apr 2022 00:10:25 -0400 From: Tom Lane To: Jian He cc: pgsql-sql Subject: Re: Does postgresql know the check condition is valid or not. or can check deduce from multiple conditions In-reply-to: References: Comments: In-reply-to Jian He message dated "Wed, 06 Apr 2022 09:37:55 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2977556.1649218225.1@sss.pgh.pa.us> Date: Wed, 06 Apr 2022 00:10:25 -0400 Message-ID: <2977557.1649218225@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jian He writes: > CREATE TABLE emp (test_check int check ( test_check >1 and test_check > < 0 )); > Even with the above mentioned step, does postgresql know above check > constraint condition always false. No, not explicitly. If the constraint always fails, that is your problem not Postgres'. regards, tom lane