Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gmdxJ-0003ZT-PZ for pgsql-general@arkaria.postgresql.org; Thu, 24 Jan 2019 12:18:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gmdxI-000840-7k for pgsql-general@arkaria.postgresql.org; Thu, 24 Jan 2019 12:18:00 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gmdxH-00083q-SC for pgsql-general@lists.postgresql.org; Thu, 24 Jan 2019 12:18:00 +0000 Received: from mout.kundenserver.de ([212.227.17.13]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gmdxE-0002Rm-2P for pgsql-general@lists.postgresql.org; Thu, 24 Jan 2019 12:17:58 +0000 Received: from [10.8.0.101] ([185.40.248.10]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPSA (Nemesis) id 1N2mWA-1hBpCm2osW-01324Y for ; Thu, 24 Jan 2019 13:17:52 +0100 Subject: Re: Casting Integer to Boolean in assignment To: pgsql-general@lists.postgresql.org References: From: Thomas Kellerer Message-ID: Date: Thu, 24 Jan 2019 13:17:52 +0100 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:xCy/xg8oE9e8LpYH3LkUbbzft2u0A5QSro9vByFQOii3GQ2AOYe UHGq9Z2kz03iHebEUcEvVBOjkeEM6g14OInYXM/rqcHiwtRQb7VjQ8bSgCVIWjlooU5Yd6f Gcoiry6GMNBEmqeP3/yMZFsXTM1R2UqO1DbiZiHiL9gI2iSK73Rh+uW6JcTQU7ky5a7Zhe7 qjSJ7rszHaw/xmHswC2lw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:ytKAnyfbEVQ=:spzvNY/idCPI144cLpEcRA HOkivL9MSCyfOdYSnUltqvHCymUh35PipXghgC1jdXRyku62yH58LDehW56pLLnBxcSEjnCZd pU6yRWeU4Iw4mZM0p9TVmZyeYlt+ke9Nd5w3Ry2mzN1utRO7+eQUtYo6bZucZMvLjx2rsnr4C SIJeqLQoTum1QLGQr4JcSZeAT2aZfRNFWND9fyBBrwAT2HWj2frASYLj/efa5FG3v0FjKEI/M 0Xrtb3Dw2vJcnPIr7kV6y9lMRsiasBHhYUPuGHGaIUlZA24/gAMLdMOt+esQRas3W20Idha6D EQw9SJLBowb6JKTai8a4i4It5X/zRTngcd5WOr8ootwduyrjo5nZmE7tz8hkiMWuKmkD8UVRn pqLUKqzeL2l2CycFZe+KKHAuwEXNk/VYohgcATWcDUhdFQIbKSY91s6MXYd7U8CJ2wex8b1qP wELwkPUBs+FjK1H+uhdZlK0gRmLba9myrjXPe77zSMjYd+Gidq2UyX1lqWA7kmNHrn9+vKfAz otEhwT5xoFhZ59zRAtqlWz8DDYatgCA8gfE6Kg+Lw+7AdsPmwcuEwgACGTpLEM+4v5C0xiBX5 SuUZGSUdF9rRTRO/q9xaHDGzE74MHOPec84gotuCLBBsmNtfV+VTZOutDeERVjzmB2r4Zhka1 ORlneEGNItkA6+VnGd0DqmxalJdvkDBUbjIkcvRtRm6yinBcl5PzHLL8dkSCRurncP4szk+q/ tqUoAyr++parz1RUdV2R2RgDTobvlfMH4x0dfFOsrw1vudNBWEgrrD6bUkQ= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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;