mirror of
https://github.com/postgres/postgres.git
synced 2025-08-21 10:42:50 +03:00
Provide an error cursor for "can't subscript" error messages.
Commit c7aba7c14
didn't add this, but after more fooling with the
feature I feel that it'd be useful. To make this possible, refactor
getSubscriptingRoutines() so that the caller is responsible for
throwing any error. (In clauses.c, I just chose to make the
most conservative assumption rather than throwing an error. We don't
expect failures there anyway really, so the code space for an error
message would be a poor investment.)
This commit is contained in:
@@ -271,6 +271,12 @@ transformContainerSubscripts(ParseState *pstate,
|
||||
* functions and typelem.
|
||||
*/
|
||||
sbsroutines = getSubscriptingRoutines(containerType, &elementType);
|
||||
if (!sbsroutines)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
||||
errmsg("cannot subscript type %s because it does not support subscripting",
|
||||
format_type_be(containerType)),
|
||||
parser_errposition(pstate, exprLocation(containerBase))));
|
||||
|
||||
/*
|
||||
* Detect whether any of the indirection items are slice specifiers.
|
||||
|
Reference in New Issue
Block a user