Re: using expression syntax for partition bounds - Mailing list pgsql-hackers

From Amit Langote
Subject Re: using expression syntax for partition bounds
Date
Msg-id 7130fbea-2caa-987a-8495-caece7433e35@lab.ntt.co.jp
Whole thread Raw
In response to Re: using expression syntax for partition bounds  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: using expression syntax for partition bounds  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List 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

pgsql-hackers by date:

Previous
From: Kyotaro HORIGUCHI
Date:
Subject: Re: Improve selectivity estimate for range queries
Next
From: Tom Lane
Date:
Subject: Re: Use an enum for RELKIND_*?