Re: [HACKERS] missing "SPI_finish" that isn't missing

2015-12-28 Thread Tom Lane
Chapman Flack writes: > Is there a particular, reasonably tidy idiom that has emerged as the usual, > customary approach to a task like this? You could construct a RangeVar node and then use RangeVarGetRelid, but I dunno that that's really any cleaner than inquiring about it using the syscaches.

Re: [HACKERS] missing "SPI_finish" that isn't missing

2015-12-28 Thread Chapman Flack
On 12/24/15 16:37, Tom Lane wrote: > to make this coding pattern work is to set up a subtransaction, and either > commit it in the success path or roll it back upon catching an error. > (This is not terribly well documented, but the exception-block handling > in plpgsql provides a working model to

Re: [HACKERS] missing "SPI_finish" that isn't missing

2015-12-24 Thread Tom Lane
Chapman Flack writes: > I probably just need to learn the right coding pattern for this. > What is it? You can't just ignore a thrown error like that. What you'd have to do to make this coding pattern work is to set up a subtransaction, and either commit it in the success path or roll it back up

[HACKERS] missing "SPI_finish" that isn't missing

2015-12-24 Thread Chapman Flack
I probably just need to learn the right coding pattern for this. What is it? What I want this code to do: a) If there is a table 'mytable', set theSavedStuff to a pstrdup'd in TopMemoryContext copy of column s from one row if present. b) In case of an error because there is no table 'mytable