From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | Aram Fingal <fingal(at)multifactorial(dot)com> |
Cc: | Postgres-General General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: crosstab |
Date: | 2012-09-04 19:56:09 |
Message-ID: | 50465CD9.3050809@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 09/04/2012 12:48 PM, Aram Fingal wrote:
> So, are you saying that if I do something like this:
>
> copy(crosstab(source_sql, category_sql)) to '/output.csv' with csv;
>
> Then I don't have to list what the columns are going to be? In other
> words, I can skip the "AS (...)" clause which is shown in the
> examples in the tablefunc documentation?
No, sorry, but that is not what I'm saying :-(
Wen you run
copy ("some query") to ...
it still requires postgres to execute "some query" and the standard
grammar rules will be applied. Postgres must be able to resolve data
types for the columns in the result, and therefore it needs you to
provide a column definition either at function creation time (via OUT
params or by explicit composite return type) or at execution time via
AS(...) clause.
Joe
--
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support
From | Date | Subject | |
---|---|---|---|
Next Message | Gavin Flower | 2012-09-04 20:03:49 | Re: "Too far out of the mainstream" |
Previous Message | Aram Fingal | 2012-09-04 19:48:55 | Re: crosstab |