| From: | Kevin Grittner <kgrittn(at)ymail(dot)com> | 
|---|---|
| To: | Abelard Hoffman <abelardhoffman(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> | 
| Subject: | Re: Testing truthiness of GUC variables? | 
| Date: | 2014-09-15 12:39:31 | 
| Message-ID: | 1410784771.73553.YahooMailNeo@web122301.mail.ne1.yahoo.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
Abelard Hoffman <abelardhoffman(at)gmail(dot)com> wrote:
>> Boolean values can be written as on, off, true, false, yes, no,
>> 1, 0 (all case-insensitive) or any unambiguous prefix of these.
>
> is there a built-in function I can call, given the value from
> current_setting('myapp.audit'), that will test it using the same
> logic?
You can *set* a boolean setting with any of those, but that doesn't
mean it will be stored as the string you used:
test=# set default_transaction_read_only = true;
SET
test=# show default_transaction_read_only;
 default_transaction_read_only 
-------------------------------
 on
(1 row)
test=# set default_transaction_read_only = on;
SET
test=# show default_transaction_read_only;
 default_transaction_read_only 
-------------------------------
 on
(1 row)
test=# set default_transaction_read_only = yes;
SET
test=# show default_transaction_read_only;
 default_transaction_read_only 
-------------------------------
 on
(1 row)
test=# set default_transaction_read_only = 1;
SET
test=# show default_transaction_read_only;
 default_transaction_read_only 
-------------------------------
 on
(1 row)
--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tim Clarke | 2014-09-15 12:54:07 | Re: Why isn't Java support part of Postgresql core? | 
| Previous Message | Achilleas Mantzios | 2014-09-15 12:30:09 | Re: Why isn't Java support part of Postgresql core? |