From: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
To: Michael Paquier <michael@paquier.xyz>
Cc: Amit Langote <amitlangote09@gmail.com>
Cc: exclusion@gmail.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Subject: Re: BUG #15668: Server crash in transformPartitionRangeBounds
Date: Wed, 13 Mar 2019 14:15:24 +0900
Message-ID: <ea8b7d1c-cee1-a062-ee67-2870bf223e64@lab.ntt.co.jp> (raw)
In-Reply-To: <20190311072114.GG1818@paquier.xyz>
References: <15668-0377b1981aa1a393@postgresql.org>
<CA+HiwqEGoa485g18mt9GUdF8fH4mKDgpeoc32XiW-dRUFpN5Lw@mail.gmail.com>
<20190306064825.GH30982@paquier.xyz>
<6ed2c24c-2f73-fa1c-0ed1-ed3597f13d0d@lab.ntt.co.jp>
<20190306082730.GJ30982@paquier.xyz>
<ab51ec5a-b2d3-a25f-5695-7555ad63d344@lab.ntt.co.jp>
<20190311072114.GG1818@paquier.xyz>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: Langote_Amit_f8@lab.ntt.co.jp, michael@paquier.xyz, amitlangote09@gmail.com, pgsql-hackers@postgresql.org, peter.eisentraut@2ndquadrant.com
Subject: Re: BUG #15668: Server crash in transformPartitionRangeBounds
In-Reply-To: <ea8b7d1c-cee1-a062-ee67-2870bf223e64@lab.ntt.co.jp>
References: <15668-0377b1981aa1a393@postgresql.org> <CA+HiwqEGoa485g18mt9GUdF8fH4mKDgpeoc32XiW-dRUFpN5Lw@mail.gmail.com> <20190306064825.GH30982@paquier.xyz> <6ed2c24c-2f73-fa1c-0ed1-ed3597f13d0d@lab.ntt.co.jp> <20190306082730.GJ30982@paquier.xyz> <ab51ec5a-b2d3-a25f-5695-7555ad63d344@lab.ntt.co.jp> <20190311072114.GG1818@paquier.xyz> <ea8b7d1c-cee1-a062-ee67-2870bf223e64@lab.ntt.co.jp>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox