/* * parseNodeString * * Given a character string representing a node tree, parseNodeString creates * the internal node structure. * * The string to be read must already have been loaded into pg_strtok(). */ Node * parseNodeString(void) { void *return_value; READ_TEMP_LOCALS(); token = pg_strtok(&length); #define MATCH(tokname, namelen) \ (length == namelen && strncmp(token, tokname, namelen) == 0) if (MATCH("QUERY", 5)) return_value = _readQuery(); else if (MATCH("SORTCLAUSE", 10)) return_value = _readSortClause(); else if (MATCH("GROUPCLAUSE", 11)) return_value = _readGroupClause(); else if (MATCH("ROWMARKCLAUSE", 13)) return_value = _readRowMarkClause(); else if (MATCH("SETOPERATIONSTMT", 16)) return_value = _readSetOperationStmt(); else if (MATCH("ALIAS", 5)) return_value = _readAlias(); else if (MATCH("RANGEVAR", 8)) return_value = _readRangeVar(); else if (MATCH("INTOCLAUSE", 10)) return_value = _readIntoClause(); else if (MATCH("VAR", 3)) return_value = _readVar(); else if (MATCH("CONST", 5)) return_value = _readConst(); else if (MATCH("PARAM", 5)) return_value = _readParam(); else if (MATCH("AGGREF", 6)) return_value = _readAggref(); else if (MATCH("ARRAYREF", 8)) return_value = _readArrayRef(); else if (MATCH("FUNCEXPR", 8)) return_value = _readFuncExpr(); else if (MATCH("OPEXPR", 6)) return_value = _readOpExpr(); else if (MATCH("DISTINCTEXPR", 12)) return_value = _readDistinctExpr(); else if (MATCH("SCALARARRAYOPEXPR", 17)) return_value = _readScalarArrayOpExpr(); else if (MATCH("BOOLEXPR", 8)) return_value = _readBoolExpr(); else if (MATCH("SUBLINK", 7)) return_value = _readSubLink(); else if (MATCH("FIELDSELECT", 11)) return_value = _readFieldSelect(); else if (MATCH("FIELDSTORE", 10)) return_value = _readFieldStore(); else if (MATCH("RELABELTYPE", 11)) return_value = _readRelabelType(); else if (MATCH("COERCEVIAIO", 11)) return_value = _readCoerceViaIO(); else if (MATCH("ARRAYCOERCEEXPR", 15)) return_value = _readArrayCoerceExpr(); else if (MATCH("CONVERTROWTYPEEXPR", 18)) return_value = _readConvertRowtypeExpr(); else if (MATCH("CASE", 4)) return_value = _readCaseExpr(); else if (MATCH("WHEN", 4)) return_value = _readCaseWhen(); else if (MATCH("CASETESTEXPR", 12)) return_value = _readCaseTestExpr(); else if (MATCH("ARRAY", 5)) return_value = _readArrayExpr(); else if (MATCH("ROW", 3)) return_value = _readRowExpr(); else if (MATCH("ROWCOMPARE", 10)) return_value = _readRowCompareExpr(); else if (MATCH("COALESCE", 8)) return_value = _readCoalesceExpr(); else if (MATCH("MINMAX", 6)) return_value = _readMinMaxExpr(); else if (MATCH("XMLEXPR", 7)) return_value = _readXmlExpr(); else if (MATCH("NULLIFEXPR", 10)) return_value = _readNullIfExpr(); else if (MATCH("NULLTEST", 8)) return_value = _readNullTest(); else if (MATCH("BOOLEANTEST", 11)) return_value = _readBooleanTest(); else if (MATCH("COERCETODOMAIN", 14)) return_value = _readCoerceToDomain(); else if (MATCH("COERCETODOMAINVALUE", 19)) return_value = _readCoerceToDomainValue(); else if (MATCH("SETTODEFAULT", 12)) return_value = _readSetToDefault(); else if (MATCH("CURRENTOFEXPR", 13)) return_value = _readCurrentOfExpr(); else if (MATCH("TARGETENTRY", 11)) return_value = _readTargetEntry(); else if (MATCH("RANGETBLREF", 11)) return_value = _readRangeTblRef(); else if (MATCH("JOINEXPR", 8)) return_value = _readJoinExpr(); else if (MATCH("FROMEXPR", 8)) return_value = _readFromExpr(); else if (MATCH("RTE", 3)) return_value = _readRangeTblEntry(); else if (MATCH("NOTIFY", 6)) return_value = _readNotifyStmt(); else if (MATCH("DECLARECURSOR", 13)) return_value = _readDeclareCursorStmt(); else { elog(ERROR, "badly formatted node string \"%.32s\"...", token); return_value = NULL; /* keep compiler quiet */ } return (Node *) return_value; }
/* * parseNodeString * * Given a character string representing a node tree, parseNodeString creates * the internal node structure. * * The string to be read must already have been loaded into citus_pg_strtok(). */ Node * CitusParseNodeString(void) { void *return_value; READ_TEMP_LOCALS(); token = citus_pg_strtok(&length); #define MATCH(tokname, namelen) \ (length == namelen && memcmp(token, tokname, namelen) == 0) if (MATCH("QUERY", 5)) return_value = _readQuery(); else if (MATCH("WITHCHECKOPTION", 15)) return_value = _readWithCheckOption(); else if (MATCH("SORTGROUPCLAUSE", 15)) return_value = _readSortGroupClause(); else if (MATCH("GROUPINGSET", 11)) return_value = _readGroupingSet(); else if (MATCH("WINDOWCLAUSE", 12)) return_value = _readWindowClause(); else if (MATCH("ROWMARKCLAUSE", 13)) return_value = _readRowMarkClause(); else if (MATCH("COMMONTABLEEXPR", 15)) return_value = _readCommonTableExpr(); else if (MATCH("SETOPERATIONSTMT", 16)) return_value = _readSetOperationStmt(); else if (MATCH("ALIAS", 5)) return_value = _readAlias(); else if (MATCH("RANGEVAR", 8)) return_value = _readRangeVar(); else if (MATCH("INTOCLAUSE", 10)) return_value = _readIntoClause(); else if (MATCH("VAR", 3)) return_value = _readVar(); else if (MATCH("CONST", 5)) return_value = _readConst(); else if (MATCH("PARAM", 5)) return_value = _readParam(); else if (MATCH("AGGREF", 6)) return_value = _readAggref(); else if (MATCH("GROUPINGFUNC", 12)) return_value = _readGroupingFunc(); else if (MATCH("WINDOWFUNC", 10)) return_value = _readWindowFunc(); else if (MATCH("ARRAYREF", 8)) return_value = _readArrayRef(); else if (MATCH("FUNCEXPR", 8)) return_value = _readFuncExpr(); else if (MATCH("NAMEDARGEXPR", 12)) return_value = _readNamedArgExpr(); else if (MATCH("OPEXPR", 6)) return_value = _readOpExpr(); else if (MATCH("DISTINCTEXPR", 12)) return_value = _readDistinctExpr(); else if (MATCH("NULLIFEXPR", 10)) return_value = _readNullIfExpr(); else if (MATCH("SCALARARRAYOPEXPR", 17)) return_value = _readScalarArrayOpExpr(); else if (MATCH("BOOLEXPR", 8)) return_value = _readBoolExpr(); else if (MATCH("SUBLINK", 7)) return_value = _readSubLink(); else if (MATCH("FIELDSELECT", 11)) return_value = _readFieldSelect(); else if (MATCH("FIELDSTORE", 10)) return_value = _readFieldStore(); else if (MATCH("RELABELTYPE", 11)) return_value = _readRelabelType(); else if (MATCH("COERCEVIAIO", 11)) return_value = _readCoerceViaIO(); else if (MATCH("ARRAYCOERCEEXPR", 15)) return_value = _readArrayCoerceExpr(); else if (MATCH("CONVERTROWTYPEEXPR", 18)) return_value = _readConvertRowtypeExpr(); else if (MATCH("COLLATE", 7)) return_value = _readCollateExpr(); else if (MATCH("CASE", 4)) return_value = _readCaseExpr(); else if (MATCH("WHEN", 4)) return_value = _readCaseWhen(); else if (MATCH("CASETESTEXPR", 12)) return_value = _readCaseTestExpr(); else if (MATCH("ARRAY", 5)) return_value = _readArrayExpr(); else if (MATCH("ROW", 3)) return_value = _readRowExpr(); else if (MATCH("ROWCOMPARE", 10)) return_value = _readRowCompareExpr(); else if (MATCH("COALESCE", 8)) return_value = _readCoalesceExpr(); else if (MATCH("MINMAX", 6)) return_value = _readMinMaxExpr(); else if (MATCH("XMLEXPR", 7)) return_value = _readXmlExpr(); else if (MATCH("NULLTEST", 8)) return_value = _readNullTest(); else if (MATCH("BOOLEANTEST", 11)) return_value = _readBooleanTest(); else if (MATCH("COERCETODOMAIN", 14)) return_value = _readCoerceToDomain(); else if (MATCH("COERCETODOMAINVALUE", 19)) return_value = _readCoerceToDomainValue(); else if (MATCH("SETTODEFAULT", 12)) return_value = _readSetToDefault(); else if (MATCH("CURRENTOFEXPR", 13)) return_value = _readCurrentOfExpr(); else if (MATCH("INFERENCEELEM", 13)) return_value = _readInferenceElem(); else if (MATCH("TARGETENTRY", 11)) return_value = _readTargetEntry(); else if (MATCH("RANGETBLREF", 11)) return_value = _readRangeTblRef(); else if (MATCH("JOINEXPR", 8)) return_value = _readJoinExpr(); else if (MATCH("FROMEXPR", 8)) return_value = _readFromExpr(); else if (MATCH("ONCONFLICTEXPR", 14)) return_value = _readOnConflictExpr(); else if (MATCH("RTE", 3)) return_value = _readRangeTblEntry(); else if (MATCH("RANGETBLFUNCTION", 16)) return_value = _readRangeTblFunction(); else if (MATCH("TABLESAMPLECLAUSE", 17)) return_value = _readTableSampleClause(); else if (MATCH("NOTIFY", 6)) return_value = _readNotifyStmt(); else if (MATCH("DECLARECURSOR", 13)) return_value = _readDeclareCursorStmt(); /* XXX: BEGIN Citus Nodes */ else if (MATCH("MULTIPLAN", 9)) return_value = _readMultiPlan(); else if (MATCH("JOB", 3)) return_value = _readJob(); else if (MATCH("SHARDINTERVAL", 13)) return_value = _readShardInterval(); else if (MATCH("MAPMERGEJOB", 11)) return_value = _readMapMergeJob(); else if (MATCH("SHARDPLACEMENT", 14)) return_value = _readShardPlacement(); else if (MATCH("TASK", 4)) return_value = _readTask(); /* XXX: END Citus Nodes */ else { elog(ERROR, "badly formatted node string \"%.32s\"...", token); return_value = NULL; /* keep compiler quiet */ } return (Node *) return_value; }