Re: !<space>= should give error?

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: 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:16:14
Message-ID: CAMsr+YF7ocp4ZunCjB_GSFc-=uqyAXoCgWxw-j7hgHRt66Tm0g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 21 December 2017 at 14:43, Rajkumar Raghuwanshi <
rajkumar(dot)raghuwanshi(at)enterprisedb(dot)com> wrote:

> Hi,
>
> with below query I am getting unexpected output. here !<space>= is
> behaving as =
> is this expected behaviour?
>
> 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.

test=> SELECT 1!, 2!, 3!;
?column? | ?column? | ?column?
----------+----------+----------
1 | 2 | 6
(1 row)

test=> SELECT (1 !) = 1;
?column?
----------
t
(1 row)

test=> \do+ !
List of operators
Schema | Name | Left arg type | Right arg type | Result type |
Function | Description
------------+------+---------------+----------------+-------------+-------------+-------------
pg_catalog | ! | bigint | | numeric |
numeric_fac | factorial
(1 row)

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2017-12-21 07:20:20 The pg_indent on on ftp is outdated
Previous Message Craig Ringer 2017-12-21 07:13:13 Re: Using ProcSignal to get memory context stats from a running backend