POn Wednesday, June 8, 2016, Patrick B <patrickbakerbr(at)gmail(dot)com> wrote:
>
> ERROR: syntax error at or near "||"
>> LINE 12: TO '/var/lib/pgsql/' || crtrow.account_id |...
>
>
Which tells me you cannot use an expression as a file name. The docs
support this conclusion.
You probably need to use EXECUTE after constricting a string.
You could also try psql in a shell script.
David J.