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 1gmh7S-0001se-FF for pgsql-general@arkaria.postgresql.org; Thu, 24 Jan 2019 15:40:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gmh7Q-0007qy-L8 for pgsql-general@arkaria.postgresql.org; Thu, 24 Jan 2019 15:40:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gmh7Q-0007qg-Bx for pgsql-general@lists.postgresql.org; Thu, 24 Jan 2019 15:40:40 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gmh7O-0000GJ-7V for pgsql-general@lists.postgresql.org; Thu, 24 Jan 2019 15:40:39 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id DF62C23117; Thu, 24 Jan 2019 10:40:36 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 24 Jan 2019 10:40:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=2 sGFdlrn07kAcP/jB9r8yM+RTevFl0WeNR10KH2n4Ls=; b=XFgzpmKCfDbnIPS1g BWUZaLxtQ0k75B6uBAiVmn6liig+jqeHEE0F/1Zx4D/vJ+8KDiap2QFTxHnTPCXN UOLdXHzzt+v44HMaDLevlufWr8c0S7X7aD0aTAmOIDuiEsAvqShKAcjdPDmpef8l 1Wc1ikFOK2DiwlIgzh1GsAS+VAx/HcaYUzMeJwk6wgc262PUQAiE7LuONYnIMHAk eIUdohDE6DzBEndA73Ug9nvECNzvk45rrah2j+4DtJ1JlCQV4M98IagH9J+meRdf 7uvigTHpKNF7EEg0vW9kRmWmKzgk7JL1uMjj5lNiRoFw6dj3M3R9kAQnZpqkCP3Z c1ixA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=2sGFdlrn07kAcP/jB9r8yM+RTevFl0WeNR10KH2n4 Ls=; b=f8N34P6DDnRO7PEhccyfko0JJlhzSVlvK1BNnqtBCq2SIJEVGAqZv6eiV vR6Is59LlFW75v4CQER31Qq48yDMv59vm1+4gr/Up91QeFaGXy+veLcsAHL+bLap UXufdUSy9VqywEoHxtJNhTJXECswFWWUiT84BQw6p19iqZbIMmb4VrdhgXOQJVYx bJYsTUIvXMjt1kaup0/3C1yf5VUKV0cguVlyyTV3FmaNzQcHjWEAJEAogHDPnK+r w616clW4qWun0MwNZKlE/FxjcQ/22DgT34mbxUOzOoyzOWa71QP30phvkfUInAOC UNua/UmwH4yHQ0FkCVBNct4M3z2vg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledriedvgdejkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepuffvfhfhkffffg ggjggtgfesthejredttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegr ughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmqeenucfkphepjedurddvud dvrddufeegrdefnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghv vghrsegrkhhlrghvvghrrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from [192.168.1.2] (unknown [71.212.134.3]) by mail.messagingengine.com (Postfix) with ESMTPA id 23DA9E451A; Thu, 24 Jan 2019 10:40:34 -0500 (EST) Subject: Re: Casting Integer to Boolean in assignment To: Geoff Winkless Cc: Tom Lane , "David G. Johnston" , Alexandre GRAIL , "pgsql-generallists.postgresql.org" References: <17453.1548342682@sss.pgh.pa.us> <1bc32f58-a479-ee28-353f-b11810bab95e@aklaver.com> From: Adrian Klaver Message-ID: <52d4616a-af35-68fa-a613-b823ab3d2eb4@aklaver.com> Date: Thu, 24 Jan 2019 07:40:33 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 1/24/19 7:32 AM, Geoff Winkless wrote: > On Thu, 24 Jan 2019 at 15:28, Adrian Klaver wrote: >> On 1/24/19 7:21 AM, Geoff Winkless wrote: >>> How could you even write a query like the one Thomas posted? It >>> doesn't even look remotely sensible. > >> delete from delete_test where 1::boolean; > > *chuckle* > > You misunderstand me. > > I mean, how can one write a query like that by mistake > > DELETE FROM WHERE ; > > What would you be thinking that that ought to do? Getting in a hurry/distracted. I wrote out the above test case in psql and with tab completion it is easy to get to: delete from delete_test where and then forget the 'field =' part. Though my more common mistake along that line is: delete from delete_test; At any rate, if it can be done it will be done. > > G > -- Adrian Klaver adrian.klaver@aklaver.com