Re: plpgsql question - Mailing list pgsql-general

From Joe Conway
Subject Re: plpgsql question
Date
Msg-id 3FA73BDD.1090009@joeconway.com
Whole thread Raw
In response to plpgsql question  ("Jennifer Lee" <jlee@scri.sari.ac.uk>)
List pgsql-general
Jennifer Lee wrote:
> something like
>
> Parent1*Parent2
> or
> (grandparent1*grandparent2)*(grandparent3*grandparent4)
> or something even more complex
>
> The field is called ancest in table passport_temp.
>
> I need to separate each of the parents and/or grandparents etc to load
> them individually in a pedigree table. I'm trying to do this in plpgsql,
> but haven't been able to figure out if there is a way to parse the
> field.

You haven't been very specific, so it's hard to offer concrete advice.
But in any case, take a look at split_part() and replace() functions
(and possibly others) here:

http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=functions-string.html

HTH,

Joe


pgsql-general by date:

Previous
From: Joe Conway
Date:
Subject: Re: transposed query?
Next
From: Joe Conway
Date:
Subject: Re: How to use dblink within pl/pgsql function: