Re: Another issue with invalid XML values

From: Florian Pflug <fgp(at)phlo(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Noah Misch <noah(at)leadboat(dot)com>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Another issue with invalid XML values
Date: 2011-07-20 15:42:55
Message-ID: 9CD6AF1C-A950-4764-9804-CAF3EB2DBA8C@phlo.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Jul20, 2011, at 17:37 , Tom Lane wrote:
> Florian Pflug <fgp(at)phlo(dot)org> writes:
>> I'm fine with having pg_xml_init() palloc the state and pg_xml_done()
>> pfree it, but I'm kinda curious about why you prefer that over making it
>> the callers responsibility and letting callers use a stack-allocated
>> struct if they wish to.
>
> We could do it that way, but it would require exposing the struct
> definition to callers. As I have it coded ATM, the struct is an
> opaque typedef in xml.h and only known within xml.c, which decouples
> contrib/xml2 from any changes in it. Another point is that if we
> changed our minds and went over to a transaction cleanup hook,
> stack-allocated structs wouldn't work at all. Lastly, even if we
> did stack-allocate the control struct, the message buffer has to be
> palloc'd so it can be expanded at need.

You've convinced me, thanks for the detailed explanation!

>> Fair enough. Are you going to do that, or do you want me to produce an
>> updated patch? I can do that, but probably not before the weekend.
>
> No, I'm working on it, almost done already.

Cool, thanks!

best regards,
Florian Pflug

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Yeb Havinga 2011-07-20 16:00:28 Re: [v9.1] sepgsql - userspace access vector cache
Previous Message Tom Lane 2011-07-20 15:37:38 Re: Another issue with invalid XML values