Re: Error Returned by A Function - Mailing list pgsql-novice

From Michael Fuhr
Subject Re: Error Returned by A Function
Date
Msg-id 20060110164009.GA62009@winnie.fuhr.org
Whole thread Raw
In response to Error Returned by A Function  ("Lane Van Ingen" <lvaningen@esncc.com>)
List pgsql-novice
On Tue, Jan 10, 2006 at 10:42:39AM -0500, Lane Van Ingen wrote:
> select * from current_neighbors(2);
>
> ERROR:  cannot assign non-composite value to a row variable
> CONTEXT:  PL/pgSQL function "current_neighbors" line 15 at assignment

Line 15 of the function is:

>   returnValue := 'none';

You've declared returnValue to be a composite type (typ_remote_net)
so you need to assign to a particular column or use a row constructor:

    returnValue.remote_net := 'none';
    -- or
    returnValue := row('none');

Likewise in a few other places.  Also, the function's query has a
syntax error:

>     order by BY 1,3,2

--
Michael Fuhr

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: Error Returned by A Function
Next
From: Michael Fuhr
Date:
Subject: Re: translating this SQL query from a different dialect