pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: Casting Integer to Boolean in assignment
Date: Thu, 24 Jan 2019 13:17:52 +0100
Message-ID: <b379116f-2fc6-410c-c83d-e916bad44e50@gmx.net> (raw)
In-Reply-To: <CAEzk6ff-420-Ny_H0nWTM1nxxxcYQ4edJdG4Myz1hjxyCHPGAQ@mail.gmail.com>
References: <d8fe822a-ac75-5763-00b3-273f11394fc5@augure-ng.fr>
	<CAEzk6ff-420-Ny_H0nWTM1nxxxcYQ4edJdG4Myz1hjxyCHPGAQ@mail.gmail.com>

Geoff Winkless schrieb am 24.01.2019 um 12:45:
> The reason for that at least is that '1' and '0' are valid boolean values.
> 
> https://www.postgresql.org/docs/9.5/datatype-boolean.html
> 
> There's additional text describing why casts are chosen to be defined
> as implicit or not here
> 
> https://www.postgresql.org/docs/9.5/typeconv-overview.html
> 
> 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:

  delete from orders
  where 42;





view thread (21+ messages)  latest in thread

Message-ID: <b379116f-2fc6-410c-c83d-e916bad44e50@gmx.net>
Permalink:  ../b379116f-2fc6-410c-c83d-e916bad44e50@gmx.net/
Also on:    postgresql.org/message-id/b379116f-2fc6-410c-c83d-e916bad44e50@gmx.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: spam_eater@gmx.net
  Subject: Re: Casting Integer to Boolean in assignment
  In-Reply-To: <b379116f-2fc6-410c-c83d-e916bad44e50@gmx.net>
  References: <d8fe822a-ac75-5763-00b3-273f11394fc5@augure-ng.fr> <CAEzk6ff-420-Ny_H0nWTM1nxxxcYQ4edJdG4Myz1hjxyCHPGAQ@mail.gmail.com> <b379116f-2fc6-410c-c83d-e916bad44e50@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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