Re: !<space>= should give error?

From: Mikael Kjellström <mikael(dot)kjellstrom(at)mksoft(dot)nu>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>, Rajkumar Raghuwanshi <rajkumar(dot)raghuwanshi(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: !<space>= should give error?
Date: 2017-12-21 07:56:20
Message-ID: 846383b4-e690-97be-3ae7-43c7b00dd588@mksoft.nu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2017-12-21 08:49:46 pgsql: Add parallel-aware hash joins.
Previous Message Craig Ringer 2017-12-21 07:55:35 Re: Using ProcSignal to get memory context stats from a running backend