What use case is make_tuple_indirect() supposed to illustrate?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: What use case is make_tuple_indirect() supposed to illustrate?
Date: 2014-04-23 00:22:23
Message-ID: 15928.1398212543@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Pursuant to
http://www.postgresql.org/message-id/29007.1396038881@sss.pgh.pa.us
I've been working on a patch to prevent external toast pointers from
appearing in composite Datums. I noticed that this patch completely
breaks the make_tuple_indirect() test case added by commit 36820250.
The regression test doesn't fail (meaning the test case fails to
actually prove that any indirection is happening), but it certainly
isn't doing what's intended, because the "indirect" pointers get
flattened out of the tuple returned by make_tuple_indirect() before
control ever leaves the function.

Even in the code as it stands in HEAD, such indirect pointers would
get flattened out of other container types such as arrays and ranges.

And for that matter, it's a bit silly to be testing make_tuple_indirect
in a BEFORE INSERT/UPDATE trigger, because even if the tuple gets out
of the trigger without being flattened, it will certainly get flattened
mere nanoseconds later before it gets written out to disk. (If it did
not, the test case would fail altogether, since the indirect values
in memory only survive for the length of the current transaction.)

So I'm wondering exactly what use-case this test is supposed to represent.

Or is the whole thing just a toy anyway? Because the more I look at that
patch, the less it looks like it could do anything useful, short of adding
a ton of infrastructure that's not there now.

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-04-23 00:47:32 Re: [GENERAL] aggregate returning anyarray and 'cannot determine result data type'
Previous Message Josh Berkus 2014-04-23 00:19:11 Re: assertion failure 9.3.4