Re: [PATCH] Add XMLText function (SQL/XML X038) - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: [PATCH] Add XMLText function (SQL/XML X038)
Date
Msg-id CAFj8pRC=uaF3ZF2Wf29G1Thq2vu0=RFoELzWOP=GYn3YpCbtKg@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Add XMLText function (SQL/XML X038)  (Chapman Flack <chap@anastigmatix.net>)
List pgsql-hackers


so 26. 8. 2023 v 22:47 odesílatel Chapman Flack <chap@anastigmatix.net> napsal:
On 2023-08-26 16:00, Pavel Stehule wrote:
> Saxon can be an interesting library, but nobody knows if integration
> with
> Postgres is possible. Their C implementation is Java compiled/executed
> by GraalV.

Indeed, such an integration would probably not be in core.

Of the two possible-ways-forward described on that wiki page, the one
that didn't rely on the defunct XQC was one involving query rewriting.
Have the parser understand the SQL/XML customized syntax, and define
a set of ordinary functions it will be rewritten into. (This idea is
bolstered somewhat by the fact that many things in SQL/XML, XMLTABLE
for example, are /defined in the standard/ in terms of query rewriting
into calls on simpler functions.)

Then let there be an extension, or ideally someday a choice of
extensions, supplying those functions.

As to whether running Saxon in a Postgres extension is possible, that's
been an example that ships with PL/Java since 1.5.1 five years ago.

The most simple "solution" can be the introduction of some new hooks there. Then you can write an extension that will call PL/Java functions
 

It's too bad the other projects have stalled; it's good to have more
than one ready option. But Saxon shows no sign of going away.

Perhaps the act of devising a standardized rewriting of queries
onto a standardized set of loadable functions could be of interest
to other DBMS projects as well. It's hard to imagine another DBMS
not being in the same boat (if it isn't from a rich commercial firm
that happens to have a modern XQuery implementation in-house).

Maybe having that set of functions specified, with the prospect
that more than one DBMS might be interested in a project
implementing them, even inspires someone to go look at the
xqilla or zorba repos to see how far they got, and pick up
the baton, and then there could be more than one option.

Another possibility is revitalization of libxml2.

There was an extension http://www.explain.com.au/libx/ But the code is not available to download too, but extending libxml2 is feasible.

I am not sure how valuable this work can be. Probably whoever really needs it uses some Java based solution already.

Regards

Pavel




Regards,
-Chap

pgsql-hackers by date:

Previous
From: "Rui Zhao"
Date:
Subject: Re: pg_upgrade fails with in-place tablespace
Next
From: Michael Paquier
Date:
Subject: Re: Ignore 2PC transaction GIDs in query jumbling