Re: Casting Integer to Boolean in assignment

Поиск
Список
Период
Сортировка
От Geoff Winkless
Тема Re: Casting Integer to Boolean in assignment
Дата
Msg-id CAEzk6fdXcnbgU31v+H1wkAG0PX6eyc-6_QCHEhUHt-TX2QSg-A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Casting Integer to Boolean in assignment  (Adrian Klaver <adrian.klaver@aklaver.com>)
Ответы Re: Casting Integer to Boolean in assignment  (Alexandre GRAIL <postgresql.general@augure.net>)
Список pgsql-general
On Thu, 24 Jan 2019 at 16:00, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
> People are going to make mistakes that is a given. Eliminating a boolean
> test is not going to change that.

I still think that if you've got to the point where you're actually
part-way through writing a clause you're unlikely to forget to
complete it.

Missing out a clause altogether is understandable but writing half of
one? Even if you weren't sure what the value was you would probably
write

WHERE myfield=

and then have to go and look it up.

> Like you say it is a matter of opinion. The projects opinion is here:
>
> https://www.postgresql.org/docs/11/datatype-boolean.html
>
> and it works for me.

And you're welcome to it. I'm not arguing for it changing. I'm simply
stating that I'm very pleased that the default behaviour can be
changed, because in my opinion writing a bunch of explicit casts in a
query is a surefire path to unreadable code.

Geoff


В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Casting Integer to Boolean in assignment
Следующее
От: Alexandre GRAIL
Дата:
Сообщение: Re: Casting Integer to Boolean in assignment