Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gVUJG-0005WM-LJ for pgsql-hackers@arkaria.postgresql.org; Sat, 08 Dec 2018 04:33:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gVUJF-0000pG-73 for pgsql-hackers@arkaria.postgresql.org; Sat, 08 Dec 2018 04:33:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gVUJE-0000p9-Su for pgsql-hackers@lists.postgresql.org; Sat, 08 Dec 2018 04:33:45 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gVUJ8-0003Lu-BW for pgsql-hackers@postgresql.org; Sat, 08 Dec 2018 04:33:43 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id wB84XWt2006106; Fri, 7 Dec 2018 23:33:32 -0500 From: Tom Lane To: Michael Paquier cc: Postgres hackers , Amit Langote Subject: Re: pg_partition_tree crashes for a non-defined relation In-reply-to: <20181207230540.GA12740@paquier.xyz> References: <20181207010406.GO2407@paquier.xyz> <20181207230540.GA12740@paquier.xyz> Comments: In-reply-to Michael Paquier message dated "Sat, 08 Dec 2018 08:05:40 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <6104.1544243612.1@sss.pgh.pa.us> Date: Fri, 07 Dec 2018 23:33:32 -0500 Message-ID: <6105.1544243612@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Michael Paquier writes: > On Fri, Dec 07, 2018 at 10:04:06AM +0900, Michael Paquier wrote: >> I think that we should make the function return NULL if the relation >> defined does not exist, as we usually do for system-facing functions. >> It is also easier for the caller to know that the relation does not >> exist instead of having a plpgsql try/catch wrapper or such. > Are there any objections about fixing this issue? I would rather fix it > sonner than later. Return NULL seems a reasonable behavior. How about cases where the relation OID exists but it's the wrong kind of relation? regards, tom lane