Re: Container Types - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: Container Types
Date
Msg-id 3e4a42efcb8a42d5fa9ea15adcef78eb466346c4.camel@j-davis.com
Whole thread Raw
In response to Re: Container Types  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
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




pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Document aggregate functions better w.r.t. ORDER BY
Next
From: Michael Paquier
Date:
Subject: Re: Show WAL write and fsync stats in pg_stat_io