Skip to content

Added support for OPENXML with WITH clause #587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: BABEL_5_X_DEV__PG_17_X
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/backend/parser/parse_clause.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ sortby_nulls_hook_type sortby_nulls_hook = NULL;

optimize_explicit_cast_hook_type optimize_explicit_cast_hook = NULL;

pre_transform_openxml_columns_hook_type pre_transform_openxml_columns_hook = NULL;

static int extractRemainingColumns(ParseState *pstate,
ParseNamespaceColumn *src_nscolumns,
List *src_colnames,
Expand Down Expand Up @@ -711,6 +713,13 @@ transformRangeTableFunc(ParseState *pstate, RangeTableFunc *rtf)
constructName = "XMLTABLE";
docType = XMLOID;

/*
* Hook to allow extensions to pre-process OPENXML column definitions
* before standard XMLTABLE transformation.
*/
if (pre_transform_openxml_columns_hook && tf->functype == TFT_XMLTABLE)
pre_transform_openxml_columns_hook(pstate, rtf);

/*
* We make lateral_only names of this level visible, whether or not the
* RangeTableFunc is explicitly marked LATERAL. This is needed for SQL
Expand Down
4 changes: 4 additions & 0 deletions src/include/parser/parse_clause.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,8 @@ extern PGDLLEXPORT optimize_explicit_cast_hook_type optimize_explicit_cast_hook;
/* functions in parse_jsontable.c */
extern ParseNamespaceItem *transformJsonTable(ParseState *pstate, JsonTable *jt);

/* Hook for preprocessing OPENXML column definitions before XMLTABLE transformation */
typedef void (*pre_transform_openxml_columns_hook_type) (ParseState *pstate, RangeTableFunc *rtf);
extern PGDLLIMPORT pre_transform_openxml_columns_hook_type pre_transform_openxml_columns_hook;

#endif /* PARSE_CLAUSE_H */