Search Postgresql Archives

Re: Using psql variables in DO-blocks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 15, 2019 at 8:48 AM Andreas Joseph Krogh <andreas@xxxxxxxxxx> 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.

PNG image


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux