Let's assume that the bug is in libxml2, should postgres crash or should it
have some kind of protection against it?
Yeah. The segfault is inside xmlParserPrintFileContext(), so really there
> is at least one libxml2 bug here and possibly two. Maybe it should have
> been able to cope with such large input, or maybe not, but for sure its
> printing functions should have been able to cope with the state at the
> time the error was reported.
>
> I don't think there's much we can do about it; you need to report this
> to the libxml2 folk.
>
> regards, tom lane
>