Re: crosstab doesn't work - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: crosstab doesn't work
Date
Msg-id 20051125142202.GC16970@svana.org
Whole thread Raw
In response to crosstab doesn't work  (Vittorio <vdemart1@tin.it>)
List 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@svana.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.

Attachment

pgsql-general by date:

Previous
From: John McCawley
Date:
Subject: Re: tool for DB design
Next
From: Tom Lane
Date:
Subject: Re: pg_connect troubles on localhost