Re: Casting Integer to Boolean in assignment - Mailing list pgsql-general

From Geoff Winkless
Subject Re: Casting Integer to Boolean in assignment
Date
Msg-id CAEzk6fdXcnbgU31v+H1wkAG0PX6eyc-6_QCHEhUHt-TX2QSg-A@mail.gmail.com
Whole thread Raw
In response to Re: Casting Integer to Boolean in assignment  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: Casting Integer to Boolean in assignment  (Alexandre GRAIL <postgresql.general@augure.net>)
List 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 by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Casting Integer to Boolean in assignment
Next
From: Alexandre GRAIL
Date:
Subject: Re: Casting Integer to Boolean in assignment