Re: WIP - xmlvalidate implementation from TODO list

From: Marcos Magueta <maguetamarcos(at)gmail(dot)com>
To: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
Cc: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: WIP - xmlvalidate implementation from TODO list
Date: 2026-03-15 04:25:22
Message-ID: CAN3aFCcvXHmW+FKS7gX=HoUcjku2nr7XKJEZm05DrgsQxy79HQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hey again Jim,

Sorry for the long pause on this.

I was thinking about the idea of managing the catalogs for read and write,
and I'm coming around to the idea of predefined roles after all. Relying on
conventional namespace-level ACLs for this turns out to be impractical.
With the normal ACL, a schema is object agnostic, so there's no clean way
to selectively restrict XML schema creation without also affecting other
objects in the sam enamespace. A simple scenario like limiting who can
write already gets messy. I did consider RLS on the catalog, but that would
be unprecedented for a pg_* table and would break assumptions throughout
the system, like pg_dump, dependency tracking, syscache lookups... blah!

That said, I'd like to hear from more people on this before committing to
an approach, assuming there's still legitimate interest in moving this work
forward.

On the potential CPU burn from validation: I think in practice it's
comparable to what you'd get from a complex index, heavy check constraint,
or trigger function. However, the nature of the input (and I mean the XML
schema definitions as plain text here), likely coming from the application
layer, sets a warrant for extra caution I guess. Limiting the depth and
size of both the schema and the document being validated would reduce
compatibility, but goes a long way in preventing resource exhaustion, so
it's a fairly trivial option to implement.

I tested the changes on my own instance with Cirrus, so it might be the
case of the version mismatch indeed. I simply reattached both as v6 once
again (no changes, still working on master).

Regards, Marcos.

Attachment Content-Type Size
v6-0002-Add-XMLVALIDATE.patch application/x-patch 63.5 KB
v6-0001-Add-CREATE-XMLSCHEMA.patch application/x-patch 80.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Srinath Reddy Sadipiralla 2026-03-15 06:14:50 Re: bug: pg_dumpall with --data-only and --clean options is giving an error after some dump
Previous Message Mahendra Singh Thalor 2026-03-15 04:18:06 Re: pg_restore --format= option(without any value) should report an error as pg_dump is reporting an error