From: Frederic Logier <fred@az-informatique.com>
To: Joe Conway <mail@joeconway.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: split function for pl/pgsql
Date: 02 Oct 2002 18:54:58 +0200
Message-ID: <1033577699.14486.81.camel@ghost> (raw)
In-Reply-To: <3D9B1479.2060600@joeconway.com>
References: <1033554614.16115.45.camel@ghost>
<3D9B1479.2060600@joeconway.com>
Le mer 02/10/2002 à 17:44, Joe Conway a écrit :
> There is no split function built in to PostgreSQL currently. You could write
> it yourself in PL/Perl and use it in the PL/pgSQL function.
Great ! have you some example for call a pl/perl function from a
pl/pgsql function ?
And could i use an int array in pl/pgsql returned by the pl/perl
function ?
> In 7.3 (currently in beta) there is a split_part() function which returns just
> one element. I will most likely write a split function for 7.4 to return an
> array, similar to perl and php. In 7.3, the following will do what you want (I
> think):
Thanks for your function but i can't use a beta version of postgresql in
production :(
maybe i should use a int array like this example :
create function foo(_int4) returns int2 as'
declare
a alias for $1;
i int:=1;
begin
while a[i] loop
i:=i+1;
end loop;
return i-1;
end;
' language 'plpgsql';
you can call it by:
select foo('{1232131,12312321,3424234}');
--
AZ informatique
68 avenue Felix Faure 69003 Lyon
Tel : +33 (0) 472 844 949 direct : +33 (0) 472 844 956
Fax : 04 78 60 40 70
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: fred@az-informatique.com, mail@joeconway.com
Subject: Re: split function for pl/pgsql
In-Reply-To: <1033577699.14486.81.camel@ghost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox