Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fx2dx-0007x2-Bw for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Sep 2018 04:08:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fx2du-0001V5-Vs for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Sep 2018 04:08:42 +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 1fx2du-0001Uy-Gb for pgsql-hackers@lists.postgresql.org; Tue, 04 Sep 2018 04:08:42 +0000 Received: from mail-qt0-x241.google.com ([2607:f8b0:400d:c0d::241]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fx2dq-0000IF-H2 for pgsql-hackers@postgresql.org; Tue, 04 Sep 2018 04:08:40 +0000 Received: by mail-qt0-x241.google.com with SMTP id t39-v6so2560852qtc.8 for ; Mon, 03 Sep 2018 21:08:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=Md8bCUuztjkn2EkOOBaclnMkeOs9F7shqCrP2qAk2h4=; b=wT1M2Fa1IbbyTczb4NUz2YuBnlF8BAfeDs9//pmhOZyVZo15DuDZiFDKN6Cvl37u8m xil4k07Dz1pPpEQ7QyYIgHn6tNFeOfzAeHL3toVd45qBqmaFCxpdckrjepz1M3E09lWe tU7X3AukssvNtFtI4r4VkMakfErs7GWD3gxfm6kHW1hW+w6pkOl+y/1Ukb7NuYbKY6Kr QS1TXqA8eNuOra6ZsKtuKs0DFLM4+c8pEyvCPGsdEnLrcR2S9QRRc5ijGieGcL0FDzT4 YP37JHqd8Tu3o7b8Ee1Q9AOffZYV7A5LzQDL1+4XC+d/2/r2+10qyZ4r+cfZOkUwl2vE ORbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=Md8bCUuztjkn2EkOOBaclnMkeOs9F7shqCrP2qAk2h4=; b=T2M5BhWpgXzDkRKhd/S6BIDrbL8oyrhPllNeRBgApBIVVsX4g4IIWbRr39r21WK556 caW2EdsOJMVBhx5rB3HonJvNxQmDepcEGmBfH4XnNA2vFubAFAk2JIRzytjbyZ6oLjrB qaV8Hh6GKXJ1VXuwSFNmIqUQ+KU6JB0ytf4t3BJ5x4L0X+NLs72Yy2xsAWHAMcZRhnlo T3hOcgjsmLHD/76leH/WS2xraHPtnZIE2T2uhiZ3Y+Y113PDFJkHp9Vjdx77kuRIEXVM uJnXMi/9wRekonqUs0RAStTp/hwyvlk1rgQIYGby+o50ofTcW/cqw+jNuFyWiwehgGnD VzWA== X-Gm-Message-State: APzg51DjUIDAIad5oETvL+dwNk3agjNMKaeWP/Pm0odlAdXM+Dh2zOlh T8b1NNdHF0eB1jy4/t/0bcTNTg== X-Google-Smtp-Source: ANB0VdbxUYv5x3Q+SGpc6dB2yu8Zfm0dKgsUqyp18yP5U8Q8P2bSy01zcCzbKjAwgfABPjwXW/jIgQ== X-Received: by 2002:a0c:da0c:: with SMTP id x12-v6mr27349590qvj.123.1536034117601; Mon, 03 Sep 2018 21:08:37 -0700 (PDT) Received: from alvin.alvh.no-ip.org ([201.186.81.219]) by smtp.gmail.com with ESMTPSA id a10-v6sm8783270qkj.60.2018.09.03.21.08.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Sep 2018 21:08:37 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id E5CFC443; Tue, 4 Sep 2018 01:08:34 -0300 (-03) Date: Tue, 4 Sep 2018 01:08:34 -0300 From: Alvaro Herrera To: Amit Langote Cc: Michael Paquier , Pg Hackers Subject: Re: pointless check in RelationBuildPartitionDesc Message-ID: <20180904040834.vjmixztatyrqklp5@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170306-137-4415bd-dirty (1.8.0) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2018-Sep-04, Amit Langote wrote: > On 2018/09/04 10:19, Michael Paquier wrote: > > On Tue, Sep 04, 2018 at 09:47:07AM +0900, Amit Langote wrote: > >> On 2018/09/04 6:39, Alvaro Herrera wrote: > >>> After looking, it seems that this is just self-inflicted pain: for some > >>> reason, we store the pg_inherits row for a partition, and immediately > >>> afterwards compute and store its partition bound, which requires the > >>> above hack. But if we do things in the opposite order, this is no > >>> longer needed. I propose to remove it, as in the attached patch. > >> > >> +1. I remember having facepalmed at this before and had also written a > >> patch but never got around to submitting it. > > > > Ok, I see. It seems to me that this could be replaced by an > > elog(ERROR), as relispartition ought to be set anyway. This way any > > future callers would get things done in the correct order. > > Converting it to elog(ERROR, ...) might be a good idea. I think it'd be pointless noise. If we really want to protect against that, I think we should promote the Assert for relpartbound's isnull flag into an if test. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services