Re: Question about a query with two count fields

From: David Fetter <david(at)fetter(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: George Pavlov <gpavlov(at)mynewplace(dot)com>, delux256-postgresql(at)yahoo(dot)com, PostgreSQL GENERAL List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Question about a query with two count fields
Date: 2007-09-11 18:42:13
Message-ID: 20070911184213.GY6661@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Sep 11, 2007 at 02:28:24PM -0400, Tom Lane wrote:
> "George Pavlov" <gpavlov(at)mynewplace(dot)com> writes:
> >> From: David Fetter [mailto:david(at)fetter(dot)org]
> >> This case statement returns true when z factorial is zero, so I'd
> >> recommend the SQL standard <> or IS NOT DISTINCT FROM instead.
>
> > i do hate potential ambiguity... the != was something stuck in my brain
> > from old sybase, i think. i always liked != ("not equals") as more
> > intuitive than <> ("less than, greater than"???), but i will have to
> > change my ways, especially if "the standard" says so.
>
> The notion that != might be scanned as two operators whereas <> would
> not be is nonsense. I assume David was just joking.

My mistake.

I believe that foo!=bar without white space should simply error out
because there is no reasonable, unambiguous way to parse it. Here's
what we get right now:

test=# SELECT (2! =0);
?column?
----------
f
(1 row)

test=# SELECT (2!=0);
?column?
----------
t
(1 row)

test=# SELECT (2 !=0);
?column?
----------
t
(1 row)

test=# SELECT (2 ! =0);
?column?
----------
f
(1 row)

test=# SELECT (2 != 0);
?column?
----------
t
(1 row)

test=# SELECT (2 ! = 0);
?column?
----------
f
(1 row)

--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
phone: +1 415 235 3778 AIM: dfetter666
Skype: davidfetter

Remember to vote!
Consider donating to PostgreSQL: http://www.postgresql.org/about/donate

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Glaesemann 2007-09-11 19:18:29 Re: Question about a query with two count fields
Previous Message Tom Lane 2007-09-11 18:28:24 Re: Question about a query with two count fields