Re: Casting Integer to Boolean in assignment

From: Geoff Winkless <pgsqladmin(at)geoff(dot)dj>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Geoff Winkless <pgsqladmin(at)geoff(dot)dj>, 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:48:45
Message-ID: CAEzk6feizMYvzRORT+ct-vycBBEhd2zbajZGVDNUxtzFdFM-bw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 24 Jan 2019 at 15:40, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> wrote:
> 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.

If you follow that logic, then having a single boolean test at all
should be invalid.

CREATE TABLE mytest (myval char (1));
INSERT INTO mytest VALUES ('a'),('b'),('c'),('s'),('t');
DELETE FROM mytest WHERE 't';
SELECT * FROM mytest;
myval
-------
(0 rows)

Geoff

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message bhargav kamineni 2019-01-24 15:52:39 Re: log_min_duration_statement
Previous Message Adrian Klaver 2019-01-24 15:40:33 Re: Casting Integer to Boolean in assignment