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.