Re: table functions as fields in a select

From: max jacob <Max(dot)Jacob(at)ircam(dot)fr>
To: max jacob <max(dot)jacob(at)ircam(dot)fr>, pgsql-general(at)postgresql(dot)org
Subject: Re: table functions as fields in a select
Date: 2004-08-12 15:25:26
Message-ID: 411B8BE6.8090309@ircam.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

sorry, forget this: it was my fault, now the function works also on pg8.
anyway, it is strange that i can do this with c functions and not with
plpgsql ones...
m.

max jacob wrote:

> hallo,
> i am using pg7.3.4. i have written a table function in c that
> tokenizes a text, returning a setof text. i can use this function
> either in constructs like:
> select * from tokenize( 'some text that has to be tokenized' );
> or in costructs like:
> select tokenize( text_field ) from some_table;
> the latter gives me the whole result of all words contained in every
> "text_field" of "some_table". i wonder if this is a forseen behaviour,
> since doing the same with a plpgsql function does not work (the
> plpgsql interpreter raises an error when it reaches the "return next"
> statement telling i'm using a "set-valued function in a context that
> can not accept a set"). but the c function works fine. now i'm trying
> the 8beta, where my "tokenize" function does not work anymore in the
> second construct. the server does not alert me, it simply returns an
> empy record set. this behaviour for sure not the right one since it
> should raise an error, but mainly i would really like it to work at
> least as it did on 7.3.4 since, as i believe my little example shows,
> this can be very useful. does anybody know what is the forseen
> behavior for using a set returning function in the field list of a
> select and, if the answer is "it should raise an error", if it is
> possible to work around it?
>
> thanks in advance,
>
> max.
>
> ps: i did not subscribe the mailing list, so please use "replay all"..
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jan Wieck 2004-08-12 15:30:08 Re: pl pgsql grammer file contains error
Previous Message Raphael Bauduin 2004-08-12 15:18:54 Re: history tables with only one function?