43#include "utils/fmgroids.h"
136 rte->graph_table_columns =
NIL;
206 if (
gep->variable &&
other->variable &&
212 errmsg(
"element patterns with same variable name \"%s\" but different element pattern types",
224 if (!
other->labelexpr)
229 errmsg(
"element patterns with same variable name \"%s\" but different label expressions are not supported",
237 if (!
other->whereClause)
238 other->whereClause =
gep->whereClause;
239 else if (
gep->whereClause)
253 pf->kind =
gep->kind;
254 pf->labelexpr =
gep->labelexpr;
255 pf->variable =
gep->variable;
256 pf->whereClause =
gep->whereClause;
294 errmsg(
"an edge cannot connect more than two vertexes even in a cyclic pattern"));
303 errmsg(
"an edge cannot connect more than two vertexes even in a cyclic pattern"));
313 errmsg(
"an edge cannot connect more than two vertexes even in a cyclic pattern"));
322 errmsg(
"an edge cannot connect more than two vertexes even in a cyclic pattern"));
441 if (
src_pe->elemoid ==
pe->srcvertexid &&
457 src_pe->elemoid ==
pe->destvertexid)
465 pe->path_factor->dest_pf->factorpos + 1, 0);
467 pe->path_factor->src_pf->factorpos + 1, 0);
528 if (
rte->graph_pattern->whereClause)
531 (
Node *)
rte->graph_pattern->whereClause,
543 (
Node *)
rte->graph_table_columns,
577 query->rteperminfos =
NIL;
763 pe->path_factor =
pf;
782 pe->srcvertexid =
pgeform->pgesrcvertexid;
783 pe->destvertexid =
pgeform->pgedestvertexid;
863 elog(
ERROR,
"unsupported label expression node: %d", (
int)
nodeTag(labelexpr));
969 errmsg(
"no property graph element of type \"%s\" has label \"%s\" associated with it in property graph \"%s\"",
1029 if (m->path_factor->variable &&
strcmp(
gpr->elvarname, m->path_factor->variable) == 0)
1123 errmsg(
"property \"%s\" for element variable \"%s\" not found",
1177 for (
int i = 0;
i <
n1;
i++)
1201 elog(
ERROR,
"cache lookup failed for operator %u", eqop);
1262 true,
NULL, 1, key);
1297 true,
NULL, 1, key);
#define DatumGetArrayTypeP(X)
void deconstruct_array_builtin(const ArrayType *array, Oid elmtype, Datum **elemsp, bool **nullsp, int *nelemsp)
Bitmapset * bms_add_member(Bitmapset *a, int x)
#define TextDatumGetCString(d)
#define RegProcedureIsValid(p)
#define Assert(condition)
#define OidIsValid(objectId)
int errcode(int sqlerrcode)
#define ereport(elevel,...)
bool equal(const void *a, const void *b)
#define palloc0_object(type)
void systable_endscan(SysScanDesc sysscan)
HeapTuple systable_getnext(SysScanDesc sysscan)
SysScanDesc systable_beginscan(Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
List * lappend(List *list, void *datum)
List * list_delete_first(List *list)
List * list_difference_oid(const List *list1, const List *list2)
List * list_concat(List *list1, const List *list2)
List * lappend_oid(List *list, Oid datum)
List * list_delete_last(List *list)
bool list_member_oid(const List *list, Oid datum)
char * get_rel_name(Oid relid)
char * get_propgraph_property_name(Oid propoid)
bool get_func_retset(Oid funcid)
char * get_propgraph_label_name(Oid labeloid)
void get_atttypetypmodcoll(Oid relid, AttrNumber attnum, Oid *typid, int32 *typmod, Oid *collid)
Expr * makeBoolExpr(BoolExprType boolop, List *args, int location)
FromExpr * makeFromExpr(List *fromlist, Node *quals)
Var * makeVar(int varno, AttrNumber varattno, Oid vartype, int32 vartypmod, Oid varcollid, Index varlevelsup)
Const * makeNullConst(Oid consttype, int32 consttypmod, Oid constcollid)
Node * makeBoolConst(bool value, bool isnull)
TargetEntry * makeTargetEntry(Expr *expr, AttrNumber resno, char *resname, bool resjunk)
char * pstrdup(const char *in)
Oid exprType(const Node *expr)
int32 exprTypmod(const Node *expr)
Oid exprCollation(const Node *expr)
int exprLocation(const Node *expr)
#define expression_tree_mutator(n, m, c)
#define IsA(nodeptr, _type_)
#define castNode(_type_, nodeptr)
void assign_expr_collations(ParseState *pstate, Node *expr)
void make_fn_arguments(ParseState *pstate, List *fargs, Oid *actual_arg_types, Oid *declared_arg_types)
ParseState * make_parsestate(ParseState *parentParseState)
RTEPermissionInfo * getRTEPermissionInfo(List *rteperminfos, RangeTblEntry *rte)
ParseNamespaceItem * addRangeTableEntryForRelation(ParseState *pstate, Relation rel, LOCKMODE lockmode, Alias *alias, bool inh, bool inFromCl)
ParseNamespaceItem * addRangeTableEntryForSubquery(ParseState *pstate, Query *subquery, Alias *alias, bool lateral, bool inFromCl)
#define IS_EDGE_PATTERN(kind)
void constructSetOpTargetlist(ParseState *pstate, SetOperationStmt *op, const List *ltargetlist, const List *rtargetlist, List **targetlist, const char *context, bool recursive)
#define rt_fetch(rangetable_index, rangetable)
static int list_length(const List *l)
#define linitial_node(type, l)
#define list_make1_oid(x1)
#define foreach_ptr(type, var, lst)
static void * list_nth(const List *list, int n)
#define foreach_node(type, var, lst)
#define forfour(cell1, list1, cell2, list2, cell3, list3, cell4, list4)
#define foreach_oid(var, lst)
#define list_nth_node(type, list, n)
#define list_make2(x1, x2)
END_CATALOG_STRUCT typedef FormData_pg_operator * Form_pg_operator
END_CATALOG_STRUCT typedef FormData_pg_propgraph_element * Form_pg_propgraph_element
END_CATALOG_STRUCT typedef FormData_pg_propgraph_element_label * Form_pg_propgraph_element_label
END_CATALOG_STRUCT typedef FormData_pg_propgraph_label * Form_pg_propgraph_label
static Oid DatumGetObjectId(Datum X)
static Datum ObjectIdGetDatum(Oid X)
static int16 DatumGetInt16(Datum X)
void * stringToNode(const char *str)
static List * generate_queries_for_path_pattern_recurse(RangeTblEntry *rte, List *pathqueries, List *cur_path, List *path_pattern_lists, int elempos)
static Query * generate_query_for_graph_path(RangeTblEntry *rte, List *path)
static Node * replace_property_refs_mutator(Node *node, struct replace_property_refs_context *context)
static Node * get_element_property_expr(Oid elemoid, Oid propoid, int rtindex)
Query * rewriteGraphTable(Query *parsetree, int rt_index)
static Query * generate_union_from_pathqueries(List **pathqueries)
static struct path_element * create_pe_for_element(struct path_factor *pf, Oid elemoid)
static List * build_edge_vertex_link_quals(HeapTuple edgetup, int edgerti, int refrti, Oid refid, AttrNumber catalog_key_attnum, AttrNumber catalog_ref_attnum, AttrNumber catalog_eqop_attnum)
static List * get_labels_for_expr(Oid propgraphid, Node *labelexpr)
static List * generate_queries_for_path_pattern(RangeTblEntry *rte, List *element_patterns)
static Node * replace_property_refs(Oid propgraphid, Node *node, const List *mappings)
static Node * generate_setop_from_pathqueries(List *pathqueries, List **rtable, List **targetlist)
static List * get_path_elements_for_path_factor(Oid propgraphid, struct path_factor *pf)
static bool is_property_associated_with_label(Oid labeloid, Oid propoid)
static Query * generate_query_for_empty_path_pattern(RangeTblEntry *rte)
void AcquireRewriteLocks(Query *parsetree, bool forExecute, bool forUpdatePushedDown)
void ChangeVarNodes(Node *node, int rt_index, int new_index, int sublevels_up)
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
#define BTEqualStrategyNumber
struct path_factor * path_factor
struct path_factor * src_pf
struct path_factor * dest_pf
GraphElementPatternKind kind
#define FirstLowInvalidHeapAttributeNumber
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache2(SysCacheIdentifier cacheId, Datum key1, Datum key2)
Datum SysCacheGetAttrNotNull(SysCacheIdentifier cacheId, HeapTuple tup, AttrNumber attributeNumber)
HeapTuple SearchSysCache1(SysCacheIdentifier cacheId, Datum key1)
#define SearchSysCacheExists2(cacheId, key1, key2)
#define GetSysCacheOid1(cacheId, oidcol, key1)
#define GetSysCacheOid2(cacheId, oidcol, key1, key2)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
List * pull_vars_of_level(Node *node, int levelsup)