Tom Lianza
Tom Lianza

Reputation: 4072

Postgres crosstab: function returning record called in context that cannot accept type record

I'm attempting to use the postgres crosstab function which states that the query passed in must return 3 columns:

This statement must return one row_name column, one category column, and one value column.

However, when I run this query, I get the following error:

select crosstab('select entity_id, keyword_id, keyword_id from entity_keyword ORDER BY 1,2');

ERROR: function returning record called in context that cannot accept type record

I've played with the datatypes (in my case the 'value' doesn't matter - it's just true/false) but can't quite tell what the complaint is about. The resultset of that query appears to me to conform to what's required. Using postgres 9.2.4.

Upvotes: 1

Views: 2887

Answers (1)

Tom Lianza
Tom Lianza

Reputation: 4072

The issue turned out to be that select crosstab should have been select * from crosstab.

Upvotes: 2

Related Questions