mirror of
https://github.com/postgres/postgres.git
synced 2025-12-21 05:21:08 +03:00
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.com
This commit is contained in:
@@ -89,8 +89,12 @@ extern void cost_subqueryscan(SubqueryScanPath *path, PlannerInfo *root,
|
||||
RelOptInfo *baserel, ParamPathInfo *param_info);
|
||||
extern void cost_functionscan(Path *path, PlannerInfo *root,
|
||||
RelOptInfo *baserel, ParamPathInfo *param_info);
|
||||
extern void cost_tableexprscan(Path *path, PlannerInfo *root,
|
||||
RelOptInfo *baserel, ParamPathInfo *param_info);
|
||||
extern void cost_valuesscan(Path *path, PlannerInfo *root,
|
||||
RelOptInfo *baserel, ParamPathInfo *param_info);
|
||||
extern void cost_tablefuncscan(Path *path, PlannerInfo *root,
|
||||
RelOptInfo *baserel, ParamPathInfo *param_info);
|
||||
extern void cost_ctescan(Path *path, PlannerInfo *root,
|
||||
RelOptInfo *baserel, ParamPathInfo *param_info);
|
||||
extern void cost_recursive_union(Path *runion, Path *nrterm, Path *rterm);
|
||||
@@ -181,6 +185,7 @@ extern void set_function_size_estimates(PlannerInfo *root, RelOptInfo *rel);
|
||||
extern void set_values_size_estimates(PlannerInfo *root, RelOptInfo *rel);
|
||||
extern void set_cte_size_estimates(PlannerInfo *root, RelOptInfo *rel,
|
||||
double cte_rows);
|
||||
extern void set_tablefunc_size_estimates(PlannerInfo *root, RelOptInfo *rel);
|
||||
extern void set_foreign_size_estimates(PlannerInfo *root, RelOptInfo *rel);
|
||||
extern PathTarget *set_pathtarget_cost_width(PlannerInfo *root, PathTarget *target);
|
||||
extern double compute_bitmap_pages(PlannerInfo *root, RelOptInfo *baserel,
|
||||
|
||||
@@ -82,8 +82,12 @@ extern SubqueryScanPath *create_subqueryscan_path(PlannerInfo *root,
|
||||
List *pathkeys, Relids required_outer);
|
||||
extern Path *create_functionscan_path(PlannerInfo *root, RelOptInfo *rel,
|
||||
List *pathkeys, Relids required_outer);
|
||||
extern Path *create_tablexprscan_path(PlannerInfo *root, RelOptInfo *rel,
|
||||
List *pathkeys, Relids required_outer);
|
||||
extern Path *create_valuesscan_path(PlannerInfo *root, RelOptInfo *rel,
|
||||
Relids required_outer);
|
||||
extern Path *create_tablefuncscan_path(PlannerInfo *root, RelOptInfo *rel,
|
||||
Relids required_outer);
|
||||
extern Path *create_ctescan_path(PlannerInfo *root, RelOptInfo *rel,
|
||||
Relids required_outer);
|
||||
extern Path *create_worktablescan_path(PlannerInfo *root, RelOptInfo *rel,
|
||||
|
||||
Reference in New Issue
Block a user