On Wed, 2023-10-25 at 16:01 -0700, Andres Freund wrote:
> I'd look whether you can generalize that infrastructure.
I had briefly looked at using the record type mechanism before, and it
seemed like a challenge because it doesn't really work when passing
through a function call:
CREATE TABLE t(a INT, b TEXT);
INSERT INTO t VALUES(1, 'one');
CREATE FUNCTION id(RECORD) RETURNS RECORD LANGUAGE plpgsql AS
$$ BEGIN RETURN $1; END; $$;
SELECT t.a FROM t; -- 1
SELECT (id(t)).a FROM t; -- ERROR
But now that I think about it, that's really a type inference
limitation, and that needs to be solved regardless.
After the type inference figures out what the right type is, then I
think you're right that an OID is not required to track it, and however
we do track it should be able to reuse some of the existing
infrastructure for dealing with record types.
Regards,
Jeff Davis