Re: Better support for whole-row operations and composite

From: Joe Conway <mail(at)joeconway(dot)com>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Better support for whole-row operations and composite
Date: 2004-04-03 23:05:40
Message-ID: 406F4344.8060301@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Joe Conway wrote:
> Given the above changes, it's almost working now -- only problem left is
> with triggers:
>
>
> insert into foo values(11,'cat99',1.89);
> + ERROR: record type has not been registered
> + CONTEXT: In PL/R function rejectfoo
>
> delete from foo;
> + ERROR: cache lookup failed for type 0
> + CONTEXT: In PL/R function rejectfoo
>
> (and a few other similar failures)
>
> Any ideas why the trigger tuple type isn't registered, or what I'm doing
> wrong?

A little more info on this. It appears that the tuple type is set to
either 2249 (RECORDOID) or 0. In the case of RECORDOID this traces all
the way back to here:

/* ----------------------------------------------------------------
* CreateTemplateTupleDesc
*
* This function allocates and zeros a tuple descriptor structure.
*
* Tuple type ID information is initially set for an anonymous record
* type; caller can overwrite this if needed.
* ----------------------------------------------------------------
*/

But the type id is never overwritten for a BEFORE INSERT trigger. It
appears that somewhere it is explictly set to InvalidOid for both BEFORE
DELETE and AFTER INSERT triggers (and possibly others). My take is that
we now need to explicitly set the tuple type id for INSERT/UPDATE/DELETE
statements -- not sure where the best place to do that is though. Does
this sound correct?

Joe

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2004-04-04 01:09:35 Re: Function to kill backend
Previous Message wespvp 2004-04-03 21:40:01 thread_test.c problems