| 1 | /*------------------------------------------------------------------------- |
| 2 | * |
| 3 | * makefuncs.h |
| 4 | * prototypes for the creator functions (for primitive nodes) |
| 5 | * |
| 6 | * |
| 7 | * Portions Copyright (c) 1996-2017, PostgreSQL Global Development PGGroup |
| 8 | * Portions Copyright (c) 1994, Regents of the University of California |
| 9 | * |
| 10 | * src/include/nodes/makefuncs.h |
| 11 | * |
| 12 | *------------------------------------------------------------------------- |
| 13 | */ |
| 14 | #pragma once |
| 15 | |
| 16 | #include "nodes/parsenodes.hpp" |
| 17 | |
| 18 | namespace duckdb_libpgquery { |
| 19 | |
| 20 | PGAExpr *makeAExpr(PGAExpr_Kind kind, PGList *name, PGNode *lexpr, PGNode *rexpr, int location); |
| 21 | |
| 22 | PGAExpr *makeSimpleAExpr(PGAExpr_Kind kind, const char *name, PGNode *lexpr, PGNode *rexpr, int location); |
| 23 | |
| 24 | PGVar *makeVar(PGIndex varno, PGAttrNumber varattno, PGOid vartype, int32_t vartypmod, PGOid varcollid, |
| 25 | PGIndex varlevelsup); |
| 26 | |
| 27 | PGVar *makeVarFromTargetEntry(PGIndex varno, PGTargetEntry *tle); |
| 28 | |
| 29 | PGVar *makeWholeRowVar(PGRangeTblEntry *rte, PGIndex varno, PGIndex varlevelsup, bool allowScalar); |
| 30 | |
| 31 | PGTargetEntry *makeTargetEntry(PGExpr *expr, PGAttrNumber resno, char *resname, bool resjunk); |
| 32 | |
| 33 | PGTargetEntry *flatCopyTargetEntry(PGTargetEntry *src_tle); |
| 34 | |
| 35 | PGFromExpr *makeFromExpr(PGList *fromlist, PGNode *quals); |
| 36 | |
| 37 | PGConst *makeConst(PGOid consttype, int32_t consttypmod, PGOid constcollid, int constlen, PGDatum constvalue, |
| 38 | bool constisnull, bool constbyval); |
| 39 | |
| 40 | PGConst *makeNullConst(PGOid consttype, int32_t consttypmod, PGOid constcollid); |
| 41 | |
| 42 | PGNode *makeBoolConst(bool value, bool isnull); |
| 43 | |
| 44 | PGExpr *makeBoolExpr(PGBoolExprType boolop, PGList *args, int location); |
| 45 | |
| 46 | PGAlias *makeAlias(const char *aliasname, PGList *colnames); |
| 47 | |
| 48 | PGRelabelType *makeRelabelType(PGExpr *arg, PGOid rtype, int32_t rtypmod, PGOid rcollid, PGCoercionForm rformat); |
| 49 | |
| 50 | PGRangeVar *makeRangeVar(char *schemaname, char *relname, int location); |
| 51 | |
| 52 | PGTypeName *makeTypeName(char *typnam); |
| 53 | PGTypeName *makeTypeNameFromNameList(PGList *names); |
| 54 | PGTypeName *makeTypeNameFromOid(PGOid typeOid, int32_t typmod); |
| 55 | |
| 56 | PGColumnDef *makeColumnDef(const char *colname, PGOid typeOid, int32_t typmod, PGOid collOid); |
| 57 | |
| 58 | PGFuncExpr *makeFuncExpr(PGOid funcid, PGOid rettype, PGList *args, PGOid funccollid, PGOid inputcollid, |
| 59 | PGCoercionForm fformat); |
| 60 | |
| 61 | PGFuncCall *makeFuncCall(PGList *name, PGList *args, int location); |
| 62 | |
| 63 | PGDefElem *makeDefElem(const char *name, PGNode *arg, int location); |
| 64 | PGDefElem *makeDefElemExtended(const char *nameSpace, const char *name, PGNode *arg, PGDefElemAction defaction, |
| 65 | int location); |
| 66 | |
| 67 | PGGroupingSet *makeGroupingSet(GroupingSetKind kind, PGList *content, int location); |
| 68 | |
| 69 | } |