Re: Casting Integer to Boolean in assignment

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Geoff Winkless <pgsqladmin(at)geoff(dot)dj>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Alexandre GRAIL <postgresql(dot)general(at)augure(dot)net>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Casting Integer to Boolean in assignment
Date: 2019-01-24 15:40:33
Message-ID: 52d4616a-af35-68fa-a613-b823ab3d2eb4@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 1/24/19 7:32 AM, Geoff Winkless wrote:
> On Thu, 24 Jan 2019 at 15:28, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> 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 <tablename> WHERE <integer>;
>
> 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(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Geoff Winkless 2019-01-24 15:48:45 Re: Casting Integer to Boolean in assignment
Previous Message Geoff Winkless 2019-01-24 15:36:13 Re: Casting Integer to Boolean in assignment