Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w7JEh-005Ag0-2B for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Mar 2026 20:29:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w7JEf-006FT9-2n for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Mar 2026 20:29:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w7JEf-006FT1-1Z for pgsql-hackers@lists.postgresql.org; Mon, 30 Mar 2026 20:29:21 +0000 Received: from mail-yx1-xb12a.google.com ([2607:f8b0:4864:20::b12a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w7JEc-000000023Xl-1R5w for pgsql-hackers@lists.postgresql.org; Mon, 30 Mar 2026 20:29:20 +0000 Received: by mail-yx1-xb12a.google.com with SMTP id 956f58d0204a3-65005a8840dso4816703d50.0 for ; Mon, 30 Mar 2026 13:29:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774902557; cv=none; d=google.com; s=arc-20240605; b=apPxvX0spT5KSOT+XtXchzJeUD7OwnR/fN7/7Q5ACO+u5dz+xN5mPp+45Mcb/psVbu PN9Avd/79VAITCpFmlwT1V1SAflhIe5IV6FoHWz+h/9i94P7o7xfntyZx/z4dohvXCsg WjmvsqtPjSFTWxpku4UswTgJIyMGnbFoOXmb455ThWafzWFJTXy2j7WvGpfb9sehsjMj PWWpc4lLBEn7TnceOOlh4y9rfUftsj2uuFw8lL4OefXbbn7X3/tIFqPncoTTJM6xdK51 ZJcqElOFUGgEjQs3StDvJlN0v56WgYeGoaanyEfVHzHLm15QWBNbl1w2taRqalrPE+Gu j7Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=dogMgLn4/T98kIr0o40zZGbn8C5xjkzLd70x9AQTtBk=; fh=+aRukcxNoeB+KDJ+JsfP69rkOhEq+MuCbdsHHmHUDFo=; b=MIVyehxd6/nsOY9FbZj1zHQqmt8DNBLAP88CSe6mbO6SfmWU1lEpHaYRttdAU7+Y5E VrhMxcdREXnVkkt14trkel0ivcWyIyE0HvIPlOCQOCd2yvR+6kD/5Es8B/IxDAkshlWJ KI8v6ZH2OOUdLnxM/ypGq79wlFs4VflgGj0OatLphBCLL1e1nqMpLWv/Bbk/1ZIU9RGu tllKGpgpYhsa4EtwjvVYYTSZgiv4HKCXCWZtuQbMxQR1SlQj0LuK6TQseMsDgFWWRVVR WTFIvXhk2U6/xEwVGPxYN/tsBAfqEJmKwXuWce9UX9H6HldhYDCou0v+gXF7Wftxt6Cj pWVA==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774902557; x=1775507357; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=dogMgLn4/T98kIr0o40zZGbn8C5xjkzLd70x9AQTtBk=; b=kHGx1VXBzORPNOltjC2NUsCb7JnBS95xDsvX+2eiaylDNO2IloJIAItrUGxY3KqGlb uKKiUY3RcJ5JjFvzfG+nf+BIJPlXBZy5xFqv2W+b2cHMmvidIcXx3RkKnki3tvy6PjUa jdtz1Z0uTNtJQuTV4xv8bpeh0eyYC4vKNqvCNfhiLwWeULVHfTGIA15BBJMFg08TozOy EDp36OvJxLErpm3hYChbtqc4L9hiDmljjNa/Bu+1o8tOTewnGO2KZfVu4S9/DMG1DTsZ O1B3TTmT8sd4NxRaZjsWu+gikKO/BS8Xfxo/w9o9KSkVL08qClJEVBOMl3pW0qd5q3Ue UGOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774902557; x=1775507357; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=dogMgLn4/T98kIr0o40zZGbn8C5xjkzLd70x9AQTtBk=; b=R5B6mb0tYzOTfZ9Andwx/NmB1s2d0Op8Z2A49WkQaAXsvqwJ7x/V135kbMLkN4MafY nXJ/DhjpXx/OPIUsufNJp7/PFj7lvOCDDyP0B9YxBza8SzLC2meNx3w1tY/Sb9W6nZ87 dOA1UtqLrei+oCmn/0YlhnlCGsCxsuBNA3cDcnl9CDrZy0NMsIuslJizzSPPMnjWmI/a Aa/S057e6BBvijX0YfBjgmUgh+gqHJThD9SrmY4srn+8BmmCnYcQZtK6aHwijznzg1cp SgV4lZ/zUEPKFFJGMe0gh0p3Pl5LQe+ffodCsxhbdYzwroThqBM2ronc7jrGqXnS6WhB UC7g== X-Forwarded-Encrypted: i=1; AJvYcCUmBzBIo0xMNowU83Y+JBA4FebS9cdWHY3uj2cgT1qnH3E6waaeJUkdVW1moqalKlSuzYu8QwYAT9BkWAqR@lists.postgresql.org X-Gm-Message-State: AOJu0YxT59DbaIn0H0hxWAlX1bG+wkr4gCtg97xL1blwGzYzzvRfHkr0 A1uMxgdkyrFrfKQOfvvVUGTOuqpmu9lCh7fArNFB+oMdV/PyHotJXmmtUJxVw+AHNX7fRBob0C8 57YEh8fN2AQ96FxRqDM2O6e7i8ErUlE8= X-Gm-Gg: ATEYQzwxpamXKxkIvL98oxvlyB8bawpKVJ/uzZCV0gCST+5zCCnnlumPp3eSq8LJjTq mdOUqw/ro3ebvGqVxq5aS4FSX8ZknhGtgEnceprjlPAABs3Up5zW6uNE2P9zOU9LP0s7pre14eV Hb1VWQiWvgIozgFm2gUFw7m2SdVsNueCRVft5ZQZjHNBe8ytMHhEl9r/BRLz+e7/tyUWm8K/oJK rJNxrBZgwo1vae2QhJ9oWeG8/UTqP5K8R7ItSVCjJ7bI3CtJGi3b27hOL25BJye0KrMlG4LMQbQ lfACbf0QMM9cVsOVY/7xW4W+wiZVcHHHZ6n1RP5vTv4MnqtUNDxiAjg642XK++IvFtm0+Mhrafe GXVSSL2qMUQ1hCCNrNdRebwfA1KvQHoVGkJZT5vpzFXh1GMTw24XSpfnWyQ== X-Received: by 2002:a05:690e:128c:b0:64a:dbe3:fab7 with SMTP id 956f58d0204a3-64ff7195e15mr13563191d50.8.1774902556787; Mon, 30 Mar 2026 13:29:16 -0700 (PDT) MIME-Version: 1.0 References: <2898f090-d9cf-475c-940c-a99da4a308f1@uni-muenster.de> <08052569-9384-41b5-bcb7-33929fcc6c71@uni-muenster.de> <2ba05acc-6392-42a4-b59e-61df086b2d4d@uni-muenster.de> <1d49e214-93bc-4928-945c-27e60251a6ad@uni-muenster.de> <9228b6dc-cfae-4a11-927a-209680f5507e@uni-muenster.de> <2f8ca841-0956-4e7d-8fa2-038b879c8f4d@uni-muenster.de> In-Reply-To: <2f8ca841-0956-4e7d-8fa2-038b879c8f4d@uni-muenster.de> From: Pavel Stehule Date: Mon, 30 Mar 2026 22:28:39 +0200 X-Gm-Features: AQROBzAeQ9i7wQXIQDDBUXcSShyQuYjgj2n8WMI5tWwJ4MXjCpSqAI3PztvmVT4 Message-ID: Subject: Re: WIP - xmlvalidate implementation from TODO list To: Jim Jones Cc: Marcos Magueta , Andrey Borodin , Kirill Reshke , PostgreSQL Hackers Content-Type: multipart/alternative; boundary="000000000000688930064e43b482" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000688930064e43b482 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi ne 15. 3. 2026 v 13:58 odes=C3=ADlatel Jim Jones napsal: > Hi Marcos > > On 15/03/2026 05:25, Marcos Magueta wrote: > > 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 withou= t > > 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. > > > I guess we can assume that everything added to the official todo list is > of interest for the community -- at least I do :). > > > > 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 took the liberty to add Pavel to this thread. He has way more > experience than me in this part of the code, and perhaps he can share > his opinion on the predefined roles for XML schemas and his impressions > on the patch as a whole. > 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. 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. 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. Regards Pavel > Best, Jim > --000000000000688930064e43b482 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

ne 15. 3. 2026 v=C2=A013:58 o= des=C3=ADlatel Jim Jones <j= im.jones@uni-muenster.de> napsal:
Hi Marcos

On 15/03/2026 05:25, Marcos Magueta wrote:
> 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<= br> > impractical. With the normal ACL, a schema is object agnostic, so
> there's no clean way to selectively restrict XML schema creation w= ithout
> also affecting other objects in the sam=C2=A0enamespace. A simple scen= ario
> like limiting who can write already gets messy. I did consider RLS on<= br> > the catalog, but that would be unprecedented for a pg_* table and woul= d
> 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 commit= ting
> to an approach, assuming there's still legitimate interest in movi= ng
> this work forward.


I guess we can assume that everything added to the official todo list is of interest for the community -- at least I do :).


> 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 fro= m
> the application layer, sets a warrant for extra caution I guess.
> Limiting the depth and size of both the schema and the document being<= br> > validated would reduce compatibility, but goes a long way in preventin= g
> resource exhaustion, so it's a fairly trivial option to implement.=


I took the liberty to add Pavel to this thread. He has way more
experience than me in this part of the code, and perhaps he can share
his opinion on the predefined roles for XML schemas and his impressions
on the patch as a whole.

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.

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

The schema registration is different on MSSQL where = it is more similar to some local cache, and schema is identified only by ur= i. In this case using ACL can be messy, and I can imagine having some dedic= ated role that can register=C2=A0a new xml schema. But MSSQL doesn't su= pport SQL/XML XMLVALIDATE function.

B= oth concepts are workable, and I have no strong preference for one or secon= d (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 consi= stent with other usage of relational identifiers - there ACL should be used= .

Regards

Pavel

=


Best, Jim
--000000000000688930064e43b482--