Re: BUG #5798: Some weird error with pl/pgsql procedure

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Maxim Boguk <maxim(dot)boguk(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5798: Some weird error with pl/pgsql procedure
Date: 2011-02-20 21:07:46
Message-ID: 10910.1298236066@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Maxim Boguk <maxim(dot)boguk(at)gmail(dot)com> writes:
> I tracked virtual tuple from heaptuple.c::slot_getattr down to
> execMain.c::ExecUpdate and I think somewhere in this way virtual tuple
> should be need to be "materialized" into physical tuple.

That happens at the top of ExecUpdate:

/*
* get the heap tuple out of the tuple table slot, making sure we have a
* writable copy
*/
tuple = ExecMaterializeSlot(slot);

I don't see any code path there that could re-virtualize the slot.

Do you have any triggers or constraints on the target table? Because
those are about the only things that influence this code path at all...

> Again I not sure but ExecProcessReturning function seems good candidate to
> perform tuple materialization.

If ExecProcessReturning were given a virtual slot, materializing it
would do no good at all for this problem, because the system columns in
the result would be garbage. It has to receive an already materialized
slot that contains the right information beforehand. The only reason
that retrieving ctid can work at all is that when heap_update is called,
"tuple" is pointing at the slot's contained tuple and so setting
tuple->t_self changes the contents of the slot. That whole function is
completely dependent on the slot contents being physical not virtual,
and I don't see anything there that would break it.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Christopher Head 2011-02-20 22:30:35 BUG #5895: Ability to match more than just CN in client certificate
Previous Message Tom Lane 2011-02-20 15:35:27 Re: [BUGS] issue about information_schema REFERENTIAL_CONSTRAINTS