aggregation of setof

From: Andreas Gaab <A(dot)Gaab(at)scanlab(dot)de>
To: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: aggregation of setof
Date: 2011-01-28 11:42:18
Message-ID: 48DA836F3865C54B8FBF424A3B775AF60132434B4A@Exchange-Server
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi all,

I would like to write a query, which aggregates the results of regexp_matches(). The problem is that regexp_matches returnes setof text[] as documented even if I discard the global flag (http://www.postgresql.org/docs/8.4/static/functions-matching.html#FUNCTIONS-POSIX-REGEXP ). Thus resulting in an error when I try to aggregate the result:

"
SELECT array_accum(
regexp_matches('foobarbequebazilbarfbonk', '(b[^b]+)(b[^b]+)')
)
-------------------------------
ERROR: set-valued function called in context that cannot accept a set
********** Fehler **********
ERROR: set-valued function called in context that cannot accept a set
SQL Status:0A000
"

Can I convert a 'setof text[]' to a 'text[]'?

Alternatively I could use a sub-select, but I am curious if there are other solutions around.

Regards,
Andreas

___________________________________________________________________________

SCANLAB AG
Dr. Andreas Simon Gaab
Entwicklung * R & D

Siemensstr. 2a * 82178 Puchheim * Germany
Tel. +49 (89) 800 746-513 * Fax +49 (89) 800 746-199
mailto:a(dot)gaab(at)scanlab(dot)de * www.scanlab.de<http://www.scanlab.de>

Amtsgericht München: HRB 124707 * USt-IdNr.: DE 129 456 351
Vorstand: Georg Hofner (Sprecher), Christian Huttenloher, Norbert Petschik
Aufsichtsrat (Vorsitz): Dr. Hans J. Langer
___________________________________________________________________________

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message John Fabiani 2011-01-29 01:16:04 something simple but I can't
Previous Message Amitabh Kant 2011-01-28 02:47:10 Re: Automating PostgreSql table partition using triggers