BUG #15836: Casting 'of' to boolean type should throw an invalid input syntax

Started by PG Bug reporting formalmost 7 years ago3 messagesbugs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following bug has been logged on the website:

Bug reference: 15836
Logged by: Yuming Wang
Email address: wgyumg@gmail.com
PostgreSQL version: 12beta1
Operating system: linux
Description:

Converting 'of' to a boolean type should throw an invalid input syntax.
Because we said in the documentation that 'of' is not accepted as an input
to the boolean data type:
https://www.postgresql.org/docs/12/datatype-boolean.html
```
postgres=# select cast('of' as boolean);
bool
------
f
(1 row)
```

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: PG Bug reporting form (#1)
Re: BUG #15836: Casting 'of' to boolean type should throw an invalid input syntax

On Wed, Jun 5, 2019 at 2:37 PM PG Bug reporting form <noreply@postgresql.org>
wrote:

The following bug has been logged on the website:

Bug reference: 15836
Logged by: Yuming Wang
Email address: wgyumg@gmail.com
PostgreSQL version: 12beta1
Operating system: linux
Description:

Converting 'of' to a boolean type should throw an invalid input syntax.
Because we said in the documentation that 'of' is not accepted as an input
to the boolean data type:
https://www.postgresql.org/docs/12/datatype-boolean.html
```
postgres=# select cast('of' as boolean);
bool
------
f
(1 row)
```

At this point raising a syntax error is undesirable, but the documentation
should be modified to match the source code, which does say:

src/utils/adt/bool.c
* Try to interpret value as boolean value. Valid values are: true,
* false, yes, no, on, off, 1, 0; as well as unique prefixes thereof.

The unique prefix part needs to make it to user-facing documentation.

David J.

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: David G. Johnston (#2)
Re: BUG #15836: Casting 'of' to boolean type should throw an invalid input syntax

"David G. Johnston" <david.g.johnston@gmail.com> writes:

On Wed, Jun 5, 2019 at 2:37 PM PG Bug reporting form <noreply@postgresql.org>
wrote:

Converting 'of' to a boolean type should throw an invalid input syntax.

At this point raising a syntax error is undesirable, but the documentation
should be modified to match the source code, which does say:

src/utils/adt/bool.c
* Try to interpret value as boolean value. Valid values are: true,
* false, yes, no, on, off, 1, 0; as well as unique prefixes thereof.

The unique prefix part needs to make it to user-facing documentation.

Agreed, the docs are misleading here. I pushed something to try to
make it better:

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=9729c9360886bee7feddc6a1124b0742de4b9f3d

regards, tom lane