pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #15836: Casting 'of' to boolean type should throw an invalid input syntax
3+ messages / 3 participants
[nested] [flat]

Commits from this thread:
  2019-06-13 afaa32daf2 457dab1e7b 1804185c2d df88137a39 909a92e195 9729c93608  Doc: improve description of allowed spellings for Boolean input.
* BUG #15836: Casting 'of' to boolean type should throw an invalid input syntax
@ 2019-06-05 21:36  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 3+ messages in thread

From: PG Bug reporting form @ 2019-06-05 21:36 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: wgyumg@gmail.com

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)
```



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #15836: Casting 'of' to boolean type should throw an invalid input syntax
@ 2019-06-05 21:49  David G. Johnston <david.g.johnston@gmail.com>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 3+ messages in thread

From: David G. Johnston @ 2019-06-05 21:49 UTC (permalink / raw)
  To: wgyumg@gmail.com; pgsql-bugs@lists.postgresql.org

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.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #15836: Casting 'of' to boolean type should throw an invalid input syntax
@ 2019-06-13 02:57  Tom Lane <tgl@sss.pgh.pa.us>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2019-06-13 02:57 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: wgyumg@gmail.com; pgsql-bugs@lists.postgresql.org

"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=9729c9360886bee7feddc6a1124b0742d...

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2019-06-13 02:57 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-06-05 21:36 BUG #15836: Casting 'of' to boolean type should throw an invalid input syntax PG Bug reporting form <noreply@postgresql.org>
2019-06-05 21:49 ` David G. Johnston <david.g.johnston@gmail.com>
2019-06-13 02:57   ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox