Re: != should give error? - Mailing list pgsql-hackers

From Mikael Kjellström
Subject Re: != should give error?
Date
Msg-id 846383b4-e690-97be-3ae7-43c7b00dd588@mksoft.nu
Whole thread Raw
In response to Re: != should give error?  (Craig Ringer <craig@2ndquadrant.com>)
Responses Re: != should give error?  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-hackers
On 2017-12-21 08:16, Craig Ringer wrote:

>     postgres=# create table tbl (col_a int, col_b int);
>     CREATE TABLE
>     postgres=# insert into tbl values (1,2);
>     INSERT 0 1
>     postgres=# insert into tbl values (2,1);
>     INSERT 0 1
>     *postgres=# select * from tbl where col_a ! = 1;
>      col_a | col_b
>     -------+-------
>          1 |     2
>     (1 row)*
>     *
>     *
>
> One-factorial is one, so it's correct.

Yes, but I think he was expecting the behavior to be different from / 
not equal.  So he meant to write:

select * from tbl where col_a != 1;

I.e. col_a different from 1.

BTW isn't the "preferred" way of writing different from / not equal in 
SQL to use the <> operator?

/Mikael


pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: Using ProcSignal to get memory context stats from a running backend
Next
From: Andres Freund
Date:
Subject: Re: [HACKERS] Parallel Hash take II