Re: crosstab doesn't work

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Vittorio <vdemart1(at)tin(dot)it>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: crosstab doesn't work
Date: 2005-11-25 14:22:05
Message-ID: 20051125142202.GC16970@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Nov 25, 2005 at 03:09:06PM +0100, Vittorio wrote:
> Dear all,

<snip>

> crosstab doesn't seem to work
> anymore putting the above select into crosstab
>
> switch=# select * from
> crosstab('select rowid,attribute, sum(value) as val from ct1 group by
> rowid, attribute order by 1,2;', 2) as c(rowid text, att1 integer, att2
> integer);
> ERROR: query-specified return row and actual function return
> row do not match

It's just a guess, but I think the result of sum() might be a bigint,
in which case you should say that att1 and att2 are bigints, or
alternativly use cast(sum(value) as integer).

Hope this helps,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-11-25 15:28:16 Re: pg_connect troubles on localhost
Previous Message John McCawley 2005-11-25 14:16:34 Re: tool for DB design