Lists: | pgsql-hackers |
---|
From: | "Jinqiang Han" <postgresql(at)db(dot)pku(dot)edu(dot)cn> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org <pgsql-hackers(at)postgresql(dot)org> |
Subject: | about table function |
Date: | 2002-12-16 04:08:48 |
Message-ID: | 200212161156453.SM01108@hanvin |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
hello, Joe Conway.
it seems the crosstab function you write in contrib/tablefunc can't work.
it saids that A column definition list is required for functions returning RECORD.
How can i make it work?
thank you very much
best regard,
Jinqiang Han
From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | Jinqiang Han <postgresql(at)db(dot)pku(dot)edu(dot)cn> |
Cc: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: about table function |
Date: | 2002-12-16 04:25:44 |
Message-ID: | 3DFD55C8.2040105@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Jinqiang Han wrote:
> it seems the crosstab function you write in contrib/tablefunc can't work.
> it saids that A column definition list is required for functions returning RECORD.
> How can i make it work?
>From contrib/tablefunc/README.tablefunc:
Outputs
Returns setof record, which must defined with a column definition
in the FROM clause of the SELECT statement, e.g.:
SELECT *
FROM crosstab(sql, 2)
AS ct(row_name text, category_1 text, category_2 text);
the example crosstab function produces a set something like:
<== values columns ==>
row_name category_1 category_2
---------+------------+------------
row1 val1 val2
row2 val5 val6
You are apparently forgetting the
"AS ct(row_name text, category_1 text, category_2 text)"
part.
hope this helps,
Joe