Re: user defined XML aggregate not working as (i think) it should

From: "Rhys A(dot)D(dot) Stewart" <rhys(dot)stewart(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: user defined XML aggregate not working as (i think) it should
Date: 2012-10-04 05:16:12
Message-ID: CACg0vT=ksA1MTEZmU-RWJUT=1Q44=UTAhPW+1_4LAxiwTfOrDg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks Tom,

That was indeed the issue.

Regards,

Rhys

On Wed, Oct 3, 2012 at 8:58 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "Rhys A.D. Stewart" <rhys(dot)stewart(at)gmail(dot)com> writes:
>> I have an xml aggregate function that always returns 'ERROR: invalid
>> XML content'. However an identical function that uses text produces
>> valid xml with the same inputs.
>
> I believe the reason this doesn't work is that the aggregate's initial
> value is faulty: it's supposed to be an XML value and it isn't.
>
> regression=# select ''::xml;
> ERROR: invalid XML content
> LINE 1: select ''::xml;
> ^
>
> It's unfortunate that the CREATE AGGREGATE command doesn't complain
> about that --- maybe we could improve it.
>
> As far as making a working aggregate goes, I'd try leaving off the
> initcond clause (so that the initial value is NULL) and then marking
> the transition function STRICT. (plays around with xmlconcat on
> nulls ...) hm, maybe you'd not even need the STRICT marking, though
> personally I'd suggest it.
>
> regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Chris 2012-10-04 05:45:38 Re: Determining that a schema has changed for purpose of monitoring
Previous Message Toby Corkindale 2012-10-04 03:48:43 Re: COPY FROM with BYTEA fields - escaping doesn't work