Re: pg_background extension help - Mailing list pgsql-novice

From Stephen Anderson
Subject Re: pg_background extension help
Date
Msg-id CADn1m+4BAk6YN=gtxfEg6bLoy2DLxVf5i=qskiZOfrAaurR6fA@mail.gmail.com
Whole thread Raw
In response to Re: pg_background extension help  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
Thanks Tom, I've tried contacting Vibhor but had no luck.  With further digging it seems that not much at all comes back from the pg_background_result function.  I've written a wrapper function around the call that saves the output parameter values into a local table so they can be retrieved by the calling routine.  it's ugly but it works :-)

Steve.

On Wed, 6 Mar 2019 at 02:00, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Stephen Anderson <stephen.anderson@appstech.com.au> writes:
> I'm porting over an Oracle application to postgres and by and large its
> been relatively seamless.  One of the challenges I've hit is replicating
> the functions/procedures that utilise Oracle's autonomous transaction
> functionality.  I've found Vibhor's pg_background extension (
> https://github.com/vibhorkum/pg_background) and successfully created it in
> my instance and this seems pretty damn close to what I need.  Unfortunately
> I've hit a bit of a snag around getting parameter values back.  So to the
> point of all this :-)

I know diddly-squat about pg_background, but judging from the symptoms
you mention, it's not very smart about functions declared to return
RECORD, which is what's happening under the hood if you use multiple OUT
parameters.  You might have better luck if you create a named composite
type and declare the function to return that (which'll require some
internal notational changes in the function, but nothing too awful).

Or perhaps not.  In any case, it'd be an idea to take this up with the
extension's author; maybe it can be improved in future releases.

                        regards, tom lane

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_background extension help
Next
From: mcassell@trimind.com
Date:
Subject: Windows Service Stops Responding