codekingpro/portable-devtools
115k
1/*-------------------------------------------------------------------------2 *3 * tablefunc.h4 * interface for TableFunc executor node5 *6 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group7 * Portions Copyright (c) 1994, Regents of the University of California8 *9 * src/include/executor/tablefunc.h10 *11 *-------------------------------------------------------------------------12 */13#ifndef _TABLEFUNC_H14#define _TABLEFUNC_H15 16/* Forward-declare this to avoid including execnodes.h here */17struct TableFuncScanState;18 19/*20 * TableFuncRoutine holds function pointers used for generating content of21 * table-producer functions, such as XMLTABLE.22 *23 * InitOpaque initializes table builder private objects. The output tuple24 * descriptor, input functions for the columns, and typioparams are passed25 * from executor state.26 *27 * SetDocument is called to define the input document. The table builder may28 * apply additional transformations not exposed outside the table builder29 * context.30 *31 * SetNamespace is called to pass namespace declarations from the table32 * expression. This function may be NULL if namespaces are not supported by33 * the table builder. Namespaces must be given before setting the row and34 * column filters. If the name is given as NULL, the entry shall be for the35 * default namespace.36 *37 * SetRowFilter is called do define the row-generating filter, which shall be38 * used to extract each row from the input document.39 *40 * SetColumnFilter is called once for each column, to define the column-41 * generating filter for the given column.42 *43 * FetchRow shall be called repeatedly until it returns that no more rows are44 * found in the document. On each invocation it shall set state in the table45 * builder context such that each subsequent GetValue call returns the values46 * for the indicated column for the row being processed.47 *48 * DestroyOpaque shall release all resources associated with a table builder49 * context. It may be called either because all rows have been consumed, or50 * because an error occurred while processing the table expression.51 */52typedef struct TableFuncRoutine53{54 void (*InitOpaque) (struct TableFuncScanState *state, int natts);55 void (*SetDocument) (struct TableFuncScanState *state, Datum value);56 void (*SetNamespace) (struct TableFuncScanState *state, const char *name,57 const char *uri);58 void (*SetRowFilter) (struct TableFuncScanState *state, const char *path);59 void (*SetColumnFilter) (struct TableFuncScanState *state,60 const char *path, int colnum);61 bool (*FetchRow) (struct TableFuncScanState *state);62 Datum (*GetValue) (struct TableFuncScanState *state, int colnum,63 Oid typid, int32 typmod, bool *isnull);64 void (*DestroyOpaque) (struct TableFuncScanState *state);65} TableFuncRoutine;66 67#endif /* _TABLEFUNC_H */68 