Search Postgresql Archives

Re: Script checking to see what database it's connected to

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

 



On Mon, Feb 22, 2021 at 7:19 AM Ron <ronljohnsonjr@xxxxxxxxx> wrote:
>
> Thus, I want to add a bit to the top of the script, something like this:
>
> \if :DBNAME = postgres
>      echo "must not run in postgres"
>      exit
> \endif
>
> However, I can't seem to find the magic sauce.

You have to use a dedicated variable.  Something like

SELECT :'DBNAME' = 'postgres' AS is_postgres \gset
\if :is_postgres
[...]





[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 Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux