Re: WIP - xmlvalidate implementation from TODO list

From: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Marcos Magueta <maguetamarcos(at)gmail(dot)com>, 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-31 09:29:38
Message-ID: de6dade3-4956-4b57-b51d-1db703e16702@uni-muenster.de
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 30/03/2026 22:28, Pavel Stehule wrote:
> I checked db2 doc, and if I understand their doc, the XML schema is
> identified by "relational identifier" SQLschema.name
>
> So taking XML schema as catalog object is the correct analogy and using
> acl looks to me correct.

+1

> But what is different (patch and db2), one relational identifier can
> identify a group of XML schemas. So there is relation 1:N not 1:1. You
> can see the REGISTER XMLSCHEMA command.

I wonder what are the applications for this 1:N relationship between xml
schemas and their identifiers. Sounds cool though.

> The schema registration is different on MSSQL where it is more similar
> to some local cache, and schema is identified only by uri. In this case
> using ACL can be messy, and I can imagine having some dedicated role
> that can register a new xml schema. But MSSQL doesn't support SQL/XML
> XMLVALIDATE function.
>
> Both concepts are workable, and I have no strong preference for one or
> second (maybe DB2 concept is better for Postgres, probably DB2 concept
> is closer to SQL/XML). But if we use relational identifiers, then it
> should be consistent with other usage of relational identifiers - there
> ACL should be used.

A few other things I noticed in v6

== event triggers (event_trigger.c) ==

OBJECT_XMLSCHEMA is in the elog(ERROR) path of stringify_grant_objtype()
and stringify_adefprivs_objtype(). Since the grammar does support
GRANT/REVOKE ... ON XMLSCHEMA, any event trigger on ddl_command_end that
fires during a GRANT on an XML schema will raise a elog(ERROR,
"unsupported object type").

An additional test here would be nice as well.

== corrupt dump ==

pg_dump is ignoring GRANT statements. Since the feature supports
GRANT/REVOKE on XMLSCHEMAS, omitting ACL dump means privileges are
silently lost during dump/restore.

== inconsistent DDL statements ==

The docs suggest that ALTER XMLSCHEMA ... IF EXISTS is supported, which
isn't the case. It should be either implemented or just removed from the
docs.

== different error message for build without libxml ==

In xml.c the error messag used is "unsupported XML feature", but you're
using "xmlschema support requires libxml" in pg_xmlschema.c. I think we
should be consistent here.

Thanks!

Best, Jim

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2026-03-31 09:30:30 Re: Skipping schema changes in publication
Previous Message Bertrand Drouvot 2026-03-31 09:24:35 Re: Adding per backend commit and rollback counters