← Back to Overview

src/backend/parser/parse_graphtable.c

Coverage: 81/83 lines (97.6%)
Total Lines
83
modified
Covered
81
97.6%
Uncovered
2
2.4%
키보드 네비게이션
transformGraphTablePropertyRef() lines 39-83
Modified Lines Coverage: 26/26 lines (100.0%)
LineHitsSourceCommit
39 19173 transformGraphTablePropertyRef(ParseState *pstate, ColumnRef *cref) 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
40 - { 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
41 19173 GraphTableParseState *gpstate = pstate->p_graph_table_pstate; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
42 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
43 19173 if (!gpstate) 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
44 - return NULL; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
45 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
46 1176 if (list_length(cref->fields) == 2) 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
47 - { 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
48 1167 Node *field1 = linitial(cref->fields); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
49 1167 Node *field2 = lsecond(cref->fields); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
50 1167 char *elvarname; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
51 1167 char *propname; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
52 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
53 1167 elvarname = strVal(field1); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
54 1167 propname = strVal(field2); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
55 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
56 1167 if (list_member(gpstate->variables, field1)) 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
57 - { 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
58 1164 GraphPropertyRef *gpr = makeNode(GraphPropertyRef); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
59 1164 HeapTuple pgptup; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
60 1164 Form_pg_propgraph_property pgpform; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
61 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
62 1164 pgptup = SearchSysCache2(PROPGRAPHPROPNAME, ObjectIdGetDatum(gpstate->graphid), CStringGetDatum(propname)); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
63 1164 if (!HeapTupleIsValid(pgptup)) 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
64 3 ereport(ERROR, 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
65 - errcode(ERRCODE_SYNTAX_ERROR), 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
66 - errmsg("property \"%s\" does not exist", propname)); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
67 1161 pgpform = (Form_pg_propgraph_property) GETSTRUCT(pgptup); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
68 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
69 1161 gpr->location = cref->location; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
70 1161 gpr->elvarname = elvarname; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
71 1161 gpr->propid = pgpform->oid; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
72 1161 gpr->typeId = pgpform->pgptypid; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
73 1161 gpr->typmod = pgpform->pgptypmod; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
74 1161 gpr->collation = pgpform->pgpcollation; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
75 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
76 1161 ReleaseSysCache(pgptup); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
77 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
78 1161 return (Node *) gpr; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
79 - } 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
80 - } 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
81 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
82 - return NULL; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
83 - } 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
transformLabelExpr() lines 89-150
Modified Lines Coverage: 30/32 lines (93.8%)
LineHitsSourceCommit
89 1201 transformLabelExpr(GraphTableParseState *gpstate, Node *labelexpr) 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
90 - { 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
91 1201 Node *result; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
92 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
93 1201 if (labelexpr == NULL) 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
94 - return NULL; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
95 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
96 736 check_stack_depth(); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
97 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
98 736 switch (nodeTag(labelexpr)) 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
99 - { 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
100 706 case T_ColumnRef: 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
101 - { 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
102 706 ColumnRef *cref = (ColumnRef *) labelexpr; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
103 706 const char *labelname; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
104 706 Oid labelid; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
105 706 GraphLabelRef *lref; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
106 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
107 706 Assert(list_length(cref->fields) == 1); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
108 706 labelname = strVal(linitial(cref->fields)); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
109 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
110 706 labelid = GetSysCacheOid2(PROPGRAPHLABELNAME, Anum_pg_propgraph_label_oid, ObjectIdGetDatum(gpstate->graphid), CStringGetDatum(labelname)); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
111 706 if (!labelid) 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
112 3 ereport(ERROR, 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
113 - errcode(ERRCODE_UNDEFINED_OBJECT), 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
114 - errmsg("label \"%s\" does not exist in property graph \"%s\"", labelname, get_rel_name(gpstate->graphid))); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
115 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
116 703 lref = makeNode(GraphLabelRef); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
117 703 lref->labelid = labelid; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
118 703 lref->location = cref->location; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
119 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
120 703 result = (Node *) lref; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
121 703 break; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
122 - } 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
123 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
124 30 case T_BoolExpr: 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
125 - { 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
126 30 BoolExpr *be = (BoolExpr *) labelexpr; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
127 30 ListCell *lc; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
128 30 List *args = NIL; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
129 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
130 90 foreach(lc, be->args) 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
131 - { 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
132 63 Node *arg = (Node *) lfirst(lc); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
133 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
134 63 arg = transformLabelExpr(gpstate, arg); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
135 60 args = lappend(args, arg); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
136 - } 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
137 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
138 27 result = (Node *) makeBoolExpr(be->boolop, args, be->location); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
139 27 break; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
140 - } 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
141 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
142 0 default: 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
143 - /* should not reach here */ 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
144 0 elog(ERROR, "unrecognized node type: %d", (int) nodeTag(labelexpr)); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
145 - result = NULL; /* keep compiler quiet */ 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
146 - break; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
147 - } 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
148 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
149 - return result; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
150 - } 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
transformGraphElementPattern() lines 156-169
Modified Lines Coverage: 8/8 lines (100.0%)
LineHitsSourceCommit
156 1138 transformGraphElementPattern(ParseState *pstate, GraphElementPattern *gep) 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
157 - { 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
158 1138 GraphTableParseState *gpstate = pstate->p_graph_table_pstate; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
159 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
160 1138 if (gep->variable) 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
161 944 gpstate->variables = lappend(gpstate->variables, makeString(pstrdup(gep->variable))); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
162 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
163 1138 gep->labelexpr = transformLabelExpr(gpstate, gep->labelexpr); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
164 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
165 1135 gep->whereClause = transformExpr(pstate, gep->whereClause, EXPR_KIND_WHERE); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
166 1135 assign_expr_collations(pstate, gep->whereClause); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
167 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
168 1135 return (Node *) gep; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
169 - } 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
transformPathTerm() lines 175-184
Modified Lines Coverage: 6/6 lines (100.0%)
LineHitsSourceCommit
175 366 transformPathTerm(ParseState *pstate, List *path_term) 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
176 - { 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
177 366 List *result = NIL; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
178 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
179 1501 foreach_node(GraphElementPattern, gep, path_term) 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
180 1135 result = lappend(result, 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
181 1138 transformGraphElementPattern(pstate, gep)); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
182 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
183 363 return (Node *) result; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
184 - } 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
transformPathPatternList() lines 190-198
Modified Lines Coverage: 5/5 lines (100.0%)
LineHitsSourceCommit
190 366 transformPathPatternList(ParseState *pstate, List *path_pattern) 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
191 - { 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
192 366 List *result = NIL; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
193 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
194 729 foreach_node(List, path_term, path_pattern) 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
195 366 result = lappend(result, transformPathTerm(pstate, path_term)); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
196 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
197 363 return (Node *) result; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
198 - } 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
transformGraphPattern() lines 204-214
Modified Lines Coverage: 6/6 lines (100.0%)
LineHitsSourceCommit
204 366 transformGraphPattern(ParseState *pstate, GraphPattern *graph_pattern) 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
205 - { 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
206 366 List *path_pattern_list = castNode(List, 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
207 - transformPathPatternList(pstate, graph_pattern->path_pattern_list)); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
208 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
209 363 graph_pattern->path_pattern_list = path_pattern_list; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
210 363 graph_pattern->whereClause = transformExpr(pstate, graph_pattern->whereClause, EXPR_KIND_WHERE); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
211 363 assign_expr_collations(pstate, graph_pattern->whereClause); 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
212 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
213 363 return (Node *) graph_pattern; 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
214 - } 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)