Re: using expression syntax for partition bounds

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, peter(dot)eisentraut(at)2ndquadrant(dot)com, pgsql-hackers(at)postgresql(dot)org, tgl(at)sss(dot)pgh(dot)pa(dot)us
Subject: Re: using expression syntax for partition bounds
Date: 2019-01-24 12:57:26
Message-ID: 7130fbea-2caa-987a-8495-caece7433e35@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Thanks for looking.

On 2019/01/24 21:00, Alvaro Herrera wrote:
> Why did you lose the parser_errposition in parse_utilcmd.c line 3854?
>
>> - /* Fail if we don't have a constant (i.e., non-immutable coercion) */
>> - if (!IsA(value, Const))
>> + /* Make sure the expression does not refer to any vars. */
>> + if (contain_var_clause(value))
>> ereport(ERROR,
>> - (errcode(ERRCODE_DATATYPE_MISMATCH),
>> - errmsg("specified value cannot be cast to type %s for column \"%s\"",
>> - format_type_be(colType), colName),
>> - errdetail("The cast requires a non-immutable conversion."),
>> - errhint("Try putting the literal value in single quotes."),
>> - parser_errposition(pstate, con->location)));
>> + (errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
>> + errmsg("cannot use column references in partition bound expression")));

The if (contain_var_clause(value)) block is new code, but I agree its
ereport should have parser_errposition just like other ereports in that
function. Fixed that in the attached.

Thanks,
Amit

Attachment Content-Type Size
v11-0001-Allow-generalized-expression-syntax-for-partitio.patch text/plain 35.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2019-01-24 14:28:30 Re: pgsql: Detach constraints when partitions are detached
Previous Message Kyotaro HORIGUCHI 2019-01-24 12:50:56 Re: Improve selectivity estimate for range queries