Re: Error Returned by A Function

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Lane Van Ingen <lvaningen(at)esncc(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Error Returned by A Function
Date: 2006-01-10 16:40:09
Message-ID: 20060110164009.GA62009@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Joao Miguel Ferreira 2006-01-10 17:01:02 Preventing access of user1 to user2's database
Previous Message Tom Lane 2006-01-10 16:33:39 Re: Error Returned by A Function