Re: [PATCH] Add CANONICAL option to xmlserialize
От | Jim Jones |
---|---|
Тема | Re: [PATCH] Add CANONICAL option to xmlserialize |
Дата | |
Msg-id | 145c2f83-8610-4eba-a24d-b1e8620e47dd@uni-muenster.de обсуждение исходный текст |
Ответ на | Re: [PATCH] Add CANONICAL option to xmlserialize (Pavel Stehule <pavel.stehule@gmail.com>) |
Ответы |
Re: [PATCH] Add CANONICAL option to xmlserialize
|
Список | pgsql-hackers |
On 29.08.24 20:50, Pavel Stehule wrote: > > I know, but theoretically, there can be some benefit for CANONICAL if > pg supports bytea there. Lot of databases still use non utf8 encoding. > > It is a more theoretical question - if pg supports different types > there in future (because SQL/XML or Oracle), then CANONICAL can be > used without limit, I like the idea of extending the feature to support bytea. I can definitely take a look at it, but perhaps in another patch? This change would most likely involve transformXmlSerialize in parse_expr.c, and I'm not sure of the impact in other usages of XMLSERIALIZE. > or CANONICAL can be used just for text? And you are sure, so you can > compare text X text, instead xml X xml? Yes, currently it only supports varchar or text - and their cousins. The idea is to format the xml and serialize it as text in a way that they can compared based on their content, independently of how they were written, e.g '<foo a="1" b="2"/>' is equal to '<foo b="2" a="1"/>'. > > +SELECT xmlserialize(CONTENT doc AS text CANONICAL) = > xmlserialize(CONTENT doc AS text CANONICAL WITH COMMENTS) FROM > xmltest_serialize; > + ?column? > +---------- > + t > + t > +(2 rows) > > Maybe I am a little bit confused by these regress tests, because at > the end it is not too useful - you compare two identical XML, and WITH > COMMENTS and WITHOUT COMMENTS is tested elsewhere. I tried to search > for a sense of this test. Better to use really different documents > (columns) instead. Yeah, I can see that it's confusing. In this example I actually just wanted to test that the default option of CANONICAL is CANONICAL WITH COMMENTS, even if you don't mention it. In the docs I mentioned it like this: "The optional parameters WITH COMMENTS (which is the default) or WITH NO COMMENTS, respectively, keep or remove XML comments from the given document." Perhaps I should rephrase it? Or maybe a comment in the regression tests would suffice? Thanks a lot for the input! -- Jim
В списке pgsql-hackers по дате отправления: