Search Postgresql Archives

Re: Testing truthiness of GUC variables?

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

 



Abelard Hoffman <abelardhoffman@xxxxxxxxx> 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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[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