Re: Function Returning SETOF Problem

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ron St-Pierre <rstpierre(at)syscor(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Function Returning SETOF Problem
Date: 2003-12-18 01:01:23
Message-ID: 15705.1071709283@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ron St-Pierre <rstpierre(at)syscor(dot)com> writes:
> On a daily basis I place a lot of data into the empty table dailyList,
> and from that data update certain fields in currentList. I thought that
> using a function would be a good way to do this(?). However I get the
> following error when I run updateCurrentData():
> ERROR: set-valued function called in context that cannot accept a set

You're probably doing
SELECT updateCurrentData();
where you should be doing
SELECT * FROM updateCurrentData();

There are some cases where you can invoke set-valued functions in the
target list rather than in the FROM list, but this isn't one of 'em.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2003-12-18 01:35:48 Re: Function Returning SETOF Problem
Previous Message Tom Lane 2003-12-18 00:48:24 Re: restore error - language "plperlu" is not trusted