From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
---|---|
To: | Lane Van Ingen <lvaningen(at)esncc(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Functions that Return A Record |
Date: | 2005-07-26 22:35:46 |
Message-ID: | 20050726152843.A61081@megazone.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On Tue, 26 Jul 2005, Lane Van Ingen wrote:
> I am using version 8.0 on a Windows 2003 platform.
>
> I am getting the following error message when trying to return a record:
> ERROR: a column definition list is required for functions returning
> "record"
>
> My original query was to a function, and looked like this:
> select * from SnmpNodeVersion(4);
> Figuring it needs to see a list of columns, I enumerated what I expected to
> come back:
> select node_id, version, snmp_timeout, snmp_retries, snmp_community_ro,
> snmp_community_rw,
> snmp_user_name, snmp_authentication_type, snmp_auth_password,
> snmp_privacy_type,
> snmp_privacy_password from SnmpNodeVersion(4);
> That didn't work, either; same error. I was thinking that it would be able
> to get the
> column defintions through the views I am using.
If the function returns setof record, IIRC what you need to say is:
from SnmpNodeVersion(4) AS tab(node_id int, ...)
However, I'd suggest either defining the function to return the correct
view type, or, since there are two, making a composite type of the
appropriate structure and having the function return that.
From | Date | Subject | |
---|---|---|---|
Next Message | David | 2005-07-27 10:44:27 | ZPsycopg - Losing Connections |
Previous Message | Adam O'Toole | 2005-07-26 21:22:58 | backend triggers communication with front-end |