On Tue, Jan 15, 2019 at 8:48 AM Andreas Joseph Krogh <andreas(at)visena(dot)com>
wrote:
> Hi all.
>
> I'm trying to use a psql variable in a DO-block, but it fails:
>
[...]
> Any hints?
>
Don't do that. The body of a DO block is a string literal and psql won't
and shouldn't mess with its contents. You'll need to use an actual
function and pass in the psql variable data via an input parameter.
set_config(...)/current_setting(...) is another option to consider.
David J.