From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Torsten Förtsch <tfoertsch123(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: How to assign default values to psql variables? |
Date: | 2017-02-22 05:09:44 |
Message-ID: | CAFj8pRAPD_e_Lp0S_-4Zqb39gNRV=z0hCebwwv7uoDr+aLQSCA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi
2017-02-22 6:00 GMT+01:00 Torsten Förtsch <tfoertsch123(at)gmail(dot)com>:
> Hi,
>
> I have a psql script relying on variables passed in on the command line
> with -v.
>
> Is there any way to assign a default value in case the -v option is
> forgotten?
>
> Here is an example with pgtap:
>
> select diag('should be printed only in verbose mode') where :testverbose;
>
> This can be called with -v testverbose=true or -v testverbose=false.
> However, if the assignment is forgotten, it breaks. I'd like to behave it
> as if testverbose=false was passed.
>
>
Currently there is not any scripting functionality in psql. In patch pool
is the basic scripting in psql support patch \if, \else \endif - and then
you can do it. But not now.
Regards
Pavel
> Thanks.
>
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Güttler | 2017-02-22 12:47:47 | Re: Move rows from one database to other |
Previous Message | Torsten Förtsch | 2017-02-22 05:00:32 | How to assign default values to psql variables? |