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 1h3wF4-0000Dn-Hx for pgsql-bugs@arkaria.postgresql.org; Wed, 13 Mar 2019 05:15:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h3wF1-0008Dn-GR for pgsql-bugs@arkaria.postgresql.org; Wed, 13 Mar 2019 05:15:47 +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 1h3wF1-00088v-6Y for pgsql-bugs@lists.postgresql.org; Wed, 13 Mar 2019 05:15:47 +0000 Received: from tama50.ecl.ntt.co.jp ([129.60.39.147]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h3wEu-000612-3m for pgsql-bugs@lists.postgresql.org; Wed, 13 Mar 2019 05:15:46 +0000 Received: from vc1.ecl.ntt.co.jp (vc1.ecl.ntt.co.jp [129.60.86.153]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id x2D5FZ7k006512; Wed, 13 Mar 2019 14:15:35 +0900 Received: from vc1.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id B47DAEA71C8; Wed, 13 Mar 2019 14:15:35 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id A9DADEA71B4; Wed, 13 Mar 2019 14:15:35 +0900 (JST) Received: from [127.0.0.1] (unknown [129.60.241.61]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id 996F0400794; Wed, 13 Mar 2019 14:15:35 +0900 (JST) Subject: Re: BUG #15668: Server crash in transformPartitionRangeBounds References: <15668-0377b1981aa1a393@postgresql.org> <20190306064825.GH30982@paquier.xyz> <6ed2c24c-2f73-fa1c-0ed1-ed3597f13d0d@lab.ntt.co.jp> <20190306082730.GJ30982@paquier.xyz> <20190311072114.GG1818@paquier.xyz> From: Amit Langote Message-ID: Date: Wed, 13 Mar 2019 14:15:24 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.3 MIME-Version: 1.0 In-Reply-To: <20190311072114.GG1818@paquier.xyz> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CC-Mail-RelayStamp: 1 To: Michael Paquier Cc: Amit Langote , exclusion@gmail.com, PostgreSQL mailing lists , PostgreSQL-development , Peter Eisentraut X-TM-AS-MML: disable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019/03/11 16:21, Michael Paquier wrote: > On Mon, Mar 11, 2019 at 03:44:39PM +0900, Amit Langote wrote: >> We could make the error message more meaningful depending on the context, >> but maybe it'd better be pursue it as a separate project. > > Yeah, I noticed that stuff when working on it this afternoon. The > error message does not completely feel right even in your produced > tests. Out of curiosity I have been working on this thing myself, > and it is possible to have a context-related message. Please see > attached, that's in my opinion less confusing, and of course > debatable. Still this approach does not feel completely right either > as that means hijacking the code path which generates a generic > message for missing RTEs. :( @@ -3259,6 +3259,9 @@ errorMissingRTE(ParseState *pstate, RangeVar + * + * Also, in the context of parsing a partition bound, produce a more + * helpful error message. */ if (rte && rte->alias && strcmp(rte->eref->aliasname, relation->relname) != 0 && - if (rte) + if (pstate->p_expr_kind == EXPR_KIND_PARTITION_BOUND) + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_TABLE), + errmsg("invalid reference in partition bound expression for table \"%s\"", + relation->relname))); + else if (rte) Hmm, it seems odd to me that it's OK for default expressions to emit the "missing RTE" error, whereas partition bound expressions would emit this special error message? create table foo (a int default (bar.a)); ERROR: missing FROM-clause entry for table "bar" Thanks, Amit