Re: Postgres 7.3.5 and count('x')

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Edwin S(dot) Ramirez" <ramirez(at)idconcepts(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Postgres 7.3.5 and count('x')
Date: 2003-12-06 11:02:00
Message-ID: 200312061102.hB6B20q25395@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> ramirez(at)idconcepts(dot)org (Edwin S. Ramirez) writes:
> > It appears that the count('x') will no longer work without a type
> > cast. Is this on purpose?
>
> > warehouse=# select count('x') ;
> > ERROR: cannot accept a value of type any
>
> Hm, that query seems like it should be legal. (You get the same
> from "select count('x') from some_table", so it's not the lack of
> a table to iterate over that's the issue.)
>
> The most direct fix is probably to make any_in() return some random
> value (may as well be ((Datum) 0)) instead of producing an error.
> I can't offhand see any real downside to doing so, but I'm a little
> worried that it might introduce a gap in the type system. Can anyone
> see a reason not to do that? Or a better fix for Edwin's complaint?

What is COUNT('x') supposed to return? 1? Is that legal SQL?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Kirkwood 2003-12-06 11:40:54 Re: *sigh*
Previous Message Tom Lane 2003-12-06 05:18:02 Call for pg_dump testing