C function returning multiple values (or tuples)

Поиск
Список
Период
Сортировка
От Henrique Pantarotto
Тема C function returning multiple values (or tuples)
Дата
Msg-id 9910151258320F.10148@scanner.cepa.com.br
обсуждение исходный текст
Список pgsql-general
Hello PostgreSQL friends!

I've read Yin-So Chen's interesting thread regarding the STORED PROCEDURE issue,
and I learned that C functions can only return one value.

BUT I also read at the TODO list that "Functions returning sets don't really
work right" (look it up).  Okay, even if it doesn't "work right", is it
possible to return multiple values in C function??

Searching the HACKER list for "function tuple" you'll see lots of messages of
people doing stuff regarding to "functions that returns multiple values".

Like I said, I read all of those recent stored procedure threads, and although
I've learned a lot, I must confess that I am veerrrry confused now... ;-)

I've a little experience with C functions (I wrote a "encrypt" function that
returns an encrypted password, just like MySQL's ones).  This C function
returns a value of type "text".

My question:

Is it possible to create a C function that returns multiple values (using the
TUPLE type or whatever).

So, when I do the query:

PG=> select employeenamed('john');
fullname            |department|age
--------------------+----------+---
John Wayne          |Rodeo     |45
Mister John Travolta|Hollywood |50

Or this:
PG=> select writeit(2, 55, 101);
---+----------+-------------------
two|fifty-five|one-hundred and one

Or this:
PG=> select split("this:is:a:splitted:text:divided:by:colons");
----+--+-+--------+----+-------+--+------
this|is|a|splitted|text|divided|by|colons



Is this what a "stored procedure" is?   If it is, I'm with you, Yin-So.  ;-)

Thanks everybody!!!


Regards from Brazil!

--
Henrique Pantarotto
CEPAnet Internet Provider
webmaster / analista de sistemas
Email: scanner@cepa.com.br
Tel: (011) 5506-8477
Cel: (011) 9706-3444
LINUX FRIEND

В списке pgsql-general по дате отправления:

Предыдущее
От: Andy Lewis
Дата:
Сообщение: BIG Data and Perl
Следующее
От: "Duncan Kinder"
Дата:
Сообщение: Re: [GENERAL] Convert MS access database into PostgreSQL