PostgreSQL Source Code git master
Loading...
Searching...
No Matches
parse_graphtable.h File Reference
#include "nodes/pg_list.h"
#include "parser/parse_node.h"
Include dependency graph for parse_graphtable.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

NodetransformGraphTablePropertyRef (ParseState *pstate, ColumnRef *cref)
 
NodetransformGraphPattern (ParseState *pstate, GraphPattern *graph_pattern)
 

Function Documentation

◆ transformGraphPattern()

Node * transformGraphPattern ( ParseState pstate,
GraphPattern graph_pattern 
)
extern

Definition at line 299 of file parse_graphtable.c.

300{
301 List *path_pattern_list = castNode(List,
302 transformPathPatternList(pstate, graph_pattern->path_pattern_list));
303
304 graph_pattern->path_pattern_list = path_pattern_list;
305 graph_pattern->whereClause = transformExpr(pstate, graph_pattern->whereClause, EXPR_KIND_WHERE);
306 assign_expr_collations(pstate, graph_pattern->whereClause);
307
308 return (Node *) graph_pattern;
309}
#define castNode(_type_, nodeptr)
Definition nodes.h:182
void assign_expr_collations(ParseState *pstate, Node *expr)
Node * transformExpr(ParseState *pstate, Node *expr, ParseExprKind exprKind)
Definition parse_expr.c:121
static Node * transformPathPatternList(ParseState *pstate, List *path_pattern)
@ EXPR_KIND_WHERE
Definition parse_node.h:46
Node * whereClause
List * path_pattern_list
Definition pg_list.h:54
Definition nodes.h:135

References assign_expr_collations(), castNode, EXPR_KIND_WHERE, GraphPattern::path_pattern_list, transformExpr(), transformPathPatternList(), and GraphPattern::whereClause.

Referenced by transformRangeGraphTable().

◆ transformGraphTablePropertyRef()

Node * transformGraphTablePropertyRef ( ParseState pstate,
ColumnRef cref 
)
extern

Definition at line 79 of file parse_graphtable.c.

80{
82
83 if (!gpstate)
84 return NULL;
85
86 if (list_length(cref->fields) == 2)
87 {
88 Node *field1 = linitial(cref->fields);
89 Node *field2 = lsecond(cref->fields);
90 char *elvarname;
91 char *propname;
92
93 if (IsA(field1, A_Star) || IsA(field2, A_Star))
94 {
98 errmsg("\"*\" is not supported here"),
99 parser_errposition(pstate, cref->location));
100 else
103 errmsg("\"*\" not allowed here"),
104 parser_errposition(pstate, cref->location));
105 }
106
107 elvarname = strVal(field1);
109
110 if (list_member(gpstate->variables, field1))
111 {
115
120 errmsg("property \"%s\" does not exist", propname));
122
123 gpr->location = cref->location;
124 gpr->elvarname = elvarname;
125 gpr->propid = pgpform->oid;
126 gpr->typeId = pgpform->pgptypid;
127 gpr->typmod = pgpform->pgptypmod;
128 gpr->collation = pgpform->pgpcollation;
129
131
132 return (Node *) gpr;
133 }
134 }
135
136 return NULL;
137}
int errcode(int sqlerrcode)
Definition elog.c:874
#define ERROR
Definition elog.h:39
#define ereport(elevel,...)
Definition elog.h:150
#define HeapTupleIsValid(tuple)
Definition htup.h:78
static void * GETSTRUCT(const HeapTupleData *tuple)
bool list_member(const List *list, const void *datum)
Definition list.c:661
#define IsA(nodeptr, _type_)
Definition nodes.h:164
#define makeNode(_type_)
Definition nodes.h:161
static char * errmsg
int parser_errposition(ParseState *pstate, int location)
Definition parse_node.c:106
@ EXPR_KIND_SELECT_TARGET
Definition parse_node.h:54
static int list_length(const List *l)
Definition pg_list.h:152
#define linitial(l)
Definition pg_list.h:178
#define lsecond(l)
Definition pg_list.h:183
END_CATALOG_STRUCT typedef FormData_pg_propgraph_property * Form_pg_propgraph_property
static Datum ObjectIdGetDatum(Oid X)
Definition postgres.h:252
static Datum CStringGetDatum(const char *X)
Definition postgres.h:370
static int fb(int x)
ParseExprKind p_expr_kind
Definition parse_node.h:228
GraphTableParseState * p_graph_table_pstate
Definition parse_node.h:238
void ReleaseSysCache(HeapTuple tuple)
Definition syscache.c:264
HeapTuple SearchSysCache2(SysCacheIdentifier cacheId, Datum key1, Datum key2)
Definition syscache.c:230
#define strVal(v)
Definition value.h:82

References CStringGetDatum(), ereport, errcode(), errmsg, ERROR, EXPR_KIND_SELECT_TARGET, fb(), Form_pg_propgraph_property, GETSTRUCT(), HeapTupleIsValid, IsA, linitial, list_length(), list_member(), lsecond, makeNode, ObjectIdGetDatum(), ParseState::p_expr_kind, ParseState::p_graph_table_pstate, parser_errposition(), ReleaseSysCache(), SearchSysCache2(), and strVal.

Referenced by transformColumnRef().