"Andrus" <kobruleht2(at)hot(dot)ee> writes:
> David,
>>Regular Expressions are your friend here. If you do not know them you
> should learn them; though if you ask nicely someone may just provide you
> the solution you need.
>>Split-to-array and unnest may work as well.
>
> Thank you very much. I dona**t know regexps.
> Can you provide example, please for 8.1. Or maybe CASE WHEN and substring
> testing can also used.
The query
SELECT id, a[1] AS name, a[2] AS percent
FROM (
SELECT id, regexp_split_to_array(regexp_split_to_table(comment, ', *'), '\W+') AS a
FROM project
) AS dummy
should work un every halfway recent PostgreSQL version - dunno about 8.1.