Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1etIFc-00071y-4F for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Mar 2018 19:27:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1etIFZ-0008B8-Cx for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Mar 2018 19:27:49 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1etIFY-0008At-UX for pgsql-hackers@lists.postgresql.org; Tue, 06 Mar 2018 19:27:49 +0000 Received: from forward102o.mail.yandex.net ([37.140.190.182]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1etIFV-0007TX-Rj for pgsql-hackers@postgresql.org; Tue, 06 Mar 2018 19:27:47 +0000 Received: from mxback18j.mail.yandex.net (mxback18j.mail.yandex.net [IPv6:2a02:6b8:0:1619::94]) by forward102o.mail.yandex.net (Yandex) with ESMTP id 020915A0568F; Tue, 6 Mar 2018 22:27:42 +0300 (MSK) Received: from localhost (localhost [::1]) by mxback18j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id rf18x9UsNb-RePmv1iS; Tue, 06 Mar 2018 22:27:40 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zsrv.org; s=mail; t=1520364460; bh=4cP5+agQC4B3ymWh+NElG1aZiHHHd7OPUC/tk/0TcOs=; h=From:To:Cc:In-Reply-To:References:Subject:Message-Id:Date; b=sDa//Q2/vzrgNCu2p8GkyTScB0xM6aUbvrT3fL28SQwppPy3RLi93FByRNqp549Lf I9ZJRDm50nfyR4oTPLp2IPBLiuarfi1iB2dn+WM3h2P5QzdT+shRLo0Yl1lTbR6Ve9 OPGNUleGSmft1k2L+BYday89hsW+rrxbwKDgNvAY= Authentication-Results: mxback18j.mail.yandex.net; dkim=pass header.i=@zsrv.org Received: by web24g.yandex.ru with HTTP; Tue, 06 Mar 2018 22:27:40 +0300 From: Sergei Kornilov To: Tom Lane Cc: Alvaro Herrera , Ildar Musin , Stephen Frost , Robert Haas , "pgsql-hackers@postgresql.org" In-Reply-To: <1142.1520362313@sss.pgh.pa.us> References: <880511520351578@web5j.yandex.ru> <20180306172528.xnelm3xcq2qeyd2g@alvherre.pgsql> <1715451520361128@web26o.yandex.ru> <1142.1520362313@sss.pgh.pa.us> Subject: Re: using index or check in ALTER TABLE SET NOT NULL MIME-Version: 1.0 Message-Id: <2091981520364460@web24g.yandex.ru> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Tue, 06 Mar 2018 22:27:40 +0300 Content-Transfer-Encoding: 7bit Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello > Do you actually need test output proving that this code path was taken > rather than the default one? Seems like looking at the code coverage > report might be enough. I not known. In v4 i use DEBUG1 message and do not check code path in tests at all: by full table scan or by constraint, i tested only command result to not break behavior. Today Ildar Musin proposed to test code path through NotNullImpliedByRelConstraints function. This is my first patch and I do not have the confidence to write a test. So I looked more closely at the alter table tests, found several info in attach partition and updated my patch. > I did not see any INFO messages in a quick test of ALTER TABLE ATTACH > PARTITION, but if there are any lurking in there, they probably need > to be downgraded. In src/test/regress/expected/alter_table.out i found 7 test with > INFO: partition constraint for table "..." is implied by existing constraints and 5 with > INFO: updated partition constraint for default partition "..." is implied by existing constraints ereport's are in ValidatePartitionConstraints function src/backend/commands/tablecmds.c regards, Sergei