Hello
> This routine works well on postgres v10:
it works? Or is only accepted as input? I got error on function call.
I thought plpgsql cannot directly uses savepoints, only implicitly with begin ... exception ... end block ( https://stream.boxwatch.ru/docs/current/static/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING )
Well, you can still create this function with set check_function_bodies to off
regards, Sergei