Passing result of multirow subquery to C function - Mailing list pgsql-novice

From Magnus Persson
Subject Passing result of multirow subquery to C function
Date
Msg-id 52C2ED53.202@gmail.com
Whole thread Raw
Responses Re: Passing result of multirow subquery to C function  (David Johnston <polobo@yahoo.com>)
Re: Passing result of multirow subquery to C function  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
During the holidays I've taken on to looking at writing a postgres C
extension/function. What I've done so far is more or less the article
series by Ron Peterson (http://linuxgazette.net/142/peterson.html).

What I'm having issues figuring out is how to pass the results of a
subquery to a function (if at all possible?):

SELECT hello((SELECT name FROM names));

Where name is of type TEXT. And results from calling the function is:

hello
------------
Hello, Benny
Hello, Kenny

And what the function does is to only prepend "Hello, " to the string.

My naive attempt errors with:
ERROR: more than one row returned by a subquery used as an expression

What should I be looking at?


pgsql-novice by date:

Previous
From: Tanstaafl
Date:
Subject: Re: Reliably backing up a live database
Next
From: David Johnston
Date:
Subject: Re: Passing result of multirow subquery to C function