Re: BUG #15668: Server crash in transformPartitionRangeBounds

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Amit Langote <amitlangote09(at)gmail(dot)com>, exclusion(at)gmail(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Subject: Re: BUG #15668: Server crash in transformPartitionRangeBounds
Date: 2019-03-13 05:15:24
Message-ID: ea8b7d1c-cee1-a062-ee67-2870bf223e64@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Amit Langote 2019-03-13 06:17:47 Re: BUG #15668: Server crash in transformPartitionRangeBounds
Previous Message PG Bug reporting form 2019-03-13 04:54:15 BUG #15690: PostgreSQL integration with AD via LDAP and special characters in the password

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhang, Jie 2019-03-13 05:43:04 RE: [PATCH] remove repetitive characters in fdwhandler.sgml
Previous Message Michael Paquier 2019-03-13 05:03:31 Re: pgsql: Add support for hyperbolic functions, as well as log10().