Re: pg_background extension help

Stephen Anderson <[email protected]> Wed, 6 Mar 2019 20:56:19 +1100
Newsgroups gmane.comp.db.postgresql.novice
Message-ID <CADn1m+4BAk6YN=gtxfEg6bLoy2DLxVf5i=qskiZOfrAaurR6fA@mail.gmail.com>
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 <[email protected]> wrote:

> Stephen Anderson <[email protected]> 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
>