On Fri, Aug 18, 2023 at 10:55 AM Chapman Flack <c...@anastigmatix.net> wrote: > > > Again, all of that complication stems from the choice to use the > anyelement return type and rely on polymorphic type resolution > to figure the oid out, when we already have the oid to begin with > and the oid is all we want. >
you want jsonb_object_field_type(internal, jsonb, text)? because on sql level, it's safe. The return data type is determined when we are in jsonb_cast_support. we just need to pass the {return data type} information to the next function: jsonb_object_field_type.