On Sat, Aug 19, 2023 at 3:09 AM Chapman Flack <c...@anastigmatix.net> wrote:
> On 2023-08-18 14:50, Chapman Flack wrote: > > Now, my guess is EXPLAIN is complaining when it sees the Const > > of type internal, and doesn't know how to show that value. > > Perhaps makeRelabelType is the answer there, too: what if the > > Const has Oid type, so EXPLAIN can show it, and what's inserted > > as the function argument is a relabel node saying it's internal? > Simply changing the Const to be of type Oid makes EXPLAIN happy, > and nothing ever says "hey, why are you passing this oid for an > arg that wants internal?". This is without adding any relabel > nodes anywhere. > Highlighting the user case of makeRelableType is interesting! But using the Oid directly looks more promising for this question IMO, it looks like: "you said we can put anything in this arg, so I put an OID const here", seems nothing is wrong. Compared with the makeRelableType method, I think the current method is more straightforward. Compared with anyelement, it avoids the creation of makeDummyConst which I'm not sure the implementation is alway correct. So I am pretty inclined to this way! v10 attached. -- Best Regards Andy Fan
v10-0001-optimize-casting-jsonb-to-a-given-type.patch
Description: Binary data
v10-0002-convert-anyelement-to-internal.patch
Description: Binary data