Tim, Thank you, but I think I already did that. The query is a dollar-quoted string, so there should be no need to do anything with the single quote marks within it, so I would have thought the query engine would already know that it's text. But after seeing the first error message, I explicitly casted it using "::text". The error message that time said that crosstab(text) was not found, so that doesn't seem to be the problem. RobR -----Original Message----- From: pgsql-general-owner@xxxxxxxxxxxxxx [mailto:pgsql-general-owner@xxxxxxxxxxxxxx] On Behalf Of Tim Clarke Sent: Thursday, October 15, 2015 10:31 AM To: pgsql-general@xxxxxxxxxxxxxx Subject: Re: How can I use crosstab functons in PostgreSQL 9.3? Looks to me like argument types possibly? The article creates various combinations of crosstab() function but you are passing in a query. Wrap your query in quotes (and then escape those within it). Then you'll be passing in a "text" type not an "unknown" as the error clearly shows. Tim Clarke -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general