minor problem in boolean cast

Поиск
Список
Период
Сортировка
Искать

minor problem in boolean cast

От:
Cary Huang <cary.huang@highgo.ca>
Дата:
Вложения:
Hi

I noticed that when casting a string to boolean value with input 'of' it still cast it to 'f'. I think with 'of', it should give an error because 'off' is the expected candidate. This may not be intended so I made a simple patch to address this. 

```
postgres=# select cast('of' as boolean);
bool
------
f
(1 row)
```


Cary Huang
-------------
HighGo Software Inc. (Canada)


Re: minor problem in boolean cast

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Cary Huang  writes:
> I noticed that when casting a string to boolean value with input 'of' it still cast it to 'f'. I think with 'of', it should give an error because 'off' is the expected candidate. This may not be intended so I made a simple patch to address this. 

It's absolutely intended, and documented:

https://www.postgresql.org/docs/devel/datatype-boolean.html

Note the bit about "Unique prefixes of these strings are also accepted".

The code comment just above parse_bool() says the same.

			regards, tom lane


FAQ