Commit fcec6ca
committed
Support XMLTABLE query expression
XMLTABLE is defined by the SQL/XML standard as a feature that allows
turning XML-formatted data into relational form, so that it can be used
as a <table primary> in the FROM clause of a query.
This new construct provides significant simplicity and performance
benefit for XML data processing; what in a client-side custom
implementation was reported to take 20 minutes can be executed in 400ms
using XMLTABLE. (The same functionality was said to take 10 seconds
using nested PostgreSQL XPath function calls, and 5 seconds using
XMLReader under PL/Python).
The implemented syntax deviates slightly from what the standard
requires. First, the standard indicates that the PASSING clause is
optional and that multiple XML input documents may be given to it; we
make it mandatory and accept a single document only. Second, we don't
currently support a default namespace to be specified.
This implementation relies on a new executor node based on a hardcoded
method table. (Because the grammar is fixed, there is no extensibility
in the current approach; further constructs can be implemented on top of
this such as JSON_TABLE, but they require changes to core code.)
Author: Pavel Stehule, Álvaro Herrera
Extensively reviewed by: Craig Ringer
Discussion: https://postgr.es/m/CAFj8pRAgfzMD-LoSmnMGybD0WsEznLHWap8DO79+-GTRAPR4qA@mail.gmail.com1 parent 270d7dd commit fcec6ca
File tree
52 files changed
+4606
-50
lines changed- contrib/pg_stat_statements
- doc/src/sgml
- src
- backend
- commands
- executor
- nodes
- optimizer
- path
- plan
- prep
- util
- parser
- rewrite
- utils/adt
- include
- catalog
- executor
- nodes
- optimizer
- parser
- utils
- test/regress
- expected
- sql
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
52 files changed
+4606
-50
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2400 | 2400 | | |
2401 | 2401 | | |
2402 | 2402 | | |
| 2403 | + | |
| 2404 | + | |
| 2405 | + | |
2403 | 2406 | | |
2404 | 2407 | | |
2405 | 2408 | | |
| |||
2868 | 2871 | | |
2869 | 2872 | | |
2870 | 2873 | | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
| 2882 | + | |
2871 | 2883 | | |
2872 | 2884 | | |
2873 | 2885 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10332 | 10332 | | |
10333 | 10333 | | |
10334 | 10334 | | |
10335 | | - | |
| 10335 | + | |
| 10336 | + | |
10336 | 10337 | | |
10337 | 10338 | | |
10338 | 10339 | | |
| |||
10430 | 10431 | | |
10431 | 10432 | | |
10432 | 10433 | | |
| 10434 | + | |
| 10435 | + | |
| 10436 | + | |
| 10437 | + | |
| 10438 | + | |
| 10439 | + | |
| 10440 | + | |
| 10441 | + | |
| 10442 | + | |
| 10443 | + | |
| 10444 | + | |
| 10445 | + | |
| 10446 | + | |
| 10447 | + | |
| 10448 | + | |
| 10449 | + | |
| 10450 | + | |
| 10451 | + | |
| 10452 | + | |
| 10453 | + | |
| 10454 | + | |
| 10455 | + | |
| 10456 | + | |
| 10457 | + | |
| 10458 | + | |
| 10459 | + | |
| 10460 | + | |
| 10461 | + | |
| 10462 | + | |
| 10463 | + | |
| 10464 | + | |
| 10465 | + | |
| 10466 | + | |
| 10467 | + | |
| 10468 | + | |
| 10469 | + | |
| 10470 | + | |
| 10471 | + | |
| 10472 | + | |
| 10473 | + | |
| 10474 | + | |
| 10475 | + | |
| 10476 | + | |
| 10477 | + | |
| 10478 | + | |
| 10479 | + | |
| 10480 | + | |
| 10481 | + | |
| 10482 | + | |
| 10483 | + | |
| 10484 | + | |
| 10485 | + | |
| 10486 | + | |
| 10487 | + | |
| 10488 | + | |
| 10489 | + | |
| 10490 | + | |
| 10491 | + | |
| 10492 | + | |
| 10493 | + | |
| 10494 | + | |
| 10495 | + | |
| 10496 | + | |
| 10497 | + | |
| 10498 | + | |
| 10499 | + | |
| 10500 | + | |
| 10501 | + | |
| 10502 | + | |
| 10503 | + | |
| 10504 | + | |
| 10505 | + | |
| 10506 | + | |
| 10507 | + | |
| 10508 | + | |
| 10509 | + | |
| 10510 | + | |
| 10511 | + | |
| 10512 | + | |
| 10513 | + | |
| 10514 | + | |
| 10515 | + | |
| 10516 | + | |
| 10517 | + | |
| 10518 | + | |
| 10519 | + | |
| 10520 | + | |
| 10521 | + | |
| 10522 | + | |
| 10523 | + | |
| 10524 | + | |
| 10525 | + | |
| 10526 | + | |
| 10527 | + | |
| 10528 | + | |
| 10529 | + | |
| 10530 | + | |
| 10531 | + | |
| 10532 | + | |
| 10533 | + | |
| 10534 | + | |
| 10535 | + | |
| 10536 | + | |
| 10537 | + | |
| 10538 | + | |
| 10539 | + | |
| 10540 | + | |
| 10541 | + | |
| 10542 | + | |
| 10543 | + | |
| 10544 | + | |
| 10545 | + | |
| 10546 | + | |
| 10547 | + | |
| 10548 | + | |
| 10549 | + | |
| 10550 | + | |
| 10551 | + | |
| 10552 | + | |
| 10553 | + | |
| 10554 | + | |
| 10555 | + | |
| 10556 | + | |
| 10557 | + | |
| 10558 | + | |
| 10559 | + | |
| 10560 | + | |
| 10561 | + | |
| 10562 | + | |
| 10563 | + | |
| 10564 | + | |
| 10565 | + | |
| 10566 | + | |
| 10567 | + | |
| 10568 | + | |
| 10569 | + | |
| 10570 | + | |
| 10571 | + | |
| 10572 | + | |
| 10573 | + | |
| 10574 | + | |
| 10575 | + | |
| 10576 | + | |
| 10577 | + | |
| 10578 | + | |
| 10579 | + | |
| 10580 | + | |
| 10581 | + | |
| 10582 | + | |
| 10583 | + | |
| 10584 | + | |
| 10585 | + | |
| 10586 | + | |
| 10587 | + | |
| 10588 | + | |
| 10589 | + | |
| 10590 | + | |
| 10591 | + | |
| 10592 | + | |
| 10593 | + | |
| 10594 | + | |
| 10595 | + | |
| 10596 | + | |
| 10597 | + | |
| 10598 | + | |
| 10599 | + | |
| 10600 | + | |
| 10601 | + | |
| 10602 | + | |
| 10603 | + | |
| 10604 | + | |
| 10605 | + | |
| 10606 | + | |
| 10607 | + | |
| 10608 | + | |
| 10609 | + | |
| 10610 | + | |
| 10611 | + | |
| 10612 | + | |
| 10613 | + | |
| 10614 | + | |
| 10615 | + | |
| 10616 | + | |
| 10617 | + | |
| 10618 | + | |
| 10619 | + | |
| 10620 | + | |
| 10621 | + | |
| 10622 | + | |
| 10623 | + | |
| 10624 | + | |
| 10625 | + | |
| 10626 | + | |
| 10627 | + | |
| 10628 | + | |
| 10629 | + | |
| 10630 | + | |
| 10631 | + | |
| 10632 | + | |
| 10633 | + | |
10433 | 10634 | | |
10434 | 10635 | | |
10435 | 10636 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
781 | 781 | | |
782 | 782 | | |
783 | 783 | | |
| 784 | + | |
784 | 785 | | |
785 | 786 | | |
786 | 787 | | |
| |||
926 | 927 | | |
927 | 928 | | |
928 | 929 | | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
929 | 933 | | |
930 | 934 | | |
931 | 935 | | |
| |||
1103 | 1107 | | |
1104 | 1108 | | |
1105 | 1109 | | |
| 1110 | + | |
1106 | 1111 | | |
1107 | 1112 | | |
1108 | 1113 | | |
| |||
1416 | 1421 | | |
1417 | 1422 | | |
1418 | 1423 | | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
1419 | 1438 | | |
1420 | 1439 | | |
1421 | 1440 | | |
| |||
2593 | 2612 | | |
2594 | 2613 | | |
2595 | 2614 | | |
| 2615 | + | |
| 2616 | + | |
| 2617 | + | |
| 2618 | + | |
| 2619 | + | |
2596 | 2620 | | |
2597 | 2621 | | |
2598 | 2622 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
198 | 199 | | |
199 | 200 | | |
200 | 201 | | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
201 | 206 | | |
202 | 207 | | |
203 | 208 | | |
| |||
564 | 569 | | |
565 | 570 | | |
566 | 571 | | |
| 572 | + | |
567 | 573 | | |
568 | 574 | | |
569 | 575 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| 113 | + | |
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
| |||
239 | 240 | | |
240 | 241 | | |
241 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
242 | 248 | | |
243 | 249 | | |
244 | 250 | | |
| |||
459 | 465 | | |
460 | 466 | | |
461 | 467 | | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
462 | 472 | | |
463 | 473 | | |
464 | 474 | | |
| |||
715 | 725 | | |
716 | 726 | | |
717 | 727 | | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
718 | 732 | | |
719 | 733 | | |
720 | 734 | | |
| |||
0 commit comments