On 1/9/17 4:23 PM, Tom Lane wrote:
Jim Nasby <jim.na...@bluetreble.com> writes:
Got a stack trace. The abort happens in TclObjLookupVar:

Yeah, I found the problem: pltcl_returnnext calls pltcl_build_tuple_result
which may throw elog(ERROR), leaving the Tcl interpreter's state all
screwed up, so that later functions go south.  It seems quite accidental
that this is only failing with 8.4.  We need pltcl_returnnext to use a
subtransction, like the other pltcl statements that can call into generic
PG code.  Working on a fix now.

Hmm... I suspect there's more places where this could be a problem. For example, pltcl_quote calls palloc, which could ereport as well.

Perhaps all of the internal commands should be wrapped in the pltcl_subtrans_begin() construct. The subtrans overhead would be unfortunate though. But AFAIK the only reason we need the subtrans is if we're underneath a TCL catch command, and there's probably a way to determine if that's the case.

BTW, now that I've seen this pattern in pltcl and plpythonu, I'm wondering if there might be some easier way to handle it through our error callbacks.
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532)

Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to