Allow on/off as input texts for boolean.

From: ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Allow on/off as input texts for boolean.
Date: 2009-02-17 06:17:45
Message-ID: 20090217150947.F185.52131E4D@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> wrote:
> - Postgres interprets 'on' as true and 'off' as false in configuration
> parameters, but they are not accepted in sql-boolean.
> Is it a design? or should we add a parser for 'on' and 'off' ?
> I'd like to allow 'on' and 'off' in sql-boolean, too.

Here is a patch to allow 'on' and 'off' as input texts for boolean.
Duplicated boolean parsers in parse_bool() and boolin() are merged
into a new parse_bool_with_len().

I think the change is useful when we treat reloptions in programs.
Since human-readable texts are not suitable for programs, we would need
conversions from text to boolean. Then the shared parser works well.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center

Attachment Content-Type Size
boolin_accepts_onoff.patch application/octet-stream 6.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2009-02-17 09:03:40 PL/Perl translation, croak
Previous Message KaiGai Kohei 2009-02-17 03:47:32 Re: SE-PostgreSQL and row level security