Interestingly, when I relabel both places, like this: Oid targetOid = fexpr->funcresulttype; Const *target = makeConst( OIDOID, -1, InvalidOid, sizeof(Oid), ObjectIdGetDatum(targetOid), false, true); RelabelType *rTarget = makeRelabelType((Expr *)target, INTERNALOID, -1, InvalidOid, COERCE_IMPLICIT_CAST); fexpr->funcid = new_func_id; fexpr->args = opexpr->args; fexpr->args = list_insert_nth(fexpr->args, 0, rTarget); expr = (Expr *)makeRelabelType((Expr *)fexpr, targetOid, -1, InvalidOid, COERCE_IMPLICIT_CAST); } PG_RETURN_POINTER(expr); EXPLAIN looks like this: Seq Scan on pg_temp.test_jsonb Output: jsonb_array_element_type(('23'::oid)::internal, test_json, 0), (test_json -> 0) Filter: (test_jsonb.json_type = 'scalarint'::text) With COERCE_IMPLICIT_CAST both places, the relabeling of the function result is invisible, but the relabeling of the argument is visible.
pgsql-hackers by date:
Соглашаюсь с условиями обработки персональных данных