Re: return query with set-returning functions - Mailing list pgsql-bugs

From Tom Lane
Subject Re: return query with set-returning functions
Date
Msg-id 24262.1218505118@sss.pgh.pa.us
Whole thread Raw
In response to return query with set-returning functions  (Robert Treat <xzilla@users.sourceforge.net>)
Responses Re: return query with set-returning functions
List pgsql-bugs
Robert Treat <xzilla@users.sourceforge.net> writes:
> the second function takes a uuid, looks up an integer representation, and then
> calls the first function. whenever I run it, I get the following error:

> reconnoiter=# select * from
> stratcon.fetch_dataset('cfe2aad7-71e5-400b-8418-a6d5834a0386'::uuid,'inoctets','2008-08-04
> 15:01:13-04','2008-08-11 15:01:13-04',500,'t');
> ERROR:  structure of query does not match function result type
> CONTEXT:  PL/pgSQL function "fetch_dataset" line 9 at RETURN QUERY

Works here after loading your schema dump, or at least it doesn't
complain:

treat-# stratcon.fetch_dataset('cfe2aad7-71e5-400b-8418-a6d5834a0386'::uuid,'inoctets','2008-08-04
treat'# 15:01:13-04','2008-08-11 15:01:13-04',500,'t');
 sid | name | rollup_time | count_rows | avg_value
-----+------+-------------+------------+-----------
(0 rows)

It's possible that I'm missing the failure for lack of suitable test
data, but right offhand I'd bet that the problem is that there are
dropped columns in your copy of stratcon.rollup_matrix_numeric_5m.
plpgsql has some shortcomings in dealing with rowtypes that contain
dropped columns ...

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #4351: Full text search performance
Next
From: Tom Lane
Date:
Subject: Re: BUG #4350: 'select' acess given to views containing "union all" even though user has no grants