Re: Casting Integer to Boolean in assignment

From: Geoff Winkless <pgsqladmin(at)geoff(dot)dj>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Casting Integer to Boolean in assignment
Date: 2019-01-24 13:27:00
Message-ID: CAEzk6ff+5w_LUtanxoF8Q3up+_im4_97co=CAx=681k_KJUpiw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 24 Jan 2019 at 12:17, Thomas Kellerer <spam_eater(at)gmx(dot)net> wrote:
> Geoff Winkless schrieb am 24.01.2019 um 12:45:
> > My own opinion is that non-0 should implicitly cast as true and 0
> > should cast as false.
>
> I strongly disagree - that would mimic MySQL's idiosyncrasies and would make such a query valid:

Feel free. I said it's my own opinion and gave a way for someone who
agrees with me to do the same as I do.

If your objection is that someone can write a stupid query and it
might go wrong, there are a million other things that should be
addressed before implicit int::bool casts.

Geoff

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2019-01-24 14:01:23 Re: [pgbackrest] Expiring the last backup?
Previous Message Stephen Frost 2019-01-24 13:26:28 Re: [pgbackrest] Expiring the last backup?