From 4c8f6390ba25369ad6067fccc0cbf131f933473d Mon Sep 17 00:00:00 2001 From: Rafsun Masud Date: Wed, 18 Oct 2023 12:11:30 -0700 Subject: [PATCH 01/13] Add cypher_label_expr data type It represents label expression of different type: empty, single or multiple. --- src/backend/executor/cypher_create.c | 14 +++- src/backend/nodes/ag_nodes.c | 2 + src/backend/nodes/cypher_copyfuncs.c | 1 + src/backend/nodes/cypher_outfuncs.c | 11 +++ src/backend/nodes/cypher_readfuncs.c | 1 + src/backend/parser/cypher_clause.c | 63 ++++++--------- src/backend/parser/cypher_gram.y | 46 +++++++---- src/include/nodes/ag_nodes.h | 2 + src/include/nodes/cypher_nodes.h | 39 +++++++-- src/include/nodes/cypher_outfuncs.h | 1 + src/include/parser/cypher_label_expr.h | 108 +++++++++++++++++++++++++ 11 files changed, 226 insertions(+), 62 deletions(-) create mode 100644 src/include/parser/cypher_label_expr.h diff --git a/src/backend/executor/cypher_create.c b/src/backend/executor/cypher_create.c index 2091ea29c..0f794f355 100644 --- a/src/backend/executor/cypher_create.c +++ b/src/backend/executor/cypher_create.c @@ -421,9 +421,12 @@ static void create_edge(cypher_create_custom_scan_state *css, PlanState *ps = css->css.ss.ps.lefttree; TupleTableSlot *scantuple = ps->ps_ExprContext->ecxt_scantuple; Datum result; + char *label_name = node->label_names ? + (char *)strVal(linitial(node->label_names)): + ""; result = make_edge( - id, start_id, end_id, CStringGetDatum(node->label_name), + id, start_id, end_id, CStringGetDatum(label_name), scanTupleSlot->tts_values[node->prop_attr_num]); if (CYPHER_TARGET_NODE_IN_PATH(node->flags)) @@ -508,13 +511,16 @@ static Datum create_vertex(cypher_create_custom_scan_state *css, TupleTableSlot *scantuple; PlanState *ps; Datum result; + char *label_name = node->label_names ? + (char *)strVal(linitial(node->label_names)) : + ""; ps = css->css.ss.ps.lefttree; scantuple = ps->ps_ExprContext->ecxt_scantuple; - /* make the vertex agtype */ - result = make_vertex(id, CStringGetDatum(node->label_name), - scanTupleSlot->tts_values[node->prop_attr_num]); + // make the vertex agtype + result = make_vertex(id, CStringGetDatum(label_name), + scanTupleSlot->tts_values[node->prop_attr_num]); /* append to the path list */ if (CYPHER_TARGET_NODE_IN_PATH(node->flags)) diff --git a/src/backend/nodes/ag_nodes.c b/src/backend/nodes/ag_nodes.c index e20670b2b..5fdc561f3 100644 --- a/src/backend/nodes/ag_nodes.c +++ b/src/backend/nodes/ag_nodes.c @@ -59,6 +59,7 @@ const char *node_names[] = { "cypher_create_target_nodes", "cypher_create_path", "cypher_target_node", + "cypher_label_expr", "cypher_update_information", "cypher_update_item", "cypher_delete_information", @@ -108,6 +109,7 @@ const ExtensibleNodeMethods node_methods[] = { DEFINE_NODE_METHODS(cypher_unwind), DEFINE_NODE_METHODS(cypher_merge), DEFINE_NODE_METHODS(cypher_path), + DEFINE_NODE_METHODS(cypher_label_expr), DEFINE_NODE_METHODS(cypher_node), DEFINE_NODE_METHODS(cypher_relationship), DEFINE_NODE_METHODS(cypher_bool_const), diff --git a/src/backend/nodes/cypher_copyfuncs.c b/src/backend/nodes/cypher_copyfuncs.c index 56895ee06..05d59d660 100644 --- a/src/backend/nodes/cypher_copyfuncs.c +++ b/src/backend/nodes/cypher_copyfuncs.c @@ -102,6 +102,7 @@ void copy_cypher_target_node(ExtensibleNode *newnode, const ExtensibleNode *from COPY_SCALAR_FIELD(tuple_position); COPY_STRING_FIELD(label_name); + COPY_NODE_FIELD(label_names); COPY_STRING_FIELD(variable_name); COPY_NODE_FIELD(id_expr); diff --git a/src/backend/nodes/cypher_outfuncs.c b/src/backend/nodes/cypher_outfuncs.c index e245ba639..7bd9c0e14 100644 --- a/src/backend/nodes/cypher_outfuncs.c +++ b/src/backend/nodes/cypher_outfuncs.c @@ -198,6 +198,16 @@ void out_cypher_path(StringInfo str, const ExtensibleNode *node) WRITE_LOCATION_FIELD(location); } +/* serialization function for the cypher_label_expr ExtensibleNode. */ +void out_cypher_label_expr(StringInfo str, const ExtensibleNode *node) +{ + DEFINE_AG_NODE(cypher_label_expr); + + WRITE_INT32_FIELD(type); + WRITE_NODE_FIELD(label_names); + WRITE_CHAR_FIELD(kind); +} + /* serialization function for the cypher_node ExtensibleNode. */ void out_cypher_node(StringInfo str, const ExtensibleNode *node) { @@ -389,6 +399,7 @@ void out_cypher_target_node(StringInfo str, const ExtensibleNode *node) WRITE_NODE_FIELD(elemTupleSlot); WRITE_OID_FIELD(relid); WRITE_STRING_FIELD(label_name); + WRITE_NODE_FIELD(label_names); WRITE_STRING_FIELD(variable_name); WRITE_INT32_FIELD(tuple_position); } diff --git a/src/backend/nodes/cypher_readfuncs.c b/src/backend/nodes/cypher_readfuncs.c index a58b90cbc..842553ad9 100644 --- a/src/backend/nodes/cypher_readfuncs.c +++ b/src/backend/nodes/cypher_readfuncs.c @@ -235,6 +235,7 @@ void read_cypher_target_node(struct ExtensibleNode *node) READ_NODE_FIELD(elemTupleSlot); READ_OID_FIELD(relid); READ_STRING_FIELD(label_name); + READ_NODE_FIELD(label_names); READ_STRING_FIELD(variable_name); READ_INT_FIELD(tuple_position); } diff --git a/src/backend/parser/cypher_clause.c b/src/backend/parser/cypher_clause.c index e301daa0f..4baf25a3b 100644 --- a/src/backend/parser/cypher_clause.c +++ b/src/backend/parser/cypher_clause.c @@ -37,6 +37,7 @@ #include "parser/parse_target.h" #include "parser/parsetree.h" #include "parser/parse_relation.h" +#include "parser/cypher_label_expr.h" #include "rewrite/rewriteHandler.h" #include "catalog/ag_graph.h" @@ -5804,20 +5805,18 @@ transform_create_cypher_edge(cypher_parsestate *cpstate, List **target_list, AttrNumber resno; ParseNamespaceItem *pnsi; - if (edge->label) + if (!validate_label_expr_kind(edge->label_expr, cpstate->graph_oid, LABEL_KIND_EDGE)) { - if (get_label_kind(edge->label, cpstate->graph_oid) == LABEL_KIND_VERTEX) - { - ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("label %s is for vertices, not edges", edge->label), - parser_errposition(pstate, edge->location))); - } + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("label %s is for vertices, not edges", edge->label), + parser_errposition(pstate, edge->location))); } + cluster_name = get_cluster_name(edge->label_expr); rel->type = LABEL_KIND_EDGE; rel->flags = CYPHER_TARGET_NODE_FLAG_INSERT; - rel->label_name = edge->label; + rel->label_names = LABEL_EXPR_LABEL_NAMES(edge->label_expr); rel->resultRelInfo = NULL; if (edge->name) @@ -5861,7 +5860,7 @@ transform_create_cypher_edge(cypher_parsestate *cpstate, List **target_list, rel->dir = edge->dir; - if (!edge->label) + if (LABEL_EXPR_IS_EMPTY(edge->label_expr)) { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), @@ -5870,7 +5869,7 @@ transform_create_cypher_edge(cypher_parsestate *cpstate, List **target_list, } /* create the label entry if it does not exist */ - if (!label_exists(edge->label, cpstate->graph_oid)) + if (!label_exists(cluster_name, cpstate->graph_oid)) { List *parent; @@ -5879,12 +5878,12 @@ transform_create_cypher_edge(cypher_parsestate *cpstate, List **target_list, parent = list_make1(rv); - create_label(cpstate->graph_name, edge->label, LABEL_TYPE_EDGE, + create_label(cpstate->graph_name, cluster_name, LABEL_TYPE_EDGE, parent); } /* lock the relation of the label */ - rv = makeRangeVar(cpstate->graph_name, edge->label, -1); + rv = makeRangeVar(cpstate->graph_name, cluster_name, -1); label_relation = parserOpenTable(&cpstate->pstate, rv, RowExclusiveLock); /* Store the relid */ @@ -5947,15 +5946,13 @@ transform_create_cypher_node(cypher_parsestate *cpstate, List **target_list, { ParseState *pstate = (ParseState *)cpstate; - if (node->label) + if (!validate_label_expr_kind(node->label_expr, cpstate->graph_oid, + LABEL_KIND_VERTEX)) { - if (get_label_kind(node->label, cpstate->graph_oid) == LABEL_KIND_EDGE) - { - ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("label %s is for edges, not vertices", - node->label), - parser_errposition(pstate, node->location))); - } + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("label %s is for edges, not vertices", node->label), + parser_errposition(pstate, node->location))); } /* @@ -6081,7 +6078,7 @@ static cypher_target_node *transform_create_cypher_existing_node( errmsg("previously declared nodes in a create clause cannot have properties"), parser_errposition(pstate, node->location))); } - if (node->label) + if (!LABEL_EXPR_IS_EMPTY(node->label_expr)) { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), @@ -6126,28 +6123,18 @@ transform_create_cypher_new_node(cypher_parsestate *cpstate, char *alias; int resno; ParseNamespaceItem *pnsi; + char *cluster_name; rel->type = LABEL_KIND_VERTEX; rel->tuple_position = InvalidAttrNumber; rel->variable_name = NULL; rel->resultRelInfo = NULL; - if (!node->label) - { - rel->label_name = ""; - /* - * If no label is specified, assign the generic label name that - * all labels are descendents of. - */ - node->label = AG_DEFAULT_LABEL_VERTEX; - } - else - { - rel->label_name = node->label; - } + cluster_name = get_cluster_name(node->label_expr); + rel->label_names = LABEL_EXPR_LABEL_NAMES(node->label_expr); /* create the label entry if it does not exist */ - if (!label_exists(node->label, cpstate->graph_oid)) + if (!label_exists(cluster_name, cpstate->graph_oid)) { List *parent; @@ -6156,13 +6143,13 @@ transform_create_cypher_new_node(cypher_parsestate *cpstate, parent = list_make1(rv); - create_label(cpstate->graph_name, node->label, LABEL_TYPE_VERTEX, + create_label(cpstate->graph_name, cluster_name, LABEL_TYPE_VERTEX, parent); } rel->flags = CYPHER_TARGET_NODE_FLAG_INSERT; - rv = makeRangeVar(cpstate->graph_name, node->label, -1); + rv = makeRangeVar(cpstate->graph_name, cluster_name, -1); label_relation = parserOpenTable(&cpstate->pstate, rv, RowExclusiveLock); /* Store the relid */ diff --git a/src/backend/parser/cypher_gram.y b/src/backend/parser/cypher_gram.y index b748993c5..dfebeb0d0 100644 --- a/src/backend/parser/cypher_gram.y +++ b/src/backend/parser/cypher_gram.y @@ -26,6 +26,7 @@ #include "parser/cypher_gram.h" #include "parser/cypher_parse_node.h" #include "parser/scansup.h" +#include "catalog/ag_label.h" /* override the default action for locations */ #define YYLLOC_DEFAULT(current, rhs, n) \ @@ -147,7 +148,7 @@ %type path anonymous_path path_node path_relationship path_relationship_body properties_opt -%type label_opt +%type label_expr /* expression */ %type expr expr_opt expr_atom expr_literal map list @@ -1382,15 +1383,17 @@ simple_path: ; path_node: - '(' var_name_opt label_opt properties_opt ')' + '(' var_name_opt label_expr properties_opt ')' { cypher_node *n; n = make_ag_node(cypher_node); n->name = $2; n->parsed_name = $2; - n->label = $3; - n->parsed_label = $3; + n->label_expr = (cypher_label_expr *) $3; + n->label_expr->kind = LABEL_KIND_VERTEX; + n->label = NULL; // TODO: to be deprecated + n->parsed_label = NULL; // TODO; to be deprecated n->use_equals = false; n->props = $4; n->location = @2; @@ -1404,8 +1407,10 @@ path_node: n = make_ag_node(cypher_node); n->name = $2; n->parsed_name = $2; - n->label = $3; - n->parsed_label = $3; + n->label_expr = (cypher_label_expr *) $3; + n->label_expr->kind = LABEL_KIND_VERTEX; + n->label = NULL; // TODO: to be deprecated + n->parsed_label = NULL; // TODO; to be deprecated n->use_equals = true; n->props = $5; n->location = @2; @@ -1445,30 +1450,34 @@ path_relationship: ; path_relationship_body: - '[' var_name_opt label_opt cypher_varlen_opt properties_opt ']' + '[' var_name_opt label_expr cypher_varlen_opt properties_opt ']' { cypher_relationship *n; n = make_ag_node(cypher_relationship); n->name = $2; n->parsed_name = $2; - n->label = $3; - n->parsed_label = $3; + n->label_expr = (cypher_label_expr *) $3; + n->label_expr->kind = LABEL_KIND_EDGE; + n->label = NULL; // TODO: to be deprecated + n->parsed_label = NULL; // TODO; to be deprecated n->varlen = $4; n->use_equals = false; n->props = $5; $$ = (Node *)n; } - | '[' var_name_opt label_opt cypher_varlen_opt '='properties_opt ']' + | '[' var_name_opt label_expr cypher_varlen_opt '='properties_opt ']' { cypher_relationship *n; n = make_ag_node(cypher_relationship); n->name = $2; n->parsed_name = $2; - n->label = $3; - n->parsed_label = $3; + n->label_expr = (cypher_label_expr *) $3; + n->label_expr->kind = LABEL_KIND_EDGE; + n->label = NULL; // TODO: to be deprecated + n->parsed_label = NULL; // TODO; to be deprecated n->varlen = $4; n->use_equals = true; n->props = $6; @@ -1493,14 +1502,21 @@ path_relationship_body: } ; -label_opt: +label_expr: /* empty */ { - $$ = NULL; + cypher_label_expr *n; + n = make_ag_node(cypher_label_expr); + + $$ = (Node *) n; } | ':' label_name { - $$ = $2; + cypher_label_expr *n; + n = make_ag_node(cypher_label_expr); + n->label_names = list_make1(makeString($2)); + + $$ = (Node *) n; } ; diff --git a/src/include/nodes/ag_nodes.h b/src/include/nodes/ag_nodes.h index fe9c9663e..eeb9c44ea 100644 --- a/src/include/nodes/ag_nodes.h +++ b/src/include/nodes/ag_nodes.h @@ -68,6 +68,8 @@ typedef enum ag_node_tag cypher_create_target_nodes_t, cypher_create_path_t, cypher_target_node_t, + // TODO: if cypher_label_expr_t goes before cypher_target_node_t, the program crashes + cypher_label_expr_t, /* set/remove data structures */ cypher_update_information_t, cypher_update_item_t, diff --git a/src/include/nodes/cypher_nodes.h b/src/include/nodes/cypher_nodes.h index fc9a9748c..317861b3c 100644 --- a/src/include/nodes/cypher_nodes.h +++ b/src/include/nodes/cypher_nodes.h @@ -144,14 +144,41 @@ typedef struct cypher_path int location; } cypher_path; +typedef enum +{ + LABEL_EXPR_TYPE_EMPTY = 0, // (x) + LABEL_EXPR_TYPE_SINGLE, // (x:label) + LABEL_EXPR_TYPE_AND, // (x:label1:label2: ..) + LABEL_EXPR_TYPE_OR // (x:label1|label2| ..) +} cypher_label_expr_type; + +/* + * Represents label expressions. + * + * Note: support for mixing AND and OR expression + * may be added in future. + */ +typedef struct cypher_label_expr +{ + ExtensibleNode extensible; + cypher_label_expr_type type; + /** + * this is assigned to rel->label_names. + * be careful before free'ing. + */ + List *label_names; // List of String + char kind; // 'v' or 'e'. what does label_expr belong to during parse time? not same as the kind of labels in ag_label.kind. +} cypher_label_expr; + /* ( name :label props ) */ typedef struct cypher_node { ExtensibleNode extensible; char *name; char *parsed_name; - char *label; - char *parsed_label; + cypher_label_expr *label_expr; + char *label; // TODO: to be depracated + char *parsed_label; // TODO: to be depracated bool use_equals; Node *props; /* map or parameter */ int location; @@ -170,8 +197,9 @@ typedef struct cypher_relationship ExtensibleNode extensible; char *name; char *parsed_name; - char *label; - char *parsed_label; + cypher_label_expr *label_expr; + char *label; // TODO: to be depracated + char *parsed_label; // TODO: to be depracated bool use_equals; Node *props; /* map or parameter */ Node *varlen; /* variable length relationships (A_Indices) */ @@ -376,7 +404,8 @@ typedef struct cypher_target_node /* relid that the label stores its entity */ Oid relid; /* label this entity belongs to. */ - char *label_name; + char *label_name; // TODO: to be deprecated + List *label_names; // List of String /* variable name for this entity */ char *variable_name; /* diff --git a/src/include/nodes/cypher_outfuncs.h b/src/include/nodes/cypher_outfuncs.h index 4a04cf94f..8ff3e9d2e 100644 --- a/src/include/nodes/cypher_outfuncs.h +++ b/src/include/nodes/cypher_outfuncs.h @@ -39,6 +39,7 @@ void out_cypher_merge(StringInfo str, const ExtensibleNode *node); /* pattern */ void out_cypher_path(StringInfo str, const ExtensibleNode *node); +void out_cypher_label_expr(StringInfo str, const ExtensibleNode *node); void out_cypher_node(StringInfo str, const ExtensibleNode *node); void out_cypher_relationship(StringInfo str, const ExtensibleNode *node); diff --git a/src/include/parser/cypher_label_expr.h b/src/include/parser/cypher_label_expr.h new file mode 100644 index 000000000..387b59702 --- /dev/null +++ b/src/include/parser/cypher_label_expr.h @@ -0,0 +1,108 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#ifndef AG_CYPHER_LABEL_EXPR_H +#define AG_CYPHER_LABEL_EXPR_H + +#include "nodes/cypher_nodes.h" +#include "utils/ag_cache.h" +#include "catalog/ag_label.h" +#include "commands/label_commands.h" + +#define FIRST_LABEL_NAME(label_expr) \ + (list_length((label_expr)->label_names) == 0) \ + ? NULL : linitial((label_expr)->label_names) + +// TODO: more readable name LABEL_EXPR_HAS_LABEL returning the oppposite? +#define LABEL_EXPR_LENGTH(label_expr) (list_length((label_expr)->label_names)) +#define LABEL_EXPR_IS_EMPTY(label_expr) (LABEL_EXPR_LENGTH((label_expr)) == 0) +#define LABEL_EXPR_LABEL_NAMES(label_expr) (list_copy_deep((label_expr)->label_names)) +//((label_expr)->label_names) + +// TODO: move to C +// TODO: expensive and redundant to call multiple times +/** + * Returns if each label_name in label_expr->label_names is of kind + * `label_kind`, if it exists. + * + * If label_expr is empty, returns true. + */ +bool validate_label_expr_kind(cypher_label_expr *label_expr, uint32 graph_oid, char label_kind) +{ + ListCell *lc; + + foreach (lc, label_expr->label_names) + { + char *label_name; + label_cache_data *cache_data; + + label_name = strVal(lfirst(lc)); + cache_data = search_label_name_graph_cache(label_name, graph_oid); + + if (cache_data && cache_data->kind != label_kind) + { + return false; + } + } + + return true; +} + +// TODO: can be moved to utils? +int string_list_comparator(const ListCell *a, const ListCell *b) +{ + char *str_a = lfirst(a); + char *str_b = lfirst(b); + return strcmp(str_a, str_b); +} + +char *get_cluster_name(cypher_label_expr *label_expr) +{ + ListCell *lc; + bool is_first; + + // TODO: or, defalt, single, and can be a switch? + + /* or */ + Assert(label_expr->type != LABEL_EXPR_TYPE_OR); + + /* default */ + if (LABEL_EXPR_IS_EMPTY(label_expr)) + { + return label_expr->kind == LABEL_KIND_VERTEX ? + AG_DEFAULT_LABEL_VERTEX : AG_DEFAULT_LABEL_EDGE; + } + + /* single */ + if (LABEL_EXPR_LENGTH(label_expr) == 1) + { + // TODO: when multi-label implemented, it will be different + return (char *)strVal(linitial(label_expr->label_names)); + } + + /* and */ + // TODO: implement + + // TODO: can be done during early parsing? + // list_sort(label_expr->label_names, &string_list_comparator); + + return NULL; +} + +#endif From c58521d73b1e44c95f3b00504157bfbb79b73f32 Mon Sep 17 00:00:00 2001 From: Rafsun Masud Date: Tue, 24 Oct 2023 15:17:09 -0700 Subject: [PATCH 02/13] Change label field's type to cypher_label_expr Previously, label field was char* type. The change affected the type cypher_node, cypher_relationship and cypher_target_node. As well as, any places where these types are used. --- Makefile | 1 + regress/expected/cypher_match.out | 12 +- src/backend/executor/cypher_create.c | 18 +- src/backend/executor/cypher_merge.c | 18 +- src/backend/nodes/ag_nodes.c | 2 +- src/backend/nodes/cypher_copyfuncs.c | 11 +- src/backend/nodes/cypher_outfuncs.c | 10 +- src/backend/nodes/cypher_readfuncs.c | 11 +- src/backend/parser/cypher_clause.c | 380 +++++++++++++------------ src/backend/parser/cypher_gram.y | 24 +- src/backend/parser/cypher_label_expr.c | 161 +++++++++++ src/include/nodes/cypher_copyfuncs.h | 2 + src/include/nodes/cypher_nodes.h | 23 +- src/include/nodes/cypher_readfuncs.h | 1 + src/include/parser/cypher_label_expr.h | 94 ++---- 15 files changed, 453 insertions(+), 315 deletions(-) create mode 100644 src/backend/parser/cypher_label_expr.c diff --git a/Makefile b/Makefile index 400d5a7a1..c81125d29 100644 --- a/Makefile +++ b/Makefile @@ -49,6 +49,7 @@ OBJS = src/backend/age.o \ src/backend/parser/cypher_parse_node.o \ src/backend/parser/cypher_parser.o \ src/backend/parser/cypher_transform_entity.o \ + src/backend/parser/cypher_label_expr.o \ src/backend/utils/adt/age_graphid_ds.o \ src/backend/utils/adt/agtype.o \ src/backend/utils/adt/agtype_ext.o \ diff --git a/regress/expected/cypher_match.out b/regress/expected/cypher_match.out index e25584788..891ace9ab 100644 --- a/regress/expected/cypher_match.out +++ b/regress/expected/cypher_match.out @@ -559,16 +559,16 @@ $$) AS (i agtype, c agtype); i | c ---+----------- | "middle" - 0 | "middle" - 1 | "middle" | "end" - 0 | "end" - 1 | "end" | "initial" - 0 | "initial" - 1 | "initial" | "middle" 0 | "middle" + 0 | "end" + 0 | "initial" + 0 | "middle" + 1 | "middle" + 1 | "end" + 1 | "initial" 1 | "middle" (12 rows) diff --git a/src/backend/executor/cypher_create.c b/src/backend/executor/cypher_create.c index 0f794f355..274960bb0 100644 --- a/src/backend/executor/cypher_create.c +++ b/src/backend/executor/cypher_create.c @@ -22,6 +22,10 @@ #include "catalog/ag_label.h" #include "executor/cypher_executor.h" #include "executor/cypher_utils.h" +#include "nodes/cypher_nodes.h" +#include "utils/agtype.h" +#include "utils/graphid.h" +#include "parser/cypher_label_expr.h" static void begin_cypher_create(CustomScanState *node, EState *estate, int eflags); @@ -421,9 +425,10 @@ static void create_edge(cypher_create_custom_scan_state *css, PlanState *ps = css->css.ss.ps.lefttree; TupleTableSlot *scantuple = ps->ps_ExprContext->ecxt_scantuple; Datum result; - char *label_name = node->label_names ? - (char *)strVal(linitial(node->label_names)): - ""; + char *label_name = + !LABEL_EXPR_IS_EMPTY(node->label_expr) ? + (char *)strVal(linitial(node->label_expr->label_names)) : + ""; result = make_edge( id, start_id, end_id, CStringGetDatum(label_name), @@ -511,9 +516,10 @@ static Datum create_vertex(cypher_create_custom_scan_state *css, TupleTableSlot *scantuple; PlanState *ps; Datum result; - char *label_name = node->label_names ? - (char *)strVal(linitial(node->label_names)) : - ""; + char *label_name = + !LABEL_EXPR_IS_EMPTY(node->label_expr) ? + (char *)strVal(linitial(node->label_expr->label_names)) : + ""; ps = css->css.ss.ps.lefttree; scantuple = ps->ps_ExprContext->ecxt_scantuple; diff --git a/src/backend/executor/cypher_merge.c b/src/backend/executor/cypher_merge.c index bef6886f5..f6c64be79 100644 --- a/src/backend/executor/cypher_merge.c +++ b/src/backend/executor/cypher_merge.c @@ -23,6 +23,10 @@ #include "executor/cypher_executor.h" #include "executor/cypher_utils.h" #include "utils/datum.h" +#include "nodes/cypher_nodes.h" +#include "utils/agtype.h" +#include "utils/graphid.h" +#include "parser/cypher_label_expr.h" /* * The following structure is used to hold a single vertex or edge component @@ -1117,9 +1121,13 @@ static Datum merge_vertex(cypher_merge_custom_scan_state *css, if (CYPHER_TARGET_NODE_OUTPUT(node->flags)) { Datum result; + char *label_name = + !LABEL_EXPR_IS_EMPTY(node->label_expr) ? + (char *)strVal(linitial(node->label_expr->label_names)) : + ""; /* make the vertex agtype */ - result = make_vertex(id, CStringGetDatum(node->label_name), prop); + result = make_vertex(id, CStringGetDatum(label_name), prop); /* append to the path list */ if (CYPHER_TARGET_NODE_IN_PATH(node->flags)) @@ -1456,9 +1464,13 @@ static void merge_edge(cypher_merge_custom_scan_state *css, if (CYPHER_TARGET_NODE_OUTPUT(node->flags)) { Datum result; + char *label_name = + !LABEL_EXPR_IS_EMPTY(node->label_expr) ? + (char *)strVal(linitial(node->label_expr->label_names)) : + ""; - result = make_edge(id, start_id, end_id, - CStringGetDatum(node->label_name), prop); + result = make_edge(id, start_id, end_id, CStringGetDatum(label_name), + prop); /* add the Datum to the list of entities for creating the path variable */ if (CYPHER_TARGET_NODE_IN_PATH(node->flags)) diff --git a/src/backend/nodes/ag_nodes.c b/src/backend/nodes/ag_nodes.c index 5fdc561f3..93169b192 100644 --- a/src/backend/nodes/ag_nodes.c +++ b/src/backend/nodes/ag_nodes.c @@ -109,7 +109,6 @@ const ExtensibleNodeMethods node_methods[] = { DEFINE_NODE_METHODS(cypher_unwind), DEFINE_NODE_METHODS(cypher_merge), DEFINE_NODE_METHODS(cypher_path), - DEFINE_NODE_METHODS(cypher_label_expr), DEFINE_NODE_METHODS(cypher_node), DEFINE_NODE_METHODS(cypher_relationship), DEFINE_NODE_METHODS(cypher_bool_const), @@ -128,6 +127,7 @@ const ExtensibleNodeMethods node_methods[] = { DEFINE_NODE_METHODS_EXTENDED(cypher_create_target_nodes), DEFINE_NODE_METHODS_EXTENDED(cypher_create_path), DEFINE_NODE_METHODS_EXTENDED(cypher_target_node), + DEFINE_NODE_METHODS_EXTENDED(cypher_label_expr), DEFINE_NODE_METHODS_EXTENDED(cypher_update_information), DEFINE_NODE_METHODS_EXTENDED(cypher_update_item), DEFINE_NODE_METHODS_EXTENDED(cypher_delete_information), diff --git a/src/backend/nodes/cypher_copyfuncs.c b/src/backend/nodes/cypher_copyfuncs.c index 05d59d660..cbbbab4ea 100644 --- a/src/backend/nodes/cypher_copyfuncs.c +++ b/src/backend/nodes/cypher_copyfuncs.c @@ -101,8 +101,7 @@ void copy_cypher_target_node(ExtensibleNode *newnode, const ExtensibleNode *from COPY_SCALAR_FIELD(relid); COPY_SCALAR_FIELD(tuple_position); - COPY_STRING_FIELD(label_name); - COPY_NODE_FIELD(label_names); + COPY_NODE_FIELD(label_expr); COPY_STRING_FIELD(variable_name); COPY_NODE_FIELD(id_expr); @@ -113,6 +112,14 @@ void copy_cypher_target_node(ExtensibleNode *newnode, const ExtensibleNode *from COPY_NODE_FIELD(elemTupleSlot); } +void copy_cypher_label_expr(ExtensibleNode *newnode, const ExtensibleNode *from) +{ + COPY_LOCALS(cypher_label_expr); + + COPY_SCALAR_FIELD(type); + COPY_NODE_FIELD(label_names); +} + /* copy function for cypher_update_information */ void copy_cypher_update_information(ExtensibleNode *newnode, const ExtensibleNode *from) { diff --git a/src/backend/nodes/cypher_outfuncs.c b/src/backend/nodes/cypher_outfuncs.c index 7bd9c0e14..58f0f6590 100644 --- a/src/backend/nodes/cypher_outfuncs.c +++ b/src/backend/nodes/cypher_outfuncs.c @@ -205,7 +205,6 @@ void out_cypher_label_expr(StringInfo str, const ExtensibleNode *node) WRITE_INT32_FIELD(type); WRITE_NODE_FIELD(label_names); - WRITE_CHAR_FIELD(kind); } /* serialization function for the cypher_node ExtensibleNode. */ @@ -215,8 +214,7 @@ void out_cypher_node(StringInfo str, const ExtensibleNode *node) WRITE_STRING_FIELD(name); WRITE_STRING_FIELD(parsed_name); - WRITE_STRING_FIELD(label); - WRITE_STRING_FIELD(parsed_label); + WRITE_NODE_FIELD(label_expr); WRITE_NODE_FIELD(props); WRITE_LOCATION_FIELD(location); } @@ -228,8 +226,7 @@ void out_cypher_relationship(StringInfo str, const ExtensibleNode *node) WRITE_STRING_FIELD(name); WRITE_STRING_FIELD(parsed_name); - WRITE_STRING_FIELD(label); - WRITE_STRING_FIELD(parsed_label); + WRITE_NODE_FIELD(label_expr); WRITE_NODE_FIELD(props); WRITE_NODE_FIELD(varlen); WRITE_ENUM_FIELD(dir, cypher_rel_dir); @@ -398,8 +395,7 @@ void out_cypher_target_node(StringInfo str, const ExtensibleNode *node) WRITE_NODE_FIELD(resultRelInfo); WRITE_NODE_FIELD(elemTupleSlot); WRITE_OID_FIELD(relid); - WRITE_STRING_FIELD(label_name); - WRITE_NODE_FIELD(label_names); + WRITE_NODE_FIELD(label_expr); WRITE_STRING_FIELD(variable_name); WRITE_INT32_FIELD(tuple_position); } diff --git a/src/backend/nodes/cypher_readfuncs.c b/src/backend/nodes/cypher_readfuncs.c index 842553ad9..3713a4735 100644 --- a/src/backend/nodes/cypher_readfuncs.c +++ b/src/backend/nodes/cypher_readfuncs.c @@ -234,12 +234,19 @@ void read_cypher_target_node(struct ExtensibleNode *node) READ_NODE_FIELD(resultRelInfo); READ_NODE_FIELD(elemTupleSlot); READ_OID_FIELD(relid); - READ_STRING_FIELD(label_name); - READ_NODE_FIELD(label_names); + READ_NODE_FIELD(label_expr); READ_STRING_FIELD(variable_name); READ_INT_FIELD(tuple_position); } +void read_cypher_label_expr(struct ExtensibleNode *node) +{ + READ_LOCALS(cypher_label_expr); + + READ_INT_FIELD(type); + READ_NODE_FIELD(label_names); +} + /* * Deserialize a string representing the cypher_update_information * data structure. diff --git a/src/backend/parser/cypher_clause.c b/src/backend/parser/cypher_clause.c index 4baf25a3b..679fb65e2 100644 --- a/src/backend/parser/cypher_clause.c +++ b/src/backend/parser/cypher_clause.c @@ -144,7 +144,11 @@ static List *make_path_join_quals(cypher_parsestate *cpstate, List *entities); static List *make_directed_edge_join_conditions( cypher_parsestate *cpstate, transform_entity *prev_entity, transform_entity *next_entity, Node *prev_qual, Node *next_qual, - char *prev_node_label, char *next_node_label); + cypher_label_expr *prev_node_filter, cypher_label_expr *next_node_filter); +static ParseNamespaceItem *get_pnsi_for_match(cypher_parsestate *cpstate, + cypher_label_expr *label_expr, + char label_expr_kind, + Alias *alias, bool valid_label); static List *join_to_entity(cypher_parsestate *cpstate, transform_entity *entity, Node *qual, enum transform_entity_join_side side); @@ -158,7 +162,8 @@ static List *make_edge_quals(cypher_parsestate *cpstate, transform_entity *edge, enum transform_entity_join_side side); static A_Expr *filter_vertices_on_label_id(cypher_parsestate *cpstate, - Node *id_field, char *label); + Node *id_field, + cypher_label_expr *label); static Node *transform_map_to_ind(cypher_parsestate *cpstate, transform_entity *entity, cypher_map *map); static List *transform_map_to_ind_recursive(cypher_parsestate *cpstate, @@ -2326,17 +2331,10 @@ static bool match_check_valid_label(cypher_match *match, node = lfirst(cell2); - if (node->label) + if (!label_expr_has_tables(node->label_expr, LABEL_KIND_VERTEX, + cpstate->graph_oid)) { - label_cache_data *lcd = - search_label_name_graph_cache(node->label, - cpstate->graph_oid); - - if (lcd == NULL || - lcd->kind != LABEL_KIND_VERTEX) - { - return false; - } + return false; } } else @@ -2345,16 +2343,10 @@ static bool match_check_valid_label(cypher_match *match, rel = lfirst(cell2); - if (rel->label) + if (!label_expr_has_tables(rel->label_expr, LABEL_KIND_EDGE, + cpstate->graph_oid)) { - label_cache_data *lcd = - search_label_name_graph_cache(rel->label, - cpstate->graph_oid); - - if (lcd == NULL || lcd->kind != LABEL_KIND_EDGE) - { - return false; - } + return false; } } i++; @@ -3326,7 +3318,7 @@ static FuncCall *prevent_duplicate_edges(cypher_parsestate *cpstate, static List *make_directed_edge_join_conditions( cypher_parsestate *cpstate, transform_entity *prev_entity, transform_entity *next_entity, Node *prev_qual, Node *next_qual, - char *prev_node_filter, char *next_node_filter) + cypher_label_expr *prev_node_filter, cypher_label_expr *next_node_filter) { List *quals = NIL; @@ -3342,7 +3334,7 @@ static List *make_directed_edge_join_conditions( next_qual, JOIN_SIDE_RIGHT)); } - if (prev_node_filter != NULL && !IS_DEFAULT_LABEL_VERTEX(prev_node_filter)) + if (prev_node_filter != NULL && !LABEL_EXPR_IS_EMPTY(prev_node_filter)) { A_Expr *qual; qual = filter_vertices_on_label_id(cpstate, prev_qual, @@ -3351,7 +3343,7 @@ static List *make_directed_edge_join_conditions( quals = lappend(quals, qual); } - if (next_node_filter != NULL && !IS_DEFAULT_LABEL_VERTEX(next_node_filter)) + if (next_node_filter != NULL && !LABEL_EXPR_IS_EMPTY(next_node_filter)) { A_Expr *qual; qual = filter_vertices_on_label_id(cpstate, next_qual, @@ -3380,8 +3372,8 @@ static List *make_join_condition_for_edge(cypher_parsestate *cpstate, transform_entity *next_node, transform_entity *next_edge) { - char *next_label_name_to_filter = NULL; - char *prev_label_name_to_filter = NULL; + cypher_label_expr *next_label_to_filter = NULL; + cypher_label_expr *prev_label_to_filter = NULL; transform_entity *next_entity; transform_entity *prev_entity; @@ -3471,7 +3463,7 @@ static List *make_join_condition_for_edge(cypher_parsestate *cpstate, */ if (!prev_node->in_join_tree) { - prev_label_name_to_filter = prev_node->entity.node->label; + prev_label_to_filter = prev_node->entity.node->label_expr; } /* @@ -3482,7 +3474,7 @@ static List *make_join_condition_for_edge(cypher_parsestate *cpstate, */ if (!next_node->in_join_tree && next_edge == NULL) { - next_label_name_to_filter = next_node->entity.node->label; + next_label_to_filter = next_node->entity.node->label_expr; } /* @@ -3525,8 +3517,8 @@ static List *make_join_condition_for_edge(cypher_parsestate *cpstate, return make_directed_edge_join_conditions(cpstate, prev_entity, next_node, prev_qual, next_qual, - prev_label_name_to_filter, - next_label_name_to_filter); + prev_label_to_filter, + next_label_to_filter); } case CYPHER_REL_DIR_LEFT: { @@ -3538,8 +3530,8 @@ static List *make_join_condition_for_edge(cypher_parsestate *cpstate, return make_directed_edge_join_conditions(cpstate, prev_entity, next_node, prev_qual, next_qual, - prev_label_name_to_filter, - next_label_name_to_filter); + prev_label_to_filter, + next_label_to_filter); } case CYPHER_REL_DIR_NONE: { @@ -3560,16 +3552,16 @@ static List *make_join_condition_for_edge(cypher_parsestate *cpstate, next_entity, start_id_expr, end_id_expr, - prev_label_name_to_filter, - next_label_name_to_filter); + prev_label_to_filter, + next_label_to_filter); second_join_quals = make_directed_edge_join_conditions(cpstate, prev_entity, next_entity, end_id_expr, start_id_expr, - prev_label_name_to_filter, - next_label_name_to_filter); + prev_label_to_filter, + next_label_to_filter); first_qual = makeBoolExpr(AND_EXPR, first_join_quals, -1); second_qual = makeBoolExpr(AND_EXPR, second_join_quals, -1); @@ -3773,27 +3765,72 @@ static List *make_edge_quals(cypher_parsestate *cpstate, * that removes all labels that do not have the same label_id */ static A_Expr *filter_vertices_on_label_id(cypher_parsestate *cpstate, - Node *id_field, char *label) + Node *id_field, + cypher_label_expr *label_expr) { - label_cache_data *lcd = search_label_name_graph_cache(label, - cpstate->graph_oid); + // TODO: this function neeeds to be updated once label_id columns are arrays. + /* + left array start_label_ids or _extract_label_id = Label IDs the vertex already has + right array filter_label_ids = Label IDs we want to filter + + + + if filter = empty: + add no filter = this is not called for empty filters + else if filter = single: + {filter} <@ {actual label ids} + List * <@ Datum + + - actual label ids are Datum + - filter label ids are (List *) + + + */ A_Const *n; FuncCall *fc; String *ag_catalog, *extract_label_id; - int32 label_id = lcd->id; + label_cache_data *lcd; + A_Expr *lhs; + int32 label_id; + A_ArrayExpr *filter_ids; + A_ArrayExpr *empty_array; + A_Const *minus_one_const; + char *table_name; + + table_name = label_expr_table_name(label_expr, LABEL_KIND_VERTEX); + lcd = search_label_name_graph_cache(table_name, cpstate->graph_oid); + + if (lcd) + { + label_id = lcd->id; + } + else + { + label_id = -5; // -1 is reserved for array concat + } n = makeNode(A_Const); n->val.ival.type = T_Integer; n->val.ival.ival = label_id; n->location = -1; + filter_ids = makeNode(A_ArrayExpr); + filter_ids->elements = list_make1(n); + filter_ids->location = -1; + + minus_one_const = makeNode(A_Const); + minus_one_const->val.ival.type = T_Integer; + minus_one_const->val.ival.ival = -1; ag_catalog = makeString("ag_catalog"); extract_label_id = makeString("_extract_label_id"); - fc = makeFuncCall(list_make2(ag_catalog, extract_label_id), list_make1(id_field), COERCE_EXPLICIT_CALL, -1); + empty_array = makeNode(A_ArrayExpr); + empty_array->elements = list_make1(minus_one_const); + empty_array->location = -1; + lhs = makeSimpleA_Expr(AEXPR_OP, "||", (Node *)empty_array, (Node *)fc, -1); - return makeSimpleA_Expr(AEXPR_OP, "=", (Node *)fc, (Node *)n, -1); + return makeSimpleA_Expr(AEXPR_OP, "@>", (Node *)lhs, (Node *)filter_ids, -1); } /* @@ -4321,16 +4358,10 @@ static bool path_check_valid_label(cypher_path *path, node = lfirst(lc); - if (node->label) + if (!label_expr_has_tables(node->label_expr, LABEL_KIND_VERTEX, + cpstate->graph_oid)) { - label_cache_data *lcd = - search_label_name_graph_cache(node->label, - cpstate->graph_oid); - - if (lcd == NULL || lcd->kind != LABEL_KIND_VERTEX) - { - return false; - } + return false; } } else @@ -4339,16 +4370,10 @@ static bool path_check_valid_label(cypher_path *path, rel = lfirst(lc); - if (rel->label) + if (!label_expr_has_tables(rel->label_expr, LABEL_KIND_EDGE, + cpstate->graph_oid)) { - label_cache_data *lcd = - search_label_name_graph_cache(rel->label, - cpstate->graph_oid); - - if (lcd == NULL || lcd->kind != LABEL_KIND_EDGE) - { - return false; - } + return false; } } i++; @@ -4949,16 +4974,51 @@ static Node *make_qual(cypher_parsestate *cpstate, return node; } +static ParseNamespaceItem *get_pnsi_for_match(cypher_parsestate *cpstate, + cypher_label_expr *label_expr, + char label_expr_kind, + Alias *alias, + bool valid_label) +{ + ParseState *pstate = (ParseState *)cpstate; + ParseNamespaceItem *pnsi; + char *rel_name; + RangeVar *label_range_var; + char *schema_name; + + schema_name = get_graph_namespace_name(cpstate->graph_name); + + if (valid_label) + { + char *table_name = label_expr_table_name(label_expr, label_expr_kind); + rel_name = get_label_relation_name(table_name, cpstate->graph_oid); + } + else + { + if (label_expr_kind == LABEL_KIND_VERTEX) + { + rel_name = AG_DEFAULT_LABEL_VERTEX; + } + else + { + rel_name = AG_DEFAULT_LABEL_EDGE; + } + } + + label_range_var = makeRangeVar(schema_name, rel_name, -1); + + pnsi = addRangeTableEntry(pstate, label_range_var, alias, + label_range_var->inh, true); + + return pnsi; +} + static Expr *transform_cypher_edge(cypher_parsestate *cpstate, cypher_relationship *rel, List **target_list, bool valid_label) { ParseState *pstate = (ParseState *)cpstate; - char *schema_name = NULL; - char *rel_name = NULL; - RangeVar *label_range_var = NULL; - Alias *alias = NULL; int resno = -1; TargetEntry *te = NULL; transform_entity *entity = NULL; @@ -5031,7 +5091,7 @@ static Expr *transform_cypher_edge(cypher_parsestate *cpstate, * If we do not have a label for this edge, we either need to find one * from a referenced variable or we need to set it to the default label. */ - if (rel->label == NULL) + if (LABEL_EXPR_IS_EMPTY(rel->label_expr)) { /* if there is a variable for this rel name */ if (refs_var) @@ -5046,20 +5106,7 @@ static Expr *transform_cypher_edge(cypher_parsestate *cpstate, * * We copy it so that we know what label it is referencing. */ - if (cr->parsed_label != NULL) - { - rel->parsed_label = cr->parsed_label; - rel->label = cr->label; - } - else - { - rel->label = AG_DEFAULT_LABEL_EDGE; - } - } - /* otherwise, just give it the default label */ - else - { - rel->label = AG_DEFAULT_LABEL_EDGE; + rel->label_expr = cr->label_expr; } } /* if we do have a label, is it valid */ @@ -5075,7 +5122,7 @@ static Expr *transform_cypher_edge(cypher_parsestate *cpstate, * prevent segmentation faults, and other errors. We can also consider * if an all-purpose label would be useful. */ - rel->label = NULL; + ; } /* @@ -5095,10 +5142,7 @@ static Expr *transform_cypher_edge(cypher_parsestate *cpstate, * If this edge uses a variable that already exists, verify that the label * names are the same. */ - if (refs_var && - (cr->parsed_label != NULL || rel->parsed_label != NULL) && - (cr->parsed_label == NULL || rel->parsed_label == NULL || - (strcmp(cr->parsed_label, rel->parsed_label) != 0))) + if (refs_var && !label_expr_are_equal(rel->label_expr, cr->label_expr)) { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), @@ -5164,22 +5208,8 @@ static Expr *transform_cypher_edge(cypher_parsestate *cpstate, rel->name = get_next_default_alias(cpstate); } - schema_name = get_graph_namespace_name(cpstate->graph_name); - - if (valid_label) - { - rel_name = get_label_relation_name(rel->label, cpstate->graph_oid); - } - else - { - rel_name = AG_DEFAULT_LABEL_EDGE; - } - - label_range_var = makeRangeVar(schema_name, rel_name, -1); - alias = makeAlias(rel->name, NIL); - - pnsi = addRangeTableEntry(pstate, label_range_var, alias, - label_range_var->inh, true); + pnsi = get_pnsi_for_match(cpstate, rel->label_expr, LABEL_KIND_EDGE, + makeAlias(rel->name, NIL), valid_label); Assert(pnsi != NULL); /* @@ -5213,10 +5243,6 @@ static Expr *transform_cypher_node(cypher_parsestate *cpstate, bool output_node, bool valid_label) { ParseState *pstate = (ParseState *)cpstate; - char *schema_name = NULL; - char *rel_name = NULL; - RangeVar *label_range_var = NULL; - Alias *alias = NULL; int resno = -1; TargetEntry *te = NULL; Expr *expr = NULL; @@ -5301,7 +5327,7 @@ static Expr *transform_cypher_node(cypher_parsestate *cpstate, * If we do not have a label for this vertex, we either need to find one * from a referenced variable or we need to set it to the default label. */ - if (node->label == NULL) + if (LABEL_EXPR_IS_EMPTY(node->label_expr)) { if (refs_var) { @@ -5315,20 +5341,7 @@ static Expr *transform_cypher_node(cypher_parsestate *cpstate, * * We copy it so that we know what label it is referencing. */ - if (cn->parsed_label != NULL) - { - node->parsed_label = cn->parsed_label; - node->label = cn->label; - } - else - { - node->label = AG_DEFAULT_LABEL_VERTEX; - } - } - /* otherwise, just give it the default label */ - else - { - node->label = AG_DEFAULT_LABEL_VERTEX; + node->label_expr = cn->label_expr; } } /* if we do have a label, is it valid */ @@ -5344,17 +5357,14 @@ static Expr *transform_cypher_node(cypher_parsestate *cpstate, * prevent segmentation faults, and other errors. We can also consider * if an all-purpose label would be useful. */ - node->label = NULL; + ; } /* * If this vertex uses a variable that already exists, verify that the label * being used is of the same name. */ - if (refs_var && - (cn->parsed_label != NULL || node->parsed_label != NULL) && - (cn->parsed_label == NULL || node->parsed_label == NULL || - (strcmp(cn->parsed_label, node->parsed_label) != 0))) + if (refs_var && !label_expr_are_equal(node->label_expr, cn->label_expr)) { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), @@ -5451,22 +5461,8 @@ static Expr *transform_cypher_node(cypher_parsestate *cpstate, } /* now build a new vertex */ - schema_name = get_graph_namespace_name(cpstate->graph_name); - - if (valid_label) - { - rel_name = get_label_relation_name(node->label, cpstate->graph_oid); - } - else - { - rel_name = AG_DEFAULT_LABEL_VERTEX; - } - - label_range_var = makeRangeVar(schema_name, rel_name, -1); - alias = makeAlias(node->name, NIL); - - pnsi = addRangeTableEntry(pstate, label_range_var, alias, - label_range_var->inh, true); + pnsi = get_pnsi_for_match(cpstate, node->label_expr, LABEL_KIND_VERTEX, + makeAlias(node->name, NIL), valid_label); Assert(pnsi != NULL); @@ -5804,19 +5800,28 @@ transform_create_cypher_edge(cypher_parsestate *cpstate, List **target_list, char *alias; AttrNumber resno; ParseNamespaceItem *pnsi; + char *invalid_label; + char *table_name; + + // TODO: Error if not (EMPTY or SINGLE). + // because edges can have zero or one label - if (!validate_label_expr_kind(edge->label_expr, cpstate->graph_oid, LABEL_KIND_EDGE)) + invalid_label = find_first_invalid_label(edge->label_expr, LABEL_KIND_EDGE, + cpstate->graph_oid); + + if (invalid_label) { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("label %s is for vertices, not edges", edge->label), - parser_errposition(pstate, edge->location))); + errmsg("label %s is for vertices, not edges", invalid_label), + parser_errposition(pstate, edge->location))); } - cluster_name = get_cluster_name(edge->label_expr); + table_name = label_expr_table_name(edge->label_expr, LABEL_KIND_EDGE); + rel->type = LABEL_KIND_EDGE; rel->flags = CYPHER_TARGET_NODE_FLAG_INSERT; - rel->label_names = LABEL_EXPR_LABEL_NAMES(edge->label_expr); + rel->label_expr = edge->label_expr; rel->resultRelInfo = NULL; if (edge->name) @@ -5869,7 +5874,7 @@ transform_create_cypher_edge(cypher_parsestate *cpstate, List **target_list, } /* create the label entry if it does not exist */ - if (!label_exists(cluster_name, cpstate->graph_oid)) + if (!label_exists(table_name, cpstate->graph_oid)) { List *parent; @@ -5878,12 +5883,11 @@ transform_create_cypher_edge(cypher_parsestate *cpstate, List **target_list, parent = list_make1(rv); - create_label(cpstate->graph_name, cluster_name, LABEL_TYPE_EDGE, - parent); + create_label(cpstate->graph_name, table_name, LABEL_TYPE_EDGE, parent); } /* lock the relation of the label */ - rv = makeRangeVar(cpstate->graph_name, cluster_name, -1); + rv = makeRangeVar(cpstate->graph_name, table_name, -1); label_relation = parserOpenTable(&cpstate->pstate, rv, RowExclusiveLock); /* Store the relid */ @@ -5945,13 +5949,14 @@ transform_create_cypher_node(cypher_parsestate *cpstate, List **target_list, cypher_node *node, bool has_edge) { ParseState *pstate = (ParseState *)cpstate; + char *invalid_label = find_first_invalid_label( + node->label_expr, LABEL_KIND_VERTEX, cpstate->graph_oid); - if (!validate_label_expr_kind(node->label_expr, cpstate->graph_oid, - LABEL_KIND_VERTEX)) + if (invalid_label) { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("label %s is for edges, not vertices", node->label), + errmsg("label %s is for edges, not vertices", invalid_label), parser_errposition(pstate, node->location))); } @@ -6123,18 +6128,20 @@ transform_create_cypher_new_node(cypher_parsestate *cpstate, char *alias; int resno; ParseNamespaceItem *pnsi; - char *cluster_name; + char *table_name; rel->type = LABEL_KIND_VERTEX; rel->tuple_position = InvalidAttrNumber; rel->variable_name = NULL; rel->resultRelInfo = NULL; - cluster_name = get_cluster_name(node->label_expr); - rel->label_names = LABEL_EXPR_LABEL_NAMES(node->label_expr); + // TODO: error if OR + + table_name = label_expr_table_name(node->label_expr, LABEL_KIND_VERTEX); + rel->label_expr = node->label_expr; /* create the label entry if it does not exist */ - if (!label_exists(cluster_name, cpstate->graph_oid)) + if (!label_exists(table_name, cpstate->graph_oid)) { List *parent; @@ -6143,13 +6150,13 @@ transform_create_cypher_new_node(cypher_parsestate *cpstate, parent = list_make1(rv); - create_label(cpstate->graph_name, cluster_name, LABEL_TYPE_VERTEX, + create_label(cpstate->graph_name, table_name, LABEL_TYPE_VERTEX, parent); } rel->flags = CYPHER_TARGET_NODE_FLAG_INSERT; - rv = makeRangeVar(cpstate->graph_name, cluster_name, -1); + rv = makeRangeVar(cpstate->graph_name, table_name, -1); label_relation = parserOpenTable(&cpstate->pstate, rv, RowExclusiveLock); /* Store the relid */ @@ -6917,7 +6924,7 @@ static cypher_target_node *get_referenced_variable(ParseState *pstate, { ListCell *lc = NULL; char *node_name = NULL; - char *node_label = NULL; + cypher_label_expr *node_label = NULL; char node_type = 0; int node_loc = -1; @@ -6929,14 +6936,14 @@ static cypher_target_node *get_referenced_variable(ParseState *pstate, if (is_ag_node(node, cypher_node)) { node_name = ((cypher_node *)node)->name; - node_label = ((cypher_node *)node)->label; + node_label = ((cypher_node *)node)->label_expr; node_loc = ((cypher_node *)node)->location; node_type = 'v'; } else { node_name = ((cypher_relationship *)node)->name; - node_label = ((cypher_relationship *)node)->label; + node_label = ((cypher_relationship *)node)->label_expr; node_loc = ((cypher_relationship *)node)->location; node_type = 'e'; } @@ -6957,9 +6964,14 @@ static cypher_target_node *get_referenced_variable(ParseState *pstate, false : strcmp(node_name, ctn->variable_name) == 0; /* do they have labels? if so, do they match? */ - is_label = (ctn->label_name != NULL) ? - ((node_label == NULL) ? true : strcmp(ctn->label_name, node_label) == 0) - : false; + if (LABEL_EXPR_IS_EMPTY(node_label)) + { + is_label = true; + } + else + { + is_label = label_expr_are_equal(ctn->label_expr, node_label); + } /* if the types don't match, error or skip */ if (node_type != ctn->type) @@ -7019,7 +7031,7 @@ static cypher_target_node *get_referenced_variable(ParseState *pstate, _cpy->resultRelInfo = ctn->resultRelInfo; _cpy->elemTupleSlot = ctn->elemTupleSlot; _cpy->relid = ctn->relid; - _cpy->label_name = ctn->label_name; + _cpy->label_expr = ctn->label_expr; _cpy->variable_name = ctn->variable_name; _cpy->tuple_position = ctn->tuple_position; @@ -7164,6 +7176,7 @@ transform_merge_cypher_edge(cypher_parsestate *cpstate, List **target_list, RangeVar *rv; RTEPermissionInfo *rte_pi; ParseNamespaceItem *pnsi; + char *table_name; if (edge->name != NULL) { @@ -7187,17 +7200,19 @@ transform_merge_cypher_edge(cypher_parsestate *cpstate, List **target_list, edge->name = get_next_default_alias(cpstate); } + // TODO: error if OR + rel->type = LABEL_KIND_EDGE; /* all edges are marked with insert */ rel->flags |= CYPHER_TARGET_NODE_FLAG_INSERT; - rel->label_name = edge->label; + rel->label_expr = edge->label_expr; rel->variable_name = edge->name; rel->resultRelInfo = NULL; rel->dir = edge->dir; - if (!edge->label) + if (LABEL_EXPR_IS_EMPTY(edge->label_expr)) { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), @@ -7205,9 +7220,10 @@ transform_merge_cypher_edge(cypher_parsestate *cpstate, List **target_list, parser_errposition(&cpstate->pstate, edge->location))); } + table_name = label_expr_table_name(edge->label_expr, LABEL_KIND_EDGE); /* check to see if the label exists, create the label entry if it does not. */ - if (edge->label && !label_exists(edge->label, cpstate->graph_oid)) + if (table_name && !label_exists(table_name, cpstate->graph_oid)) { List *parent; /* @@ -7220,12 +7236,12 @@ transform_merge_cypher_edge(cypher_parsestate *cpstate, List **target_list, parent = list_make1(rv); /* create the label */ - create_label(cpstate->graph_name, edge->label, LABEL_TYPE_EDGE, + create_label(cpstate->graph_name, table_name, LABEL_TYPE_EDGE, parent); } /* lock the relation of the label */ - rv = makeRangeVar(cpstate->graph_name, edge->label, -1); + rv = makeRangeVar(cpstate->graph_name, table_name, -1); label_relation = parserOpenTable(&cpstate->pstate, rv, RowExclusiveLock); /* @@ -7279,6 +7295,7 @@ transform_merge_cypher_node(cypher_parsestate *cpstate, List **target_list, RangeVar *rv; RTEPermissionInfo *rte_pi; ParseNamespaceItem *pnsi; + char *table_name; if (node->name != NULL) { @@ -7327,22 +7344,13 @@ transform_merge_cypher_node(cypher_parsestate *cpstate, List **target_list, rel->variable_name = node->name; rel->resultRelInfo = NULL; - if (!node->label) - { - rel->label_name = ""; - /* - * If no label is specified, assign the generic label name that - * all labels are descendents of. - */ - node->label = AG_DEFAULT_LABEL_VERTEX; - } - else - { - rel->label_name = node->label; - } + // TODO: error if OR + + table_name = label_expr_table_name(node->label_expr, LABEL_KIND_VERTEX); + rel->label_expr = node->label_expr; /* check to see if the label exists, create the label entry if it does not. */ - if (node->label && !label_exists(node->label, cpstate->graph_oid)) + if (table_name && !label_exists(table_name, cpstate->graph_oid)) { List *parent; @@ -7356,13 +7364,13 @@ transform_merge_cypher_node(cypher_parsestate *cpstate, List **target_list, parent = list_make1(rv); /* create the label */ - create_label(cpstate->graph_name, node->label, LABEL_TYPE_VERTEX, + create_label(cpstate->graph_name, table_name, LABEL_TYPE_VERTEX, parent); } rel->flags |= CYPHER_TARGET_NODE_FLAG_INSERT; - rv = makeRangeVar(cpstate->graph_name, node->label, -1); + rv = makeRangeVar(cpstate->graph_name, table_name, -1); label_relation = parserOpenTable(&cpstate->pstate, rv, RowExclusiveLock); /* diff --git a/src/backend/parser/cypher_gram.y b/src/backend/parser/cypher_gram.y index dfebeb0d0..fb6e43b50 100644 --- a/src/backend/parser/cypher_gram.y +++ b/src/backend/parser/cypher_gram.y @@ -26,6 +26,7 @@ #include "parser/cypher_gram.h" #include "parser/cypher_parse_node.h" #include "parser/scansup.h" +#include "parser/cypher_label_expr.h" #include "catalog/ag_label.h" /* override the default action for locations */ @@ -1457,10 +1458,7 @@ path_relationship_body: n = make_ag_node(cypher_relationship); n->name = $2; n->parsed_name = $2; - n->label_expr = (cypher_label_expr *) $3; - n->label_expr->kind = LABEL_KIND_EDGE; - n->label = NULL; // TODO: to be deprecated - n->parsed_label = NULL; // TODO; to be deprecated + n->label_expr = (cypher_label_expr *)$3; n->varlen = $4; n->use_equals = false; n->props = $5; @@ -1492,8 +1490,7 @@ path_relationship_body: n = make_ag_node(cypher_relationship); n->name = NULL; n->parsed_name = NULL; - n->label = NULL; - n->parsed_label = NULL; + n->label_expr = make_ag_node(cypher_label_expr); n->varlen = NULL; n->use_equals = false; n->props = NULL; @@ -1514,6 +1511,7 @@ label_expr: { cypher_label_expr *n; n = make_ag_node(cypher_label_expr); + n->type = LABEL_EXPR_TYPE_SINGLE; n->label_names = list_make1(makeString($2)); $$ = (Node *) n; @@ -3174,10 +3172,10 @@ static cypher_relationship *build_VLE_relation(List *left_arg, * we need to create a variable name for the left node. */ if ((cnl->name == NULL && length > 1) || - (cnl->name == NULL && cnl->label != NULL) || + (cnl->name == NULL && !LABEL_EXPR_IS_EMPTY(cnl->label_expr)) || (cnl->name == NULL && cnl->props != NULL) || (cnl->name == NULL && cnr->name != NULL) || - (cnl->name == NULL && cnr->label != NULL) || + (cnl->name == NULL && !LABEL_EXPR_IS_EMPTY(cnr->label_expr)) || (cnl->name == NULL && cnr->props != NULL)) { cnl->name = create_unique_name(AGE_DEFAULT_PREFIX"vle_function_start_var"); @@ -3210,7 +3208,7 @@ static cypher_relationship *build_VLE_relation(List *left_arg, * done in the transform phase. */ if (cnr->name == NULL && - (cnr->label != NULL || cnr->props != NULL)) + (!LABEL_EXPR_IS_EMPTY(cnr->label_expr) || cnr->props != NULL)) { cnr->name = create_unique_name(AGE_DEFAULT_PREFIX"vle_function_end_var"); } @@ -3236,13 +3234,17 @@ static cypher_relationship *build_VLE_relation(List *left_arg, } /* build the required edge arguments */ - if (cr->label == NULL) + if (LABEL_EXPR_IS_EMPTY(cr->label_expr)) { eargs = lappend(eargs, make_null_const(location)); } else { - eargs = lappend(eargs, make_string_const(cr->label, location)); + char *label_name = + !LABEL_EXPR_IS_EMPTY(cr->label_expr) ? + (char *)strVal(linitial(cr->label_expr->label_names)) : + ""; + eargs = lappend(eargs, make_string_const(label_name, location)); } if (cr->props == NULL) { diff --git a/src/backend/parser/cypher_label_expr.c b/src/backend/parser/cypher_label_expr.c new file mode 100644 index 000000000..63a9058b0 --- /dev/null +++ b/src/backend/parser/cypher_label_expr.c @@ -0,0 +1,161 @@ +#include "catalog/ag_label.h" +#include "commands/label_commands.h" +#include "nodes/cypher_nodes.h" +#include "utils/ag_cache.h" + +#include "parser/cypher_label_expr.h" + +/* + * Returns the first label in label_expr that exists in the cache and is not + * of type label_kind. + * + * This is a helper function to check if all labels in label_expr are valid in + * kind, during node\edge creation. + */ +char *find_first_invalid_label(cypher_label_expr *label_expr, + char label_expr_kind, Oid graph_oid) +{ + ListCell *lc; + + foreach (lc, label_expr->label_names) + { + char *label_name; + label_cache_data *cache_data; + + label_name = strVal(lfirst(lc)); + cache_data = search_label_name_graph_cache(label_name, graph_oid); + + if (cache_data && cache_data->kind != label_expr_kind) + { + return label_name; + } + } + + return NULL; +} + +// TODO: can be moved to utils? +int string_list_comparator(const ListCell *a, const ListCell *b) +{ + char *str_a = lfirst(a); + char *str_b = lfirst(b); + return strcmp(str_a, str_b); +} + +/* + * Generates table name for label_expr. It does not check if a table exists + * for that name. The caller must do existence check before using the table. + * This function is not applicable for LABEL_EXPR_TYPE_OR. + */ +char *label_expr_table_name(cypher_label_expr *label_expr, + char label_expr_kind) +{ + switch (label_expr->type) + { + case LABEL_EXPR_TYPE_EMPTY: + return label_expr_kind == LABEL_KIND_VERTEX ? AG_DEFAULT_LABEL_VERTEX : + AG_DEFAULT_LABEL_EDGE; + + case LABEL_EXPR_TYPE_SINGLE: + return (char *)strVal(linitial(label_expr->label_names)); + + case LABEL_EXPR_TYPE_AND: + // TODO: implement + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("label expression type AND is not implemented"))); + return NULL; + + case LABEL_EXPR_TYPE_OR: + // TODO: implement + elog(ERROR, "label expression type OR cannot cannot have a table"); + return NULL; + + default: + elog(ERROR, "invalid cypher_label_expr type"); + return NULL; + } +} + +// TODO: whenever a new field is added, update this one. +bool label_expr_are_equal(cypher_label_expr *le1, cypher_label_expr *le2) +{ + ListCell *lc1; + ListCell *lc2; + + if (le1 == le2) + { + return true; + } + + /** + * If exactly one is null, return false. + * TODO: should null be allowed? + */ + if ((le1 == NULL && le2 != NULL) || (le2 == NULL && le1 != NULL)) + { + return false; + } + + if (le1->type != le2->type) + { + return false; + } + + if (LABEL_EXPR_LENGTH(le1) != LABEL_EXPR_LENGTH(le2)) + { + return false; + } + + /* + * Assuming both lists are sorted and have same length. + */ + forboth(lc1, le1->label_names, lc2, le2->label_names) + { + char *le1_label = strVal(lfirst(lc1)); + char *le2_label = strVal(lfirst(lc2)); + + if (strcmp(le1_label, le2_label) != 0) + { + return false; + } + } + + return true; +} + +/* + * Returns true if there is at least one table to be scanned for this + * label_expr. + * + * This helper function is used in the MATCH clause transformation. + */ +bool label_expr_has_tables(cypher_label_expr *label_expr, char label_expr_kind, + Oid graph_oid) +{ + char *table_name; + label_cache_data *lcd; + + switch (label_expr->type) + { + case LABEL_EXPR_TYPE_EMPTY: + return true; + + case LABEL_EXPR_TYPE_SINGLE: + case LABEL_EXPR_TYPE_AND: + table_name = label_expr_table_name(label_expr, label_expr_kind); + lcd = search_label_name_graph_cache(table_name, graph_oid); + return (lcd != NULL && lcd->kind == label_expr_kind); + + case LABEL_EXPR_TYPE_OR: + // TODO: implement + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("label expression type OR is not implemented"))); + return false; + + default: + elog(ERROR, "invalid cypher_label_expr type"); + return false; + } +} diff --git a/src/include/nodes/cypher_copyfuncs.h b/src/include/nodes/cypher_copyfuncs.h index d7ed7eff7..56395d7a4 100644 --- a/src/include/nodes/cypher_copyfuncs.h +++ b/src/include/nodes/cypher_copyfuncs.h @@ -36,6 +36,8 @@ void copy_cypher_create_path(ExtensibleNode *newnode, const ExtensibleNode *from); void copy_cypher_target_node(ExtensibleNode *newnode, const ExtensibleNode *from); +void copy_cypher_label_expr(ExtensibleNode *newnode, + const ExtensibleNode *from); /* set/remove data structures */ void copy_cypher_update_information(ExtensibleNode *newnode, diff --git a/src/include/nodes/cypher_nodes.h b/src/include/nodes/cypher_nodes.h index 317861b3c..17486d244 100644 --- a/src/include/nodes/cypher_nodes.h +++ b/src/include/nodes/cypher_nodes.h @@ -155,19 +155,21 @@ typedef enum /* * Represents label expressions. * - * Note: support for mixing AND and OR expression - * may be added in future. + * Note: There is a comparator function for this type- label_expr_are_equal. + * If any new fields are added, the comparator function should be updated if + * necessary. */ typedef struct cypher_label_expr { ExtensibleNode extensible; cypher_label_expr_type type; - /** - * this is assigned to rel->label_names. - * be careful before free'ing. + + /* + * List of String. + * + * It is assigned to rel->label_names. Be careful before free'ing. */ - List *label_names; // List of String - char kind; // 'v' or 'e'. what does label_expr belong to during parse time? not same as the kind of labels in ag_label.kind. + List *label_names; } cypher_label_expr; /* ( name :label props ) */ @@ -177,8 +179,6 @@ typedef struct cypher_node char *name; char *parsed_name; cypher_label_expr *label_expr; - char *label; // TODO: to be depracated - char *parsed_label; // TODO: to be depracated bool use_equals; Node *props; /* map or parameter */ int location; @@ -198,8 +198,6 @@ typedef struct cypher_relationship char *name; char *parsed_name; cypher_label_expr *label_expr; - char *label; // TODO: to be depracated - char *parsed_label; // TODO: to be depracated bool use_equals; Node *props; /* map or parameter */ Node *varlen; /* variable length relationships (A_Indices) */ @@ -404,8 +402,7 @@ typedef struct cypher_target_node /* relid that the label stores its entity */ Oid relid; /* label this entity belongs to. */ - char *label_name; // TODO: to be deprecated - List *label_names; // List of String + cypher_label_expr *label_expr; /* variable name for this entity */ char *variable_name; /* diff --git a/src/include/nodes/cypher_readfuncs.h b/src/include/nodes/cypher_readfuncs.h index 5792332ac..27ae03f42 100644 --- a/src/include/nodes/cypher_readfuncs.h +++ b/src/include/nodes/cypher_readfuncs.h @@ -40,6 +40,7 @@ void read_ag_node(ExtensibleNode *node); void read_cypher_create_target_nodes(struct ExtensibleNode *node); void read_cypher_create_path(struct ExtensibleNode *node); void read_cypher_target_node(struct ExtensibleNode *node); +void read_cypher_label_expr(struct ExtensibleNode *node); /* set/remove data structures */ void read_cypher_update_information(struct ExtensibleNode *node); diff --git a/src/include/parser/cypher_label_expr.h b/src/include/parser/cypher_label_expr.h index 387b59702..2849099d8 100644 --- a/src/include/parser/cypher_label_expr.h +++ b/src/include/parser/cypher_label_expr.h @@ -20,89 +20,27 @@ #ifndef AG_CYPHER_LABEL_EXPR_H #define AG_CYPHER_LABEL_EXPR_H +#include "postgres.h" #include "nodes/cypher_nodes.h" -#include "utils/ag_cache.h" -#include "catalog/ag_label.h" -#include "commands/label_commands.h" #define FIRST_LABEL_NAME(label_expr) \ - (list_length((label_expr)->label_names) == 0) \ - ? NULL : linitial((label_expr)->label_names) + (list_length((label_expr)->label_names) == 0) ? \ + NULL : \ + linitial((label_expr)->label_names) // TODO: more readable name LABEL_EXPR_HAS_LABEL returning the oppposite? #define LABEL_EXPR_LENGTH(label_expr) (list_length((label_expr)->label_names)) -#define LABEL_EXPR_IS_EMPTY(label_expr) (LABEL_EXPR_LENGTH((label_expr)) == 0) -#define LABEL_EXPR_LABEL_NAMES(label_expr) (list_copy_deep((label_expr)->label_names)) -//((label_expr)->label_names) - -// TODO: move to C -// TODO: expensive and redundant to call multiple times -/** - * Returns if each label_name in label_expr->label_names is of kind - * `label_kind`, if it exists. - * - * If label_expr is empty, returns true. - */ -bool validate_label_expr_kind(cypher_label_expr *label_expr, uint32 graph_oid, char label_kind) -{ - ListCell *lc; - - foreach (lc, label_expr->label_names) - { - char *label_name; - label_cache_data *cache_data; - - label_name = strVal(lfirst(lc)); - cache_data = search_label_name_graph_cache(label_name, graph_oid); - - if (cache_data && cache_data->kind != label_kind) - { - return false; - } - } - - return true; -} - -// TODO: can be moved to utils? -int string_list_comparator(const ListCell *a, const ListCell *b) -{ - char *str_a = lfirst(a); - char *str_b = lfirst(b); - return strcmp(str_a, str_b); -} - -char *get_cluster_name(cypher_label_expr *label_expr) -{ - ListCell *lc; - bool is_first; - - // TODO: or, defalt, single, and can be a switch? - - /* or */ - Assert(label_expr->type != LABEL_EXPR_TYPE_OR); - - /* default */ - if (LABEL_EXPR_IS_EMPTY(label_expr)) - { - return label_expr->kind == LABEL_KIND_VERTEX ? - AG_DEFAULT_LABEL_VERTEX : AG_DEFAULT_LABEL_EDGE; - } - - /* single */ - if (LABEL_EXPR_LENGTH(label_expr) == 1) - { - // TODO: when multi-label implemented, it will be different - return (char *)strVal(linitial(label_expr->label_names)); - } - - /* and */ - // TODO: implement - - // TODO: can be done during early parsing? - // list_sort(label_expr->label_names, &string_list_comparator); - - return NULL; -} +#define LABEL_EXPR_IS_EMPTY(label_expr) \ + (LABEL_EXPR_TYPE((label_expr)) == LABEL_EXPR_TYPE_EMPTY) // TODO: maybe redundant to LABEL_EXPR_TYPE +#define LABEL_EXPR_TYPE(label_expr) \ + ((label_expr) ? (label_expr)->type : LABEL_EXPR_TYPE_EMPTY) + +char *find_first_invalid_label(cypher_label_expr *label_expr, + char label_expr_kind, Oid graph_oid); +int string_list_comparator(const ListCell *a, const ListCell *b); +char *label_expr_table_name(cypher_label_expr *label_expr, char label_expr_kind); +bool label_expr_are_equal(cypher_label_expr *le1, cypher_label_expr *le2); +bool label_expr_has_tables(cypher_label_expr *label_expr, char label_expr_kind, + Oid graph_oid); #endif From fdeadbc0580d4d17fe48c954e5cd3a94040efc48 Mon Sep 17 00:00:00 2001 From: Rafsun Masud Date: Wed, 1 Nov 2023 15:25:08 -0700 Subject: [PATCH 03/13] Implement label expression type OR Supports queries like- MATCH (v:A|B|C) RETURN v MATCH ()-[e:A|B|C]->() RETURN v --- Makefile | 1 + regress/expected/cypher_match.out | 12 +- regress/expected/multiple_label.out | 290 +++++++++++++++++++++++++ regress/sql/multiple_label.sql | 95 ++++++++ src/backend/parser/cypher_clause.c | 187 +++++++++++++--- src/backend/parser/cypher_gram.y | 46 +++- src/backend/parser/cypher_label_expr.c | 33 ++- src/include/nodes/cypher_nodes.h | 7 +- src/include/parser/cypher_label_expr.h | 2 +- 9 files changed, 621 insertions(+), 52 deletions(-) create mode 100644 regress/expected/multiple_label.out create mode 100644 regress/sql/multiple_label.sql diff --git a/Makefile b/Makefile index c81125d29..2e35c65f6 100644 --- a/Makefile +++ b/Makefile @@ -114,6 +114,7 @@ REGRESS = scan \ jsonb_operators \ list_comprehension \ map_projection \ + multiple_label \ drop srcdir=`pwd` diff --git a/regress/expected/cypher_match.out b/regress/expected/cypher_match.out index 891ace9ab..e25584788 100644 --- a/regress/expected/cypher_match.out +++ b/regress/expected/cypher_match.out @@ -559,16 +559,16 @@ $$) AS (i agtype, c agtype); i | c ---+----------- | "middle" - | "end" - | "initial" - | "middle" - 0 | "middle" - 0 | "end" - 0 | "initial" 0 | "middle" 1 | "middle" + | "end" + 0 | "end" 1 | "end" + | "initial" + 0 | "initial" 1 | "initial" + | "middle" + 0 | "middle" 1 | "middle" (12 rows) diff --git a/regress/expected/multiple_label.out b/regress/expected/multiple_label.out new file mode 100644 index 000000000..6e69097a1 --- /dev/null +++ b/regress/expected/multiple_label.out @@ -0,0 +1,290 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +LOAD 'age'; +SET search_path TO ag_catalog; +/* + * MATCH OR Expression (Vertex) + * + * TODO: All labels are mutually exclusive. When CREATE for multiple label is + * implemented write tests for mutually-inclusive MATCHes. + */ + -- create +SELECT create_graph('multiple-label-1'); +NOTICE: graph "multiple-label-1" has been created + create_graph +-------------- + +(1 row) + +SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:A{name:'A1'}) RETURN v $$) as (a agtype); + a +----------------------------------------------------------------------------- + {"id": 844424930131969, "label": "A", "properties": {"name": "A1"}}::vertex +(1 row) + +SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:A{name:'A2'}) RETURN v $$) as (a agtype); + a +----------------------------------------------------------------------------- + {"id": 844424930131970, "label": "A", "properties": {"name": "A2"}}::vertex +(1 row) + +SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:B{name:'B1'}) RETURN v $$) as (a agtype); + a +------------------------------------------------------------------------------ + {"id": 1125899906842625, "label": "B", "properties": {"name": "B1"}}::vertex +(1 row) + +SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:B{name:'B2'}) RETURN v $$) as (a agtype); + a +------------------------------------------------------------------------------ + {"id": 1125899906842626, "label": "B", "properties": {"name": "B2"}}::vertex +(1 row) + +SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:C{name:'C1'}) RETURN v $$) as (a agtype); + a +------------------------------------------------------------------------------ + {"id": 1407374883553281, "label": "C", "properties": {"name": "C1"}}::vertex +(1 row) + +SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:C{name:'C2'}) RETURN v $$) as (a agtype); + a +------------------------------------------------------------------------------ + {"id": 1407374883553282, "label": "C", "properties": {"name": "C2"}}::vertex +(1 row) + +SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:D{name:'D1'}) RETURN v $$) as (a agtype); + a +------------------------------------------------------------------------------ + {"id": 1688849860263937, "label": "D", "properties": {"name": "D1"}}::vertex +(1 row) + +SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:D{name:'D2'}) RETURN v $$) as (a agtype); + a +------------------------------------------------------------------------------ + {"id": 1688849860263938, "label": "D", "properties": {"name": "D2"}}::vertex +(1 row) + +-- general match +SELECT * FROM cypher('multiple-label-1', $$ MATCH (v) RETURN v $$) as (a agtype); + a +------------------------------------------------------------------------------ + {"id": 844424930131969, "label": "A", "properties": {"name": "A1"}}::vertex + {"id": 844424930131970, "label": "A", "properties": {"name": "A2"}}::vertex + {"id": 1125899906842625, "label": "B", "properties": {"name": "B1"}}::vertex + {"id": 1125899906842626, "label": "B", "properties": {"name": "B2"}}::vertex + {"id": 1407374883553281, "label": "C", "properties": {"name": "C1"}}::vertex + {"id": 1407374883553282, "label": "C", "properties": {"name": "C2"}}::vertex + {"id": 1688849860263937, "label": "D", "properties": {"name": "D1"}}::vertex + {"id": 1688849860263938, "label": "D", "properties": {"name": "D2"}}::vertex +(8 rows) + +SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A) RETURN v.name $$) as (a agtype); + a +------ + "A1" + "A2" +(2 rows) + +SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A|B) RETURN v.name $$) as (a agtype); + a +------ + "A1" + "A2" + "B1" + "B2" +(4 rows) + +SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A|B|C) RETURN v.name $$) as (a agtype); + a +------ + "A1" + "A2" + "B1" + "B2" + "C1" + "C2" +(6 rows) + +SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A|B|C|D) RETURN v.name $$) as (a agtype); + a +------ + "A1" + "A2" + "B1" + "B2" + "C1" + "C2" + "D1" + "D2" +(8 rows) + +-- duplicate (should output same as MATCH (v:A|B)) +SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A|B|A) RETURN v.name $$) as (a agtype); + a +------ + "A1" + "A2" + "B1" + "B2" +(4 rows) + +-- different order (should output same as MATCH (v:A|B)) +SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:B|A) RETURN v.name $$) as (a agtype); + a +------ + "A1" + "A2" + "B1" + "B2" +(4 rows) + +-- label M does not exists (should output same as MATCH (v:A|B)) +SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A|B|M) RETURN v.name $$) as (a agtype); + a +------ + "A1" + "A2" + "B1" + "B2" +(4 rows) + +-- no label exists (should output empty) +SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:M|N|O) RETURN v.name $$) as (a agtype); + a +--- +(0 rows) + +-- cleanup +SELECT drop_graph('multiple-label-1', true); +NOTICE: drop cascades to 6 other objects +DETAIL: drop cascades to table "multiple-label-1"._ag_label_vertex +drop cascades to table "multiple-label-1"._ag_label_edge +drop cascades to table "multiple-label-1"."A" +drop cascades to table "multiple-label-1"."B" +drop cascades to table "multiple-label-1"."C" +drop cascades to table "multiple-label-1"."D" +NOTICE: graph "multiple-label-1" has been dropped + drop_graph +------------ + +(1 row) + +/* + * MATCH OR Expression (Edge) + */ + -- create +SELECT create_graph('multiple-label-2'); +NOTICE: graph "multiple-label-2" has been created + create_graph +-------------- + +(1 row) + +SELECT * FROM cypher('multiple-label-2', $$ CREATE ({name:'a1'})-[e:A]->({name:'a2'}) RETURN e $$) as (a agtype); + a +----------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": "A", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge +(1 row) + +SELECT * FROM cypher('multiple-label-2', $$ CREATE ({name:'b1'})-[e:B]->({name:'b2'}) RETURN e $$) as (a agtype); + a +------------------------------------------------------------------------------------------------------------------------ + {"id": 1125899906842625, "label": "B", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge +(1 row) + +SELECT * FROM cypher('multiple-label-2', $$ CREATE ({name:'c1'})-[e:C]->({name:'c2'}) RETURN e $$) as (a agtype); + a +------------------------------------------------------------------------------------------------------------------------ + {"id": 1407374883553281, "label": "C", "end_id": 281474976710662, "start_id": 281474976710661, "properties": {}}::edge +(1 row) + +-- general match +SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[e]->(y) RETURN x.name, y.name, e $$) as (x agtype, y agtype, e agtype); + x | y | e +------+------+------------------------------------------------------------------------------------------------------------------------ + "a1" | "a2" | {"id": 844424930131969, "label": "A", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge + "b1" | "b2" | {"id": 1125899906842625, "label": "B", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge + "c1" | "c2" | {"id": 1407374883553281, "label": "C", "end_id": 281474976710662, "start_id": 281474976710661, "properties": {}}::edge +(3 rows) + +SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:A]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); + x | y +------+------ + "a1" | "a2" +(1 row) + +SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:A|B]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); + x | y +------+------ + "a1" | "a2" + "b1" | "b2" +(2 rows) + +SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:A|B|C]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); + x | y +------+------ + "a1" | "a2" + "b1" | "b2" + "c1" | "c2" +(3 rows) + +-- duplicate (should output same as MATCH (x)-[:A|B]->(y)) +SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:A|B|A]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); + x | y +------+------ + "a1" | "a2" + "b1" | "b2" +(2 rows) + +-- different order (should output same as MATCH (x)-[:A|B]->(y)) +SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:B|A]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); + x | y +------+------ + "a1" | "a2" + "b1" | "b2" +(2 rows) + +-- label M does not exists (should output same as MATCH (x)-[:A|B]->(y)) +SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:A|B|M]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); + x | y +------+------ + "a1" | "a2" + "b1" | "b2" +(2 rows) + +-- no label exists (should output empty) +SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:M|N|O]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); + x | y +---+--- +(0 rows) + +-- cleanup +SELECT drop_graph('multiple-label-2', true); +NOTICE: drop cascades to 5 other objects +DETAIL: drop cascades to table "multiple-label-2"._ag_label_vertex +drop cascades to table "multiple-label-2"._ag_label_edge +drop cascades to table "multiple-label-2"."A" +drop cascades to table "multiple-label-2"."B" +drop cascades to table "multiple-label-2"."C" +NOTICE: graph "multiple-label-2" has been dropped + drop_graph +------------ + +(1 row) + diff --git a/regress/sql/multiple_label.sql b/regress/sql/multiple_label.sql new file mode 100644 index 000000000..cc1ef34ed --- /dev/null +++ b/regress/sql/multiple_label.sql @@ -0,0 +1,95 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +LOAD 'age'; +SET search_path TO ag_catalog; + + +/* + * MATCH OR Expression (Vertex) + * + * TODO: All labels are mutually exclusive. When CREATE for multiple label is + * implemented write tests for mutually-inclusive MATCHes. + */ + + -- create +SELECT create_graph('multiple-label-1'); +SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:A{name:'A1'}) RETURN v $$) as (a agtype); +SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:A{name:'A2'}) RETURN v $$) as (a agtype); +SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:B{name:'B1'}) RETURN v $$) as (a agtype); +SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:B{name:'B2'}) RETURN v $$) as (a agtype); +SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:C{name:'C1'}) RETURN v $$) as (a agtype); +SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:C{name:'C2'}) RETURN v $$) as (a agtype); +SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:D{name:'D1'}) RETURN v $$) as (a agtype); +SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:D{name:'D2'}) RETURN v $$) as (a agtype); + +-- general match +SELECT * FROM cypher('multiple-label-1', $$ MATCH (v) RETURN v $$) as (a agtype); +SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A) RETURN v.name $$) as (a agtype); +SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A|B) RETURN v.name $$) as (a agtype); +SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A|B|C) RETURN v.name $$) as (a agtype); +SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A|B|C|D) RETURN v.name $$) as (a agtype); + +-- duplicate (should output same as MATCH (v:A|B)) +SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A|B|A) RETURN v.name $$) as (a agtype); + +-- different order (should output same as MATCH (v:A|B)) +SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:B|A) RETURN v.name $$) as (a agtype); + +-- label M does not exists (should output same as MATCH (v:A|B)) +SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A|B|M) RETURN v.name $$) as (a agtype); + +-- no label exists (should output empty) +SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:M|N|O) RETURN v.name $$) as (a agtype); + +-- cleanup +SELECT drop_graph('multiple-label-1', true); + + +/* + * MATCH OR Expression (Edge) + */ + + -- create +SELECT create_graph('multiple-label-2'); +SELECT * FROM cypher('multiple-label-2', $$ CREATE ({name:'a1'})-[e:A]->({name:'a2'}) RETURN e $$) as (a agtype); +SELECT * FROM cypher('multiple-label-2', $$ CREATE ({name:'b1'})-[e:B]->({name:'b2'}) RETURN e $$) as (a agtype); +SELECT * FROM cypher('multiple-label-2', $$ CREATE ({name:'c1'})-[e:C]->({name:'c2'}) RETURN e $$) as (a agtype); + +-- general match +SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[e]->(y) RETURN x.name, y.name, e $$) as (x agtype, y agtype, e agtype); +SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:A]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); +SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:A|B]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); +SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:A|B|C]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); + +-- duplicate (should output same as MATCH (x)-[:A|B]->(y)) +SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:A|B|A]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); + +-- different order (should output same as MATCH (x)-[:A|B]->(y)) +SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:B|A]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); + +-- label M does not exists (should output same as MATCH (x)-[:A|B]->(y)) +SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:A|B|M]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); + +-- no label exists (should output empty) +SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:M|N|O]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); + +-- cleanup +SELECT drop_graph('multiple-label-2', true); + diff --git a/src/backend/parser/cypher_clause.c b/src/backend/parser/cypher_clause.c index 679fb65e2..0b7c604f9 100644 --- a/src/backend/parser/cypher_clause.c +++ b/src/backend/parser/cypher_clause.c @@ -38,6 +38,7 @@ #include "parser/parsetree.h" #include "parser/parse_relation.h" #include "parser/cypher_label_expr.h" +#include "parser/analyze.h" #include "rewrite/rewriteHandler.h" #include "catalog/ag_graph.h" @@ -49,6 +50,7 @@ #include "parser/cypher_item.h" #include "parser/cypher_parse_agg.h" #include "parser/cypher_transform_entity.h" +#include "parser/cypher_label_expr.h" #include "utils/ag_cache.h" #include "utils/ag_func.h" #include "utils/ag_guc.h" @@ -145,7 +147,7 @@ static List *make_directed_edge_join_conditions( cypher_parsestate *cpstate, transform_entity *prev_entity, transform_entity *next_entity, Node *prev_qual, Node *next_qual, cypher_label_expr *prev_node_filter, cypher_label_expr *next_node_filter); -static ParseNamespaceItem *get_pnsi_for_match(cypher_parsestate *cpstate, +static ParseNamespaceItem *create_pnsi_for_match(cypher_parsestate *cpstate, cypher_label_expr *label_expr, char label_expr_kind, Alias *alias, bool valid_label); @@ -4974,41 +4976,170 @@ static Node *make_qual(cypher_parsestate *cpstate, return node; } -static ParseNamespaceItem *get_pnsi_for_match(cypher_parsestate *cpstate, - cypher_label_expr *label_expr, - char label_expr_kind, - Alias *alias, - bool valid_label) +/* + * Transforms label expression type OR to a SQL union query. + * + * For example, + * MATCH (:A|B|C) + * is transformed into- + * SELECT * FROM ( -- top select stmt + * ((SELECT * FROM A) UNION (SELECT * FROM B)) -- left arg + * UNION + * (SELECT * FROM C); -- right arg + * ); + */ +static Query *label_expr_union_query(cypher_parsestate *cpstate, + cypher_label_expr *label_expr, + char label_expr_kind) { - ParseState *pstate = (ParseState *)cpstate; - ParseNamespaceItem *pnsi; - char *rel_name; - RangeVar *label_range_var; - char *schema_name; + ParseState *pstate; + Query *query; + SelectStmt *top_select_stmt; + ListCell *lc; - schema_name = get_graph_namespace_name(cpstate->graph_name); + Assert(LABEL_EXPR_TYPE(label_expr) == LABEL_EXPR_TYPE_OR); - if (valid_label) - { - char *table_name = label_expr_table_name(label_expr, label_expr_kind); - rel_name = get_label_relation_name(table_name, cpstate->graph_oid); - } - else + top_select_stmt = NULL; + pstate = (ParseState *)make_parsestate(&cpstate->pstate); + + foreach (lc, label_expr->label_names) { - if (label_expr_kind == LABEL_KIND_VERTEX) + char *label_name; + char *schemaname; + char *relname; + label_cache_data *lcd; + RangeVar *label_rv; + SelectStmt *select_stmt; + ColumnRef *cr; + ResTarget *rt; + + label_name = strVal(lfirst(lc)); + + /* ignore labels that does not exist */ + lcd = search_label_name_graph_cache(label_name, cpstate->graph_oid); + if (lcd == NULL || lcd->kind != label_expr_kind) + { + continue; + } + + /* make rangevar */ + schemaname = get_graph_namespace_name(cpstate->graph_name); + relname = get_label_relation_name(label_name, cpstate->graph_oid); + label_rv = makeRangeVar(schemaname, relname, -1); + + /* make (SELECT * FROM relname) */ + cr = makeNode(ColumnRef); + cr->fields = list_make1(makeNode(A_Star)); + cr->location = -1; + rt = makeNode(ResTarget); + rt->name = NULL; + rt->indirection = NIL; + rt->val = (Node *)cr; + rt->location = -1; + + select_stmt = makeNode(SelectStmt); + select_stmt->fromClause = list_make1(label_rv); + select_stmt->op = SETOP_NONE; + select_stmt->targetList = list_make1(rt); + + /* add to top SelectStmt */ + if (top_select_stmt == NULL) { - rel_name = AG_DEFAULT_LABEL_VERTEX; + top_select_stmt = select_stmt; } else { - rel_name = AG_DEFAULT_LABEL_EDGE; + SelectStmt *new_top_select_stmt; + + new_top_select_stmt = makeNode(SelectStmt); + new_top_select_stmt->op = SETOP_UNION; + new_top_select_stmt->all = true; + new_top_select_stmt->larg = top_select_stmt; + new_top_select_stmt->rarg = select_stmt; + + top_select_stmt = new_top_select_stmt; } } - label_range_var = makeRangeVar(schema_name, rel_name, -1); + /* + * top_select_stmt == NULL only when no labels in label_expr + * exists. This function is not called in that case. + */ + Assert(top_select_stmt != NULL); + + query = transformStmt(pstate, (Node *)top_select_stmt); + + return query; +} + +/* + * Adds a RTE for the `label_expr` in `cpstate` and returns the PNSI. + * + * For invalid label, empty label and single label, the rte is a relation. + * For multiple label, the rte is a subquery. + */ +static ParseNamespaceItem *create_pnsi_for_match(cypher_parsestate *cpstate, + cypher_label_expr *label_expr, + char label_expr_kind, + Alias *alias, + bool valid_label) +{ + ParseState *pstate; + RangeVar *label_rv; + ParseNamespaceItem *pnsi; + Query *subquery; + char *schemaname; + char *relname; + + pstate = (ParseState *)cpstate; + schemaname = get_graph_namespace_name(cpstate->graph_name); - pnsi = addRangeTableEntry(pstate, label_range_var, alias, - label_range_var->inh, true); + /* + * For invalid label, although no rows will be output, a pnsi still needs + * to be created in order to construct an empty rte. + */ + if (!valid_label) + { + relname = label_expr_kind == LABEL_KIND_VERTEX ? + AG_DEFAULT_LABEL_VERTEX : + AG_DEFAULT_LABEL_EDGE; + label_rv = makeRangeVar(schemaname, relname, -1); + pnsi = addRangeTableEntry(pstate, label_rv, alias, label_rv->inh, + true); + + return pnsi; + } + + switch (LABEL_EXPR_TYPE(label_expr)) + { + case LABEL_EXPR_TYPE_EMPTY: + case LABEL_EXPR_TYPE_SINGLE: + relname = label_expr_table_name(label_expr, label_expr_kind); + relname = get_label_relation_name(relname, cpstate->graph_oid); + + label_rv = makeRangeVar(schemaname, relname, -1); + pnsi = addRangeTableEntry(pstate, label_rv, alias, label_rv->inh, + true); + break; + + case LABEL_EXPR_TYPE_OR: + subquery = label_expr_union_query(cpstate, label_expr, + label_expr_kind); + pnsi = addRangeTableEntryForSubquery(pstate, subquery, alias, false, + true); + break; + + case LABEL_EXPR_TYPE_AND: + // TODO: implement + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("label expression type AND is not implemented"))); + break; + + default: + elog(ERROR, "Unknown label expression type"); + break; + } return pnsi; } @@ -5208,8 +5339,8 @@ static Expr *transform_cypher_edge(cypher_parsestate *cpstate, rel->name = get_next_default_alias(cpstate); } - pnsi = get_pnsi_for_match(cpstate, rel->label_expr, LABEL_KIND_EDGE, - makeAlias(rel->name, NIL), valid_label); + pnsi = create_pnsi_for_match(cpstate, rel->label_expr, LABEL_KIND_EDGE, + makeAlias(rel->name, NIL), valid_label); Assert(pnsi != NULL); /* @@ -5461,8 +5592,8 @@ static Expr *transform_cypher_node(cypher_parsestate *cpstate, } /* now build a new vertex */ - pnsi = get_pnsi_for_match(cpstate, node->label_expr, LABEL_KIND_VERTEX, - makeAlias(node->name, NIL), valid_label); + pnsi = create_pnsi_for_match(cpstate, node->label_expr, LABEL_KIND_VERTEX, + makeAlias(node->name, NIL), valid_label); Assert(pnsi != NULL); diff --git a/src/backend/parser/cypher_gram.y b/src/backend/parser/cypher_gram.y index fb6e43b50..0dc79fe8f 100644 --- a/src/backend/parser/cypher_gram.y +++ b/src/backend/parser/cypher_gram.y @@ -149,6 +149,7 @@ %type path anonymous_path path_node path_relationship path_relationship_body properties_opt +%type label_expr_non_empty %type label_expr /* expression */ @@ -1499,24 +1500,57 @@ path_relationship_body: } ; -label_expr: - /* empty */ +label_expr_non_empty: + /* single */ + ':' label_name { cypher_label_expr *n; n = make_ag_node(cypher_label_expr); + n->type = LABEL_EXPR_TYPE_SINGLE; + n->label_names = list_make1(makeString($2)); + + $$ = (Node *) n; + } + /* or expression */ + | label_expr_non_empty '|' label_name + { + cypher_label_expr *n = (cypher_label_expr *)$1; + + switch (n->type) + { + case LABEL_EXPR_TYPE_SINGLE: + n->type = LABEL_EXPR_TYPE_OR; + n->label_names = list_append_unique(n->label_names, makeString($3)); + break; + case LABEL_EXPR_TYPE_OR: + n->label_names = list_append_unique(n->label_names, makeString($3)); + break; + default: + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("Cannot mix different label expressions"), + ag_scanner_errposition(@2, scanner))); + } $$ = (Node *) n; } - | ':' label_name + ; + +label_expr: + /* empty */ { cypher_label_expr *n; n = make_ag_node(cypher_label_expr); - n->type = LABEL_EXPR_TYPE_SINGLE; - n->label_names = list_make1(makeString($2)); $$ = (Node *) n; } - ; + | label_expr_non_empty + { + /* sorts the list */ + cypher_label_expr *n = (cypher_label_expr *)$1; + list_sort(n->label_names, &list_string_cmp); + $$ = (Node *)n; + }; properties_opt: /* empty */ diff --git a/src/backend/parser/cypher_label_expr.c b/src/backend/parser/cypher_label_expr.c index 63a9058b0..05eb548b8 100644 --- a/src/backend/parser/cypher_label_expr.c +++ b/src/backend/parser/cypher_label_expr.c @@ -35,11 +35,19 @@ char *find_first_invalid_label(cypher_label_expr *label_expr, } // TODO: can be moved to utils? -int string_list_comparator(const ListCell *a, const ListCell *b) +/* + * List comparator for String nodes. The ListCells a and b must + * contain node pointer of type T_String. + */ +int list_string_cmp(const ListCell *a, const ListCell *b) { - char *str_a = lfirst(a); - char *str_b = lfirst(b); - return strcmp(str_a, str_b); + Node *na = lfirst(a); + Node *nb = lfirst(b); + + Assert(IsA(na, String)); + Assert(IsA(nb, String)); + + return strcmp(strVal(na), strVal(nb)); } /* @@ -68,7 +76,7 @@ char *label_expr_table_name(cypher_label_expr *label_expr, case LABEL_EXPR_TYPE_OR: // TODO: implement - elog(ERROR, "label expression type OR cannot cannot have a table"); + elog(ERROR, "label expression type OR cannot have a table"); return NULL; default: @@ -135,6 +143,7 @@ bool label_expr_has_tables(cypher_label_expr *label_expr, char label_expr_kind, { char *table_name; label_cache_data *lcd; + ListCell *lc; switch (label_expr->type) { @@ -148,10 +157,16 @@ bool label_expr_has_tables(cypher_label_expr *label_expr, char label_expr_kind, return (lcd != NULL && lcd->kind == label_expr_kind); case LABEL_EXPR_TYPE_OR: - // TODO: implement - ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("label expression type OR is not implemented"))); + foreach (lc, label_expr->label_names) + { + table_name = strVal(lfirst(lc)); + lcd = search_label_name_graph_cache(table_name, graph_oid); + + if (lcd != NULL && lcd->kind == label_expr_kind) + { + return true; + } + } return false; default: diff --git a/src/include/nodes/cypher_nodes.h b/src/include/nodes/cypher_nodes.h index 17486d244..bf87caf04 100644 --- a/src/include/nodes/cypher_nodes.h +++ b/src/include/nodes/cypher_nodes.h @@ -165,9 +165,12 @@ typedef struct cypher_label_expr cypher_label_expr_type type; /* - * List of String. + * List of String nodes. * - * It is assigned to rel->label_names. Be careful before free'ing. + * The list must be unique and sorted in ascending order. This is + * done in the grammar during parsing. + * + * Note: It is assigned to rel->label_names. Be careful before free'ing. */ List *label_names; } cypher_label_expr; diff --git a/src/include/parser/cypher_label_expr.h b/src/include/parser/cypher_label_expr.h index 2849099d8..60d3bdb1c 100644 --- a/src/include/parser/cypher_label_expr.h +++ b/src/include/parser/cypher_label_expr.h @@ -37,7 +37,7 @@ char *find_first_invalid_label(cypher_label_expr *label_expr, char label_expr_kind, Oid graph_oid); -int string_list_comparator(const ListCell *a, const ListCell *b); +int list_string_cmp(const ListCell *a, const ListCell *b); char *label_expr_table_name(cypher_label_expr *label_expr, char label_expr_kind); bool label_expr_are_equal(cypher_label_expr *le1, cypher_label_expr *le2); bool label_expr_has_tables(cypher_label_expr *label_expr, char label_expr_kind, From 44a95fe2535374b91b49e425d8b3e0762957b569 Mon Sep 17 00:00:00 2001 From: Rafsun Masud Date: Tue, 28 Nov 2023 10:40:41 -0800 Subject: [PATCH 04/13] Implement label expression type AND Some examples of supported multiple label queries: CREATE (:a:b) MERGE (:a:b) MATCH (:a:b) MATCH (:a|b) See regress/sql/multiple_label.sql for more details on what kind of queries are supported. Change summary: --------------- * A new column `allrelations` is added to ag_label catalog * Change in creating AGE relations logic * Change in MATCH's transformation logic (related to building parse namespace item) --- Makefile | 1 + regress/expected/cypher_create.out | 2 +- regress/expected/multiple_label.out | 1062 +++++++++++++++++++----- regress/sql/multiple_label.sql | 237 ++++-- sql/age_main.sql | 1 + src/backend/catalog/ag_label.c | 14 +- src/backend/commands/label_commands.c | 5 + src/backend/parser/cypher_clause.c | 258 ++---- src/backend/parser/cypher_gram.y | 29 +- src/backend/parser/cypher_label_expr.c | 536 ++++++++++-- src/backend/utils/cache/ag_cache.c | 32 +- src/include/catalog/ag_label.h | 6 +- src/include/nodes/cypher_nodes.h | 26 +- src/include/parser/cypher_label_expr.h | 44 +- src/include/utils/ag_cache.h | 1 + 15 files changed, 1752 insertions(+), 502 deletions(-) diff --git a/Makefile b/Makefile index 2e35c65f6..5085fd4c9 100644 --- a/Makefile +++ b/Makefile @@ -108,6 +108,7 @@ REGRESS = scan \ age_global_graph \ age_load \ index \ + multiple_label \ analyze \ graph_generation \ name_validation \ diff --git a/regress/expected/cypher_create.out b/regress/expected/cypher_create.out index 2388af8a0..efdf73fcb 100644 --- a/regress/expected/cypher_create.out +++ b/regress/expected/cypher_create.out @@ -115,7 +115,7 @@ LINE 1: ...LECT * FROM cypher('cypher_create', $$CREATE (:v)-[:e]-()$$)... ^ --edges without labels are not supported SELECT * FROM cypher('cypher_create', $$CREATE (:v)-[]->(:v)$$) AS (a agtype); -ERROR: relationships must be specify a label in CREATE. +ERROR: relationships must have exactly one label in a CREATE\MERGE clause LINE 1: ...LECT * FROM cypher('cypher_create', $$CREATE (:v)-[]->(:v)$$... ^ SELECT * FROM cypher_create.e; diff --git a/regress/expected/multiple_label.out b/regress/expected/multiple_label.out index 6e69097a1..af2dcdafb 100644 --- a/regress/expected/multiple_label.out +++ b/regress/expected/multiple_label.out @@ -19,270 +19,940 @@ LOAD 'age'; SET search_path TO ag_catalog; /* - * MATCH OR Expression (Vertex) - * - * TODO: All labels are mutually exclusive. When CREATE for multiple label is - * implemented write tests for mutually-inclusive MATCHes. + * MATCH queries with multiple labels */ - -- create -SELECT create_graph('multiple-label-1'); -NOTICE: graph "multiple-label-1" has been created +SElECT create_graph('mlabels1'); +NOTICE: graph "mlabels1" has been created create_graph -------------- (1 row) -SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:A{name:'A1'}) RETURN v $$) as (a agtype); - a ------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "A", "properties": {"name": "A1"}}::vertex -(1 row) +-- create +SELECT * FROM cypher('mlabels1', $$ CREATE (x:a {name:'a'}) $$) as (a agtype); + a +--- +(0 rows) -SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:A{name:'A2'}) RETURN v $$) as (a agtype); - a ------------------------------------------------------------------------------ - {"id": 844424930131970, "label": "A", "properties": {"name": "A2"}}::vertex -(1 row) +SELECT * FROM cypher('mlabels1', $$ CREATE (x:b {name:'b'}) $$) as (a agtype); + a +--- +(0 rows) -SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:B{name:'B1'}) RETURN v $$) as (a agtype); - a ------------------------------------------------------------------------------- - {"id": 1125899906842625, "label": "B", "properties": {"name": "B1"}}::vertex -(1 row) +SELECT * FROM cypher('mlabels1', $$ CREATE (x:c {name:'c'}) $$) as (a agtype); + a +--- +(0 rows) -SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:B{name:'B2'}) RETURN v $$) as (a agtype); - a ------------------------------------------------------------------------------- - {"id": 1125899906842626, "label": "B", "properties": {"name": "B2"}}::vertex -(1 row) +SELECT * FROM cypher('mlabels1', $$ CREATE (x:a:b {name:'ab'}) $$) as (a agtype); + a +--- +(0 rows) -SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:C{name:'C1'}) RETURN v $$) as (a agtype); - a ------------------------------------------------------------------------------- - {"id": 1407374883553281, "label": "C", "properties": {"name": "C1"}}::vertex -(1 row) +SELECT * FROM cypher('mlabels1', $$ CREATE (x:a:b:c {name:'abc'}) $$) as (a agtype); + a +--- +(0 rows) -SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:C{name:'C2'}) RETURN v $$) as (a agtype); - a ------------------------------------------------------------------------------- - {"id": 1407374883553282, "label": "C", "properties": {"name": "C2"}}::vertex -(1 row) +SELECT * FROM cypher('mlabels1', $$ CREATE ()-[:p {name:'p'}]->() $$) as (a agtype); + a +--- +(0 rows) + +SELECT * FROM cypher('mlabels1', $$ CREATE ()-[:q {name:'q'}]->() $$) as (a agtype); + a +--- +(0 rows) -SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:D{name:'D1'}) RETURN v $$) as (a agtype); - a ------------------------------------------------------------------------------- - {"id": 1688849860263937, "label": "D", "properties": {"name": "D1"}}::vertex +SELECT * FROM cypher('mlabels1', $$ CREATE ()-[:r {name:'r'}]->() $$) as (a agtype); + a +--- +(0 rows) + +-- match OR +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a) RETURN x.name $$) as (":a" agtype); + :a +------- + "a" + "ab" + "abc" +(3 rows) + +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a|b) RETURN x.name $$) as (":a|b" agtype); + :a|b +------- + "a" + "ab" + "abc" + "b" +(4 rows) + +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a|b|c) RETURN x.name $$) as (":a|b|c" agtype); + :a|b|c +-------- + "a" + "ab" + "abc" + "b" + "c" +(5 rows) + +SELECT * FROM cypher('mlabels1', $$ MATCH ()-[e:p]->() RETURN e.name $$) as (":p" agtype); + :p +----- + "p" (1 row) -SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:D{name:'D2'}) RETURN v $$) as (a agtype); - a ------------------------------------------------------------------------------- - {"id": 1688849860263938, "label": "D", "properties": {"name": "D2"}}::vertex +SELECT * FROM cypher('mlabels1', $$ MATCH ()-[e:p|q]->() RETURN e.name $$) as (":p|q" agtype); + :p|q +------ + "p" + "q" +(2 rows) + +SELECT * FROM cypher('mlabels1', $$ MATCH ()-[e:p|q|r]->() RETURN e.name $$) as (":p|q|r" agtype); + :p|q|r +-------- + "p" + "q" + "r" +(3 rows) + +-- match AND +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a) RETURN x.name $$) as (":a" agtype); + :a +------- + "a" + "ab" + "abc" +(3 rows) + +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a:b) RETURN x.name $$) as (":a:b" agtype); + :a:b +------- + "ab" + "abc" +(2 rows) + +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a:b:c) RETURN x.name $$) as (":a:b:c" agtype); + :a:b:c +-------- + "abc" (1 row) --- general match -SELECT * FROM cypher('multiple-label-1', $$ MATCH (v) RETURN v $$) as (a agtype); - a ------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "A", "properties": {"name": "A1"}}::vertex - {"id": 844424930131970, "label": "A", "properties": {"name": "A2"}}::vertex - {"id": 1125899906842625, "label": "B", "properties": {"name": "B1"}}::vertex - {"id": 1125899906842626, "label": "B", "properties": {"name": "B2"}}::vertex - {"id": 1407374883553281, "label": "C", "properties": {"name": "C1"}}::vertex - {"id": 1407374883553282, "label": "C", "properties": {"name": "C2"}}::vertex - {"id": 1688849860263937, "label": "D", "properties": {"name": "D1"}}::vertex - {"id": 1688849860263938, "label": "D", "properties": {"name": "D2"}}::vertex -(8 rows) +-- mutual inclusion\exclusion +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a) RETURN x.name $$) as (":a" agtype); + :a +------- + "a" + "ab" + "abc" +(3 rows) -SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A) RETURN v.name $$) as (a agtype); - a ------- - "A1" - "A2" +SELECT * FROM cypher('mlabels1', $$ MATCH (x:b) RETURN x.name $$) as (":b" agtype); + :b +------- + "b" + "ab" + "abc" +(3 rows) + +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a:b) RETURN x.name $$) as (":a:b" agtype); + :a:b +------- + "ab" + "abc" (2 rows) -SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A|B) RETURN v.name $$) as (a agtype); - a ------- - "A1" - "A2" - "B1" - "B2" +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a|b) RETURN x.name $$) as (":a|b" agtype); + :a|b +------- + "a" + "ab" + "abc" + "b" (4 rows) -SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A|B|C) RETURN v.name $$) as (a agtype); - a ------- - "A1" - "A2" - "B1" - "B2" - "C1" - "C2" -(6 rows) - -SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A|B|C|D) RETURN v.name $$) as (a agtype); - a ------- - "A1" - "A2" - "B1" - "B2" - "C1" - "C2" - "D1" - "D2" -(8 rows) +-- duplicate: (a, b, a) = (a, b) +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a:b:a) RETURN x.name $$) as (":a:b:a" agtype); + :a:b:a +-------- + "ab" + "abc" +(2 rows) --- duplicate (should output same as MATCH (v:A|B)) -SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A|B|A) RETURN v.name $$) as (a agtype); - a ------- - "A1" - "A2" - "B1" - "B2" +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a|b|a) RETURN x.name $$) as (":a|b|a" agtype); + :a|b|a +-------- + "a" + "ab" + "abc" + "b" (4 rows) --- different order (should output same as MATCH (v:A|B)) -SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:B|A) RETURN v.name $$) as (a agtype); - a ------- - "A1" - "A2" - "B1" - "B2" +SELECT * FROM cypher('mlabels1', $$ MATCH ()-[e:p|q|p]->() RETURN e.name $$) as (":p|q|p" agtype); + :p|q|p +-------- + "p" + "q" +(2 rows) + +-- order: (a, b) = (b, a) +SELECT * FROM cypher('mlabels1', $$ MATCH (x:b:a) RETURN x.name $$) as (":b:a" agtype); + :b:a +------- + "ab" + "abc" +(2 rows) + +SELECT * FROM cypher('mlabels1', $$ MATCH (x:b|a) RETURN x.name $$) as (":b|a" agtype); + :b|a +------- + "a" + "ab" + "abc" + "b" (4 rows) --- label M does not exists (should output same as MATCH (v:A|B)) -SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A|B|M) RETURN v.name $$) as (a agtype); - a +SELECT * FROM cypher('mlabels1', $$ MATCH ()-[e:q|p]->() RETURN e.name $$) as (":q|p" agtype); + :q|p ------ - "A1" - "A2" - "B1" - "B2" + "p" + "q" +(2 rows) + +-- some label does not exist: m and n +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a:m:b) RETURN x.name $$) as (":a:m:b" agtype); + :a:m:b +-------- +(0 rows) + +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a|m|b) RETURN x.name $$) as (":a|m|b" agtype); + :a|m|b +-------- + "a" + "ab" + "abc" + "b" +(4 rows) + +SELECT * FROM cypher('mlabels1', $$ MATCH ()-[e:p|n|q]->() RETURN e.name $$) as (":p|n|q" agtype); + :p|n|q +-------- + "p" + "q" +(2 rows) + +-- no label exists +SELECT * FROM cypher('mlabels1', $$ MATCH (x:i:j:k) RETURN x.name $$) as (":i:j:k" agtype); + :i:j:k +-------- +(0 rows) + +SELECT * FROM cypher('mlabels1', $$ MATCH (x:i|j|k) RETURN x.name $$) as (":i|j|j" agtype); + :i|j|j +-------- +(0 rows) + +SELECT * FROM cypher('mlabels1', $$ MATCH ()-[e:l|m|n]->() RETURN e.name $$) as (":l|m|n" agtype); + :l|m|n +-------- +(0 rows) + +-- unsupported label expression in match +SELECT * FROM cypher('mlabels1', $$ MATCH ()-[e:l:m:n]->() RETURN e.name $$) as (":l|m|n" agtype); +ERROR: label expression type AND is not allowed for relationships in a MATCH clause +LINE 1: SELECT * FROM cypher('mlabels1', $$ MATCH ()-[e:l:m:n]->() R... + ^ +-- cleanup +SElECT drop_graph('mlabels1', true); +NOTICE: drop cascades to 10 other objects +DETAIL: drop cascades to table mlabels1._ag_label_vertex +drop cascades to table mlabels1._ag_label_edge +drop cascades to table mlabels1.a +drop cascades to table mlabels1.b +drop cascades to table mlabels1.c +drop cascades to table mlabels1._agr_ab +drop cascades to table mlabels1._agr_abc +drop cascades to table mlabels1.p +drop cascades to table mlabels1.q +drop cascades to table mlabels1.r +NOTICE: graph "mlabels1" has been dropped + drop_graph +------------ + +(1 row) + +/* + * Unsupported label expressions for create\merge + */ +SElECT create_graph('mlabels4'); +NOTICE: graph "mlabels4" has been created + create_graph +-------------- + +(1 row) + +-- for vertices +SELECT * FROM cypher('mlabels4', $$ CREATE (:a|b) $$) as (a agtype); +ERROR: label expression type OR is not allowed in a CREATE\MERGE clause +LINE 1: SELECT * FROM cypher('mlabels4', $$ CREATE (:a|b) $$) as (a ... + ^ +SELECT * FROM cypher('mlabels4', $$ MERGE (:a|b) $$) as (a agtype); +ERROR: label expression type OR is not allowed in a CREATE\MERGE clause +LINE 1: SELECT * FROM cypher('mlabels4', $$ MERGE (:a|b) $$) as (a ... + ^ +-- for edges +SELECT * FROM cypher('mlabels4', $$ CREATE ()-[]->() $$) as (a agtype); +ERROR: relationships must have exactly one label in a CREATE\MERGE clause +LINE 1: SELECT * FROM cypher('mlabels4', $$ CREATE ()-[]->() $$)... + ^ +SELECT * FROM cypher('mlabels4', $$ CREATE ()-[:a|b]->() $$) as (a agtype); +ERROR: label expression type OR is not allowed in a CREATE\MERGE clause +LINE 1: SELECT * FROM cypher('mlabels4', $$ CREATE ()-[:a|b]->() $$)... + ^ +SELECT * FROM cypher('mlabels4', $$ CREATE ()-[:a:b]->() $$) as (a agtype); +ERROR: relationships must have exactly one label in a CREATE\MERGE clause +LINE 1: SELECT * FROM cypher('mlabels4', $$ CREATE ()-[:a:b]->() $$)... + ^ +SELECT * FROM cypher('mlabels4', $$ MERGE ()-[]->() $$) as (a agtype); +ERROR: relationships must have exactly one label in a CREATE\MERGE clause +LINE 1: SELECT * FROM cypher('mlabels4', $$ MERGE ()-[]->() $$)... + ^ +SELECT * FROM cypher('mlabels4', $$ MERGE ()-[:a|b]->() $$) as (a agtype); +ERROR: label expression type OR is not allowed in a CREATE\MERGE clause +LINE 1: SELECT * FROM cypher('mlabels4', $$ MERGE ()-[:a|b]->() $$)... + ^ +SELECT * FROM cypher('mlabels4', $$ MERGE ()-[:a:b]->() $$) as (a agtype); +ERROR: relationships must have exactly one label in a CREATE\MERGE clause +LINE 1: SELECT * FROM cypher('mlabels4', $$ MERGE ()-[:a:b]->() $$)... + ^ +-- cleanup +SElECT drop_graph('mlabels4', true); +NOTICE: drop cascades to 2 other objects +DETAIL: drop cascades to table mlabels4._ag_label_vertex +drop cascades to table mlabels4._ag_label_edge +NOTICE: graph "mlabels4" has been dropped + drop_graph +------------ + +(1 row) + +/* + * Modelling inheritance + */ +SElECT create_graph('mlabels5'); +NOTICE: graph "mlabels5" has been created + create_graph +-------------- + +(1 row) + +SELECT * FROM cypher('mlabels5', $$ CREATE (:employee:engineer {title:'engineer'}) $$) as (a agtype); + a +--- +(0 rows) + +SELECT * FROM cypher('mlabels5', $$ CREATE (:employee:manager {title:'manager'}) $$) as (a agtype); + a +--- +(0 rows) + +SELECT * FROM cypher('mlabels5', $$ CREATE (:employee:manager:engineer:techlead {title:'techlead'}) $$) as (a agtype); + a +--- +(0 rows) + +SELECT * FROM cypher('mlabels5', $$ CREATE (:employee:accountant {title:'accountant'}) $$) as (a agtype); + a +--- +(0 rows) + +-- match titles +SELECT * FROM cypher('mlabels5', $$ MATCH (x:employee) RETURN x.title $$) as ("all" agtype); + all +-------------- + "engineer" + "manager" + "techlead" + "accountant" (4 rows) --- no label exists (should output empty) -SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:M|N|O) RETURN v.name $$) as (a agtype); +SELECT * FROM cypher('mlabels5', $$ MATCH (x:engineer) RETURN x.title $$) as ("engineers" agtype); + engineers +------------ + "engineer" + "techlead" +(2 rows) + +SELECT * FROM cypher('mlabels5', $$ MATCH (x:manager) RETURN x.title $$) as ("managers" agtype); + managers +------------ + "manager" + "techlead" +(2 rows) + +SELECT * FROM cypher('mlabels5', $$ MATCH (x:techlead) RETURN x.title $$) as ("techleads" agtype); + techleads +------------ + "techlead" +(1 row) + +SELECT * FROM cypher('mlabels5', $$ MATCH (x:accountant) RETURN x.title $$) as ("accountants" agtype); + accountants +-------------- + "accountant" +(1 row) + +-- cleanup +SElECT drop_graph('mlabels5', true); +NOTICE: drop cascades to 11 other objects +DETAIL: drop cascades to table mlabels5._ag_label_vertex +drop cascades to table mlabels5._ag_label_edge +drop cascades to table mlabels5._agr_employeeengineer +drop cascades to table mlabels5.employee +drop cascades to table mlabels5.engineer +drop cascades to table mlabels5._agr_employeemanager +drop cascades to table mlabels5.manager +drop cascades to table mlabels5._agr_employeeengineermanagertechlead +drop cascades to table mlabels5.techlead +drop cascades to table mlabels5._agr_accountantemployee +drop cascades to table mlabels5.accountant +NOTICE: graph "mlabels5" has been dropped + drop_graph +------------ + +(1 row) + +/* + * Invalid label + */ +SElECT create_graph('mlabels6'); +NOTICE: graph "mlabels6" has been created + create_graph +-------------- + +(1 row) + +SELECT * FROM cypher('mlabels6', $$ CREATE (:a)-[:x]->() $$) as (a agtype); + a +--- +(0 rows) + +SELECT * FROM cypher('mlabels6', $$ CREATE (:b)-[:y]->() $$) as (a agtype); a --- (0 rows) +SELECT * FROM cypher('mlabels6', $$ CREATE (:c)-[:z]->() $$) as (a agtype); + a +--- +(0 rows) + +-- following fails +SELECT * FROM cypher('mlabels6', $$ CREATE (:a:y:c) $$) as (a agtype); +ERROR: label y is for edges, not vertices +LINE 1: SELECT * FROM cypher('mlabels6', $$ CREATE (:a:y:c) $$) as (... + ^ +SELECT * FROM cypher('mlabels6', $$ CREATE ()-[:b]->() $$) as (a agtype); +ERROR: label b is for vertices, not edges +LINE 1: SELECT * FROM cypher('mlabels6', $$ CREATE ()-[:b]->() $$) a... + ^ -- cleanup -SELECT drop_graph('multiple-label-1', true); -NOTICE: drop cascades to 6 other objects -DETAIL: drop cascades to table "multiple-label-1"._ag_label_vertex -drop cascades to table "multiple-label-1"._ag_label_edge -drop cascades to table "multiple-label-1"."A" -drop cascades to table "multiple-label-1"."B" -drop cascades to table "multiple-label-1"."C" -drop cascades to table "multiple-label-1"."D" -NOTICE: graph "multiple-label-1" has been dropped +SElECT drop_graph('mlabels6', true); +NOTICE: drop cascades to 8 other objects +DETAIL: drop cascades to table mlabels6._ag_label_vertex +drop cascades to table mlabels6._ag_label_edge +drop cascades to table mlabels6.a +drop cascades to table mlabels6.x +drop cascades to table mlabels6.b +drop cascades to table mlabels6.y +drop cascades to table mlabels6.c +drop cascades to table mlabels6.z +NOTICE: graph "mlabels6" has been dropped drop_graph ------------ (1 row) /* - * MATCH OR Expression (Edge) + * Mixing different label expression types */ - -- create -SELECT create_graph('multiple-label-2'); -NOTICE: graph "multiple-label-2" has been created +SElECT create_graph('mlabels7'); +NOTICE: graph "mlabels7" has been created create_graph -------------- (1 row) -SELECT * FROM cypher('multiple-label-2', $$ CREATE ({name:'a1'})-[e:A]->({name:'a2'}) RETURN e $$) as (a agtype); - a ------------------------------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "A", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge +SELECT * FROM cypher('mlabels7', $$ CREATE (:a) $$) as (a agtype); + a +--- +(0 rows) + +SELECT * FROM cypher('mlabels7', $$ CREATE (:b) $$) as (a agtype); + a +--- +(0 rows) + +SELECT * FROM cypher('mlabels7', $$ CREATE (:c) $$) as (a agtype); + a +--- +(0 rows) + +-- following fails +SELECT * FROM cypher('mlabels7', $$ MATCH (x:a|b:c) RETURN x $$) as (a agtype); +ERROR: cannot mix different label expressions +LINE 1: SELECT * FROM cypher('mlabels7', $$ MATCH (x:a|b:c) RETURN x... + ^ +-- cleanup +SElECT drop_graph('mlabels7', true); +NOTICE: drop cascades to 5 other objects +DETAIL: drop cascades to table mlabels7._ag_label_vertex +drop cascades to table mlabels7._ag_label_edge +drop cascades to table mlabels7.a +drop cascades to table mlabels7.b +drop cascades to table mlabels7.c +NOTICE: graph "mlabels7" has been dropped + drop_graph +------------ + (1 row) -SELECT * FROM cypher('multiple-label-2', $$ CREATE ({name:'b1'})-[e:B]->({name:'b2'}) RETURN e $$) as (a agtype); - a ------------------------------------------------------------------------------------------------------------------------- - {"id": 1125899906842625, "label": "B", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge +/* + * Catalog ag_label.allrelations + */ +SElECT create_graph('mlabels8'); +NOTICE: graph "mlabels8" has been created + create_graph +-------------- + (1 row) -SELECT * FROM cypher('multiple-label-2', $$ CREATE ({name:'c1'})-[e:C]->({name:'c2'}) RETURN e $$) as (a agtype); - a ------------------------------------------------------------------------------------------------------------------------- - {"id": 1407374883553281, "label": "C", "end_id": 281474976710662, "start_id": 281474976710661, "properties": {}}::edge +CREATE VIEW mlabels8.catalog AS + SELECT name, relation, allrelations + FROM ag_catalog.ag_label + WHERE graph IN + (SELECT graphid + FROM ag_catalog.ag_graph + WHERE name = 'mlabels8') + ORDER BY name ASC; +-- creates :a, :b and :a:b +SELECT * FROM cypher('mlabels8', $$ CREATE (:a:b) $$) as (":a:b" agtype); + :a:b +------ +(0 rows) + +SELECT * FROM mlabels8.catalog; + name | relation | allrelations +------------------+---------------------------+------------------------------- + _ag_label_edge | mlabels8._ag_label_edge | {mlabels8._ag_label_edge} + _ag_label_vertex | mlabels8._ag_label_vertex | {mlabels8._ag_label_vertex} + _agr_ab | mlabels8._agr_ab | {mlabels8._agr_ab} + a | mlabels8.a | {mlabels8.a,mlabels8._agr_ab} + b | mlabels8.b | {mlabels8.b,mlabels8._agr_ab} +(5 rows) + +-- creates :c and :bc +SELECT * FROM cypher('mlabels8', $$ CREATE (:b:c) $$) as (":b:c" agtype); + :b:c +------ +(0 rows) + +SELECT * FROM mlabels8.catalog; + name | relation | allrelations +------------------+---------------------------+------------------------------------------------ + _ag_label_edge | mlabels8._ag_label_edge | {mlabels8._ag_label_edge} + _ag_label_vertex | mlabels8._ag_label_vertex | {mlabels8._ag_label_vertex} + _agr_ab | mlabels8._agr_ab | {mlabels8._agr_ab} + _agr_bc | mlabels8._agr_bc | {mlabels8._agr_bc} + a | mlabels8.a | {mlabels8.a,mlabels8._agr_ab} + b | mlabels8.b | {mlabels8.b,mlabels8._agr_ab,mlabels8._agr_bc} + c | mlabels8.c | {mlabels8.c,mlabels8._agr_bc} +(7 rows) + +-- :a:b:c inserted in other labels' allrelations column +SELECT * FROM cypher('mlabels8', $$ CREATE (:a:b:c) $$) as (":a:b:c" agtype); + :a:b:c +-------- +(0 rows) + +SELECT * FROM mlabels8.catalog; + name | relation | allrelations +------------------+---------------------------+------------------------------------------------------------------ + _ag_label_edge | mlabels8._ag_label_edge | {mlabels8._ag_label_edge} + _ag_label_vertex | mlabels8._ag_label_vertex | {mlabels8._ag_label_vertex} + _agr_ab | mlabels8._agr_ab | {mlabels8._agr_ab} + _agr_abc | mlabels8._agr_abc | {mlabels8._agr_abc} + _agr_bc | mlabels8._agr_bc | {mlabels8._agr_bc} + a | mlabels8.a | {mlabels8.a,mlabels8._agr_ab,mlabels8._agr_abc} + b | mlabels8.b | {mlabels8.b,mlabels8._agr_ab,mlabels8._agr_bc,mlabels8._agr_abc} + c | mlabels8.c | {mlabels8.c,mlabels8._agr_bc,mlabels8._agr_abc} +(8 rows) + +-- cleanup +SElECT drop_graph('mlabels8', true); +NOTICE: drop cascades to 9 other objects +DETAIL: drop cascades to table mlabels8._ag_label_vertex +drop cascades to table mlabels8._ag_label_edge +drop cascades to view mlabels8.catalog +drop cascades to table mlabels8._agr_ab +drop cascades to table mlabels8.a +drop cascades to table mlabels8.b +drop cascades to table mlabels8._agr_bc +drop cascades to table mlabels8.c +drop cascades to table mlabels8._agr_abc +NOTICE: graph "mlabels8" has been dropped + drop_graph +------------ + (1 row) --- general match -SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[e]->(y) RETURN x.name, y.name, e $$) as (x agtype, y agtype, e agtype); - x | y | e -------+------+------------------------------------------------------------------------------------------------------------------------ - "a1" | "a2" | {"id": 844424930131969, "label": "A", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge - "b1" | "b2" | {"id": 1125899906842625, "label": "B", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge - "c1" | "c2" | {"id": 1407374883553281, "label": "C", "end_id": 281474976710662, "start_id": 281474976710661, "properties": {}}::edge +/* + * Alias of union subquery in join and filter nodes + */ +SElECT create_graph('mlabels9'); +NOTICE: graph "mlabels9" has been created + create_graph +-------------- + +(1 row) + +SELECT * FROM cypher('mlabels9', $$ CREATE (:a {age:22, title:'a'}) $$) as (a agtype); + a +--- +(0 rows) + +SELECT * FROM cypher('mlabels9', $$ CREATE (:b {age:25, title:'b'}) $$) as (a agtype); + a +--- +(0 rows) + +SELECT * FROM cypher('mlabels9', $$ CREATE (:c {age:27, title:'c'}) $$) as (a agtype); + a +--- +(0 rows) + +SELECT * FROM cypher('mlabels9', $$ CREATE (:d {age:32, title:'d'}) $$) as (a agtype); + a +--- +(0 rows) + +SELECT * FROM cypher('mlabels9', $$ MATCH (x:a) CREATE (x)-[:rel {start:'a'}]->(:m) $$) as (a agtype); + a +--- +(0 rows) + +SELECT * FROM cypher('mlabels9', $$ MATCH (x:b) CREATE (x)-[:rel {start:'b'}]->(:m) $$) as (a agtype); + a +--- +(0 rows) + +SELECT * FROM cypher('mlabels9', $$ MATCH (x:c) CREATE (x)-[:rel {start:'c'}]->(:m) $$) as (a agtype); + a +--- +(0 rows) + +SELECT * FROM cypher('mlabels9', $$ MATCH (x:d) CREATE (x)-[:rel {start:'d'}]->(:m) $$) as (a agtype); + a +--- +(0 rows) + +-- join +SELECT * FROM cypher('mlabels9', $$ MATCH (x:a|b|c)-[e:rel]->(:m) RETURN e.start $$) as (a agtype); + a +----- + "a" + "b" + "c" (3 rows) -SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:A]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); - x | y -------+------ - "a1" | "a2" -(1 row) +SELECT * FROM cypher('mlabels9', $$ MATCH (:a|b|c)-[e:rel]->(:m) RETURN e.start $$) as (a agtype); + a +----- + "a" + "b" + "c" +(3 rows) + +SELECT * FROM cypher('mlabels9', $$ MATCH (x:a|b|c) WITH x MATCH (x)-[e]->() RETURN e.start $$) as (a agtype); + a +----- + "a" + "b" + "c" +(3 rows) -SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:A|B]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); - x | y -------+------ - "a1" | "a2" - "b1" | "b2" +-- filters +SELECT * FROM cypher('mlabels9', $$ MATCH (x:a|b|c) WHERE x.age > 24 RETURN x.title $$) as (a agtype); + a +----- + "b" + "c" (2 rows) -SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:A|B|C]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); - x | y -------+------ - "a1" | "a2" - "b1" | "b2" - "c1" | "c2" -(3 rows) +SELECT * FROM cypher('mlabels9', $$ MATCH (x:a|b|c {age:27}) RETURN x.title $$) as (a agtype); + a +----- + "c" +(1 row) + +-- plans: to check alias +SELECT * FROM cypher('mlabels9', $$ EXPLAIN (COSTS off) MATCH (x:a)-[e:rel]->(:m) RETURN e.start $$) as (a agtype); + QUERY PLAN +---------------------------------------------------- + Merge Join + Merge Cond: (_age_default_alias_0.id = e.end_id) + -> Sort + Sort Key: _age_default_alias_0.id + -> Seq Scan on m _age_default_alias_0 + -> Sort + Sort Key: e.end_id + -> Merge Join + Merge Cond: (e.start_id = x.id) + -> Sort + Sort Key: e.start_id + -> Seq Scan on rel e + -> Sort + Sort Key: x.id + -> Seq Scan on a x +(15 rows) + +SELECT * FROM cypher('mlabels9', $$ EXPLAIN (COSTS off) MATCH (x:a|b|c)-[e:rel]->(:m) RETURN e.start $$) as (a agtype); + QUERY PLAN +---------------------------------------------------------------- + Merge Join + Merge Cond: (x_1.id = e.start_id) + -> Sort + Sort Key: x_1.id + -> Append + -> Seq Scan on a x_1 + -> Seq Scan on b x_2 + -> Seq Scan on c x_3 + -> Sort + Sort Key: e.start_id + -> Merge Join + Merge Cond: (e.end_id = _age_default_alias_0.id) + -> Sort + Sort Key: e.end_id + -> Seq Scan on rel e + -> Sort + Sort Key: _age_default_alias_0.id + -> Seq Scan on m _age_default_alias_0 +(18 rows) + +SELECT * FROM cypher('mlabels9', $$ EXPLAIN (COSTS off) MATCH (:a|b|c)-[e:rel]->(:m) RETURN e.start $$) as (a agtype); + QUERY PLAN +---------------------------------------------------------------- + Merge Join + Merge Cond: (_age_default_alias_0_1.id = e.start_id) + -> Sort + Sort Key: _age_default_alias_0_1.id + -> Append + -> Seq Scan on a _age_default_alias_0_1 + -> Seq Scan on b _age_default_alias_0_2 + -> Seq Scan on c _age_default_alias_0_3 + -> Sort + Sort Key: e.start_id + -> Merge Join + Merge Cond: (e.end_id = _age_default_alias_1.id) + -> Sort + Sort Key: e.end_id + -> Seq Scan on rel e + -> Sort + Sort Key: _age_default_alias_1.id + -> Seq Scan on m _age_default_alias_1 +(18 rows) + +SELECT * FROM cypher('mlabels9', $$ EXPLAIN (COSTS off) MATCH (x:a|b|c) WHERE x.age > 24 RETURN x.title $$) as (a agtype); + QUERY PLAN +------------------------------------------------------------------------------------------------------------ + Result + -> Append + -> Seq Scan on a x_1 + Filter: (agtype_access_operator(VARIADIC ARRAY[properties, '"age"'::agtype]) > '24'::agtype) + -> Seq Scan on b x_2 + Filter: (agtype_access_operator(VARIADIC ARRAY[properties, '"age"'::agtype]) > '24'::agtype) + -> Seq Scan on c x_3 + Filter: (agtype_access_operator(VARIADIC ARRAY[properties, '"age"'::agtype]) > '24'::agtype) +(8 rows) + +SELECT * FROM cypher('mlabels9', $$ EXPLAIN (COSTS off) MATCH (x:a|b|c {age:27}) RETURN x.title $$) as (a agtype); + QUERY PLAN +------------------------------------------------------------- + Result + -> Append + -> Seq Scan on a x_1 + Filter: (properties @> '{"age": 27}'::agtype) + -> Seq Scan on b x_2 + Filter: (properties @> '{"age": 27}'::agtype) + -> Seq Scan on c x_3 + Filter: (properties @> '{"age": 27}'::agtype) +(8 rows) --- duplicate (should output same as MATCH (x)-[:A|B]->(y)) -SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:A|B|A]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); - x | y -------+------ - "a1" | "a2" - "b1" | "b2" +-- cleanup +SElECT drop_graph('mlabels9', true); +NOTICE: drop cascades to 8 other objects +DETAIL: drop cascades to table mlabels9._ag_label_vertex +drop cascades to table mlabels9._ag_label_edge +drop cascades to table mlabels9.a +drop cascades to table mlabels9.b +drop cascades to table mlabels9.c +drop cascades to table mlabels9.d +drop cascades to table mlabels9.rel +drop cascades to table mlabels9.m +NOTICE: graph "mlabels9" has been dropped + drop_graph +------------ + +(1 row) + +/* + * Match without variables + */ +SElECT create_graph('mlabels10'); +NOTICE: graph "mlabels10" has been created + create_graph +-------------- + +(1 row) + +SELECT * FROM cypher('mlabels10', $$ CREATE (:a:b)-[:rel{title:'ab->pq'}]->(:p:q) $$) as (a agtype); + a +--- +(0 rows) + +SELECT * FROM cypher('mlabels10', $$ CREATE (:c)-[:rel{title:'c->m'}]->(:m) $$) as (a agtype); + a +--- +(0 rows) + +SELECT * FROM cypher('mlabels10', $$ CREATE (:d)-[:rel{title:'d->n'}]->(:n) $$) as (a agtype); + a +--- +(0 rows) + +-- AND +SELECT * FROM cypher('mlabels10', $$ MATCH (:a:b)-[e:rel]->() RETURN e.title $$) as (a agtype); + a +---------- + "ab->pq" +(1 row) + +SELECT * FROM cypher('mlabels10', $$ MATCH ()-[e:rel]->(:p:q) RETURN e.title $$) as (a agtype); + a +---------- + "ab->pq" +(1 row) + +SELECT * FROM cypher('mlabels10', $$ MATCH (:a:b)-[e:rel]->(:p:q) RETURN e.title $$) as (a agtype); + a +---------- + "ab->pq" +(1 row) + +-- OR +SELECT * FROM cypher('mlabels10', $$ MATCH (:c|d)-[e:rel]->() RETURN e.title $$) as (a agtype); + a +-------- + "c->m" + "d->n" (2 rows) --- different order (should output same as MATCH (x)-[:A|B]->(y)) -SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:B|A]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); - x | y -------+------ - "a1" | "a2" - "b1" | "b2" +SELECT * FROM cypher('mlabels10', $$ MATCH ()-[e:rel]->(:m|n) RETURN e.title $$) as (a agtype); + a +-------- + "c->m" + "d->n" (2 rows) --- label M does not exists (should output same as MATCH (x)-[:A|B]->(y)) -SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:A|B|M]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); - x | y -------+------ - "a1" | "a2" - "b1" | "b2" +SELECT * FROM cypher('mlabels10', $$ MATCH (:c|d)-[e:rel]->(:m|n) RETURN e.title $$) as (a agtype); + a +-------- + "c->m" + "d->n" (2 rows) --- no label exists (should output empty) -SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:M|N|O]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); - x | y ----+--- +-- Single +SELECT * FROM cypher('mlabels10', $$ MATCH (:c)-[e:rel]->() RETURN e.title $$) as (a agtype); + a +-------- + "c->m" +(1 row) + +SELECT * FROM cypher('mlabels10', $$ MATCH ()-[e:rel]->(:m) RETURN e.title $$) as (a agtype); + a +-------- + "c->m" +(1 row) + +SELECT * FROM cypher('mlabels10', $$ MATCH (:c)-[e:rel]->(:m) RETURN e.title $$) as (a agtype); + a +-------- + "c->m" +(1 row) + +-- cleanup +SElECT drop_graph('mlabels10', true); +NOTICE: drop cascades to 13 other objects +DETAIL: drop cascades to table mlabels10._ag_label_vertex +drop cascades to table mlabels10._ag_label_edge +drop cascades to table mlabels10._agr_ab +drop cascades to table mlabels10.a +drop cascades to table mlabels10.b +drop cascades to table mlabels10.rel +drop cascades to table mlabels10._agr_pq +drop cascades to table mlabels10.p +drop cascades to table mlabels10.q +drop cascades to table mlabels10.c +drop cascades to table mlabels10.m +drop cascades to table mlabels10.d +drop cascades to table mlabels10.n +NOTICE: graph "mlabels10" has been dropped + drop_graph +------------ + +(1 row) + +/* + * Prevent label names with reserved prefix + */ +SElECT create_graph('mlabels11'); +NOTICE: graph "mlabels11" has been created + create_graph +-------------- + +(1 row) + +SELECT * FROM cypher('mlabels11', $$ CREATE (:a:b {title:'ab'}) $$) as (a agtype); + a +--- (0 rows) +SELECT * FROM cypher('mlabels11', $$ CREATE (:_agr_ab {title:'_agr_ab'}) $$) as (a agtype); +ERROR: label names cannot start with the reserved word: "_agr_" +LINE 1: SELECT * FROM cypher('mlabels11', $$ CREATE (:_agr_ab {title... + ^ +SELECT create_vlabel('mlabels11', '_agr_xy'); +ERROR: label names cannot start with the reserved word: "_agr_" +SELECT create_elabel('mlabels11', '_agr_pq'); +ERROR: label names cannot start with the reserved word: "_agr_" +-- check +SELECT * FROM cypher('mlabels11', $$ MATCH (x:a:b) RETURN x.title $$) as (a agtype); + a +------ + "ab" +(1 row) + -- cleanup -SELECT drop_graph('multiple-label-2', true); +SElECT drop_graph('mlabels11', true); NOTICE: drop cascades to 5 other objects -DETAIL: drop cascades to table "multiple-label-2"._ag_label_vertex -drop cascades to table "multiple-label-2"._ag_label_edge -drop cascades to table "multiple-label-2"."A" -drop cascades to table "multiple-label-2"."B" -drop cascades to table "multiple-label-2"."C" -NOTICE: graph "multiple-label-2" has been dropped +DETAIL: drop cascades to table mlabels11._ag_label_vertex +drop cascades to table mlabels11._ag_label_edge +drop cascades to table mlabels11._agr_ab +drop cascades to table mlabels11.a +drop cascades to table mlabels11.b +NOTICE: graph "mlabels11" has been dropped drop_graph ------------ diff --git a/regress/sql/multiple_label.sql b/regress/sql/multiple_label.sql index cc1ef34ed..0cc65aafe 100644 --- a/regress/sql/multiple_label.sql +++ b/regress/sql/multiple_label.sql @@ -22,74 +22,213 @@ SET search_path TO ag_catalog; /* - * MATCH OR Expression (Vertex) - * - * TODO: All labels are mutually exclusive. When CREATE for multiple label is - * implemented write tests for mutually-inclusive MATCHes. + * MATCH queries with multiple labels */ +SElECT create_graph('mlabels1'); +-- create +SELECT * FROM cypher('mlabels1', $$ CREATE (x:a {name:'a'}) $$) as (a agtype); +SELECT * FROM cypher('mlabels1', $$ CREATE (x:b {name:'b'}) $$) as (a agtype); +SELECT * FROM cypher('mlabels1', $$ CREATE (x:c {name:'c'}) $$) as (a agtype); +SELECT * FROM cypher('mlabels1', $$ CREATE (x:a:b {name:'ab'}) $$) as (a agtype); +SELECT * FROM cypher('mlabels1', $$ CREATE (x:a:b:c {name:'abc'}) $$) as (a agtype); +SELECT * FROM cypher('mlabels1', $$ CREATE ()-[:p {name:'p'}]->() $$) as (a agtype); +SELECT * FROM cypher('mlabels1', $$ CREATE ()-[:q {name:'q'}]->() $$) as (a agtype); +SELECT * FROM cypher('mlabels1', $$ CREATE ()-[:r {name:'r'}]->() $$) as (a agtype); +-- match OR +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a) RETURN x.name $$) as (":a" agtype); +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a|b) RETURN x.name $$) as (":a|b" agtype); +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a|b|c) RETURN x.name $$) as (":a|b|c" agtype); +SELECT * FROM cypher('mlabels1', $$ MATCH ()-[e:p]->() RETURN e.name $$) as (":p" agtype); +SELECT * FROM cypher('mlabels1', $$ MATCH ()-[e:p|q]->() RETURN e.name $$) as (":p|q" agtype); +SELECT * FROM cypher('mlabels1', $$ MATCH ()-[e:p|q|r]->() RETURN e.name $$) as (":p|q|r" agtype); +-- match AND +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a) RETURN x.name $$) as (":a" agtype); +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a:b) RETURN x.name $$) as (":a:b" agtype); +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a:b:c) RETURN x.name $$) as (":a:b:c" agtype); +-- mutual inclusion\exclusion +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a) RETURN x.name $$) as (":a" agtype); +SELECT * FROM cypher('mlabels1', $$ MATCH (x:b) RETURN x.name $$) as (":b" agtype); +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a:b) RETURN x.name $$) as (":a:b" agtype); +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a|b) RETURN x.name $$) as (":a|b" agtype); +-- duplicate: (a, b, a) = (a, b) +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a:b:a) RETURN x.name $$) as (":a:b:a" agtype); +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a|b|a) RETURN x.name $$) as (":a|b|a" agtype); +SELECT * FROM cypher('mlabels1', $$ MATCH ()-[e:p|q|p]->() RETURN e.name $$) as (":p|q|p" agtype); +-- order: (a, b) = (b, a) +SELECT * FROM cypher('mlabels1', $$ MATCH (x:b:a) RETURN x.name $$) as (":b:a" agtype); +SELECT * FROM cypher('mlabels1', $$ MATCH (x:b|a) RETURN x.name $$) as (":b|a" agtype); +SELECT * FROM cypher('mlabels1', $$ MATCH ()-[e:q|p]->() RETURN e.name $$) as (":q|p" agtype); +-- some label does not exist: m and n +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a:m:b) RETURN x.name $$) as (":a:m:b" agtype); +SELECT * FROM cypher('mlabels1', $$ MATCH (x:a|m|b) RETURN x.name $$) as (":a|m|b" agtype); +SELECT * FROM cypher('mlabels1', $$ MATCH ()-[e:p|n|q]->() RETURN e.name $$) as (":p|n|q" agtype); +-- no label exists +SELECT * FROM cypher('mlabels1', $$ MATCH (x:i:j:k) RETURN x.name $$) as (":i:j:k" agtype); +SELECT * FROM cypher('mlabels1', $$ MATCH (x:i|j|k) RETURN x.name $$) as (":i|j|j" agtype); +SELECT * FROM cypher('mlabels1', $$ MATCH ()-[e:l|m|n]->() RETURN e.name $$) as (":l|m|n" agtype); +-- unsupported label expression in match +SELECT * FROM cypher('mlabels1', $$ MATCH ()-[e:l:m:n]->() RETURN e.name $$) as (":l|m|n" agtype); +-- cleanup +SElECT drop_graph('mlabels1', true); - -- create -SELECT create_graph('multiple-label-1'); -SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:A{name:'A1'}) RETURN v $$) as (a agtype); -SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:A{name:'A2'}) RETURN v $$) as (a agtype); -SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:B{name:'B1'}) RETURN v $$) as (a agtype); -SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:B{name:'B2'}) RETURN v $$) as (a agtype); -SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:C{name:'C1'}) RETURN v $$) as (a agtype); -SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:C{name:'C2'}) RETURN v $$) as (a agtype); -SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:D{name:'D1'}) RETURN v $$) as (a agtype); -SELECT * FROM cypher('multiple-label-1', $$ CREATE (v:D{name:'D2'}) RETURN v $$) as (a agtype); --- general match -SELECT * FROM cypher('multiple-label-1', $$ MATCH (v) RETURN v $$) as (a agtype); -SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A) RETURN v.name $$) as (a agtype); -SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A|B) RETURN v.name $$) as (a agtype); -SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A|B|C) RETURN v.name $$) as (a agtype); -SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A|B|C|D) RETURN v.name $$) as (a agtype); --- duplicate (should output same as MATCH (v:A|B)) -SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A|B|A) RETURN v.name $$) as (a agtype); +/* + * Unsupported label expressions for create\merge + */ +SElECT create_graph('mlabels4'); +-- for vertices +SELECT * FROM cypher('mlabels4', $$ CREATE (:a|b) $$) as (a agtype); +SELECT * FROM cypher('mlabels4', $$ MERGE (:a|b) $$) as (a agtype); +-- for edges +SELECT * FROM cypher('mlabels4', $$ CREATE ()-[]->() $$) as (a agtype); +SELECT * FROM cypher('mlabels4', $$ CREATE ()-[:a|b]->() $$) as (a agtype); +SELECT * FROM cypher('mlabels4', $$ CREATE ()-[:a:b]->() $$) as (a agtype); +SELECT * FROM cypher('mlabels4', $$ MERGE ()-[]->() $$) as (a agtype); +SELECT * FROM cypher('mlabels4', $$ MERGE ()-[:a|b]->() $$) as (a agtype); +SELECT * FROM cypher('mlabels4', $$ MERGE ()-[:a:b]->() $$) as (a agtype); +-- cleanup +SElECT drop_graph('mlabels4', true); --- different order (should output same as MATCH (v:A|B)) -SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:B|A) RETURN v.name $$) as (a agtype); --- label M does not exists (should output same as MATCH (v:A|B)) -SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:A|B|M) RETURN v.name $$) as (a agtype); --- no label exists (should output empty) -SELECT * FROM cypher('multiple-label-1', $$ MATCH (v:M|N|O) RETURN v.name $$) as (a agtype); +/* + * Modelling inheritance + */ +SElECT create_graph('mlabels5'); +SELECT * FROM cypher('mlabels5', $$ CREATE (:employee:engineer {title:'engineer'}) $$) as (a agtype); +SELECT * FROM cypher('mlabels5', $$ CREATE (:employee:manager {title:'manager'}) $$) as (a agtype); +SELECT * FROM cypher('mlabels5', $$ CREATE (:employee:manager:engineer:techlead {title:'techlead'}) $$) as (a agtype); +SELECT * FROM cypher('mlabels5', $$ CREATE (:employee:accountant {title:'accountant'}) $$) as (a agtype); +-- match titles +SELECT * FROM cypher('mlabels5', $$ MATCH (x:employee) RETURN x.title $$) as ("all" agtype); +SELECT * FROM cypher('mlabels5', $$ MATCH (x:engineer) RETURN x.title $$) as ("engineers" agtype); +SELECT * FROM cypher('mlabels5', $$ MATCH (x:manager) RETURN x.title $$) as ("managers" agtype); +SELECT * FROM cypher('mlabels5', $$ MATCH (x:techlead) RETURN x.title $$) as ("techleads" agtype); +SELECT * FROM cypher('mlabels5', $$ MATCH (x:accountant) RETURN x.title $$) as ("accountants" agtype); +-- cleanup +SElECT drop_graph('mlabels5', true); + + +/* + * Invalid label + */ +SElECT create_graph('mlabels6'); +SELECT * FROM cypher('mlabels6', $$ CREATE (:a)-[:x]->() $$) as (a agtype); +SELECT * FROM cypher('mlabels6', $$ CREATE (:b)-[:y]->() $$) as (a agtype); +SELECT * FROM cypher('mlabels6', $$ CREATE (:c)-[:z]->() $$) as (a agtype); +-- following fails +SELECT * FROM cypher('mlabels6', $$ CREATE (:a:y:c) $$) as (a agtype); +SELECT * FROM cypher('mlabels6', $$ CREATE ()-[:b]->() $$) as (a agtype); -- cleanup -SELECT drop_graph('multiple-label-1', true); +SElECT drop_graph('mlabels6', true); + /* - * MATCH OR Expression (Edge) + * Mixing different label expression types */ +SElECT create_graph('mlabels7'); +SELECT * FROM cypher('mlabels7', $$ CREATE (:a) $$) as (a agtype); +SELECT * FROM cypher('mlabels7', $$ CREATE (:b) $$) as (a agtype); +SELECT * FROM cypher('mlabels7', $$ CREATE (:c) $$) as (a agtype); +-- following fails +SELECT * FROM cypher('mlabels7', $$ MATCH (x:a|b:c) RETURN x $$) as (a agtype); +-- cleanup +SElECT drop_graph('mlabels7', true); - -- create -SELECT create_graph('multiple-label-2'); -SELECT * FROM cypher('multiple-label-2', $$ CREATE ({name:'a1'})-[e:A]->({name:'a2'}) RETURN e $$) as (a agtype); -SELECT * FROM cypher('multiple-label-2', $$ CREATE ({name:'b1'})-[e:B]->({name:'b2'}) RETURN e $$) as (a agtype); -SELECT * FROM cypher('multiple-label-2', $$ CREATE ({name:'c1'})-[e:C]->({name:'c2'}) RETURN e $$) as (a agtype); --- general match -SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[e]->(y) RETURN x.name, y.name, e $$) as (x agtype, y agtype, e agtype); -SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:A]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); -SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:A|B]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); -SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:A|B|C]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); --- duplicate (should output same as MATCH (x)-[:A|B]->(y)) -SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:A|B|A]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); +/* + * Catalog ag_label.allrelations + */ +SElECT create_graph('mlabels8'); +CREATE VIEW mlabels8.catalog AS + SELECT name, relation, allrelations + FROM ag_catalog.ag_label + WHERE graph IN + (SELECT graphid + FROM ag_catalog.ag_graph + WHERE name = 'mlabels8') + ORDER BY name ASC; +-- creates :a, :b and :a:b +SELECT * FROM cypher('mlabels8', $$ CREATE (:a:b) $$) as (":a:b" agtype); +SELECT * FROM mlabels8.catalog; +-- creates :c and :bc +SELECT * FROM cypher('mlabels8', $$ CREATE (:b:c) $$) as (":b:c" agtype); +SELECT * FROM mlabels8.catalog; +-- :a:b:c inserted in other labels' allrelations column +SELECT * FROM cypher('mlabels8', $$ CREATE (:a:b:c) $$) as (":a:b:c" agtype); +SELECT * FROM mlabels8.catalog; +-- cleanup +SElECT drop_graph('mlabels8', true); + + --- different order (should output same as MATCH (x)-[:A|B]->(y)) -SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:B|A]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); +/* + * Alias of union subquery in join and filter nodes + */ +SElECT create_graph('mlabels9'); +SELECT * FROM cypher('mlabels9', $$ CREATE (:a {age:22, title:'a'}) $$) as (a agtype); +SELECT * FROM cypher('mlabels9', $$ CREATE (:b {age:25, title:'b'}) $$) as (a agtype); +SELECT * FROM cypher('mlabels9', $$ CREATE (:c {age:27, title:'c'}) $$) as (a agtype); +SELECT * FROM cypher('mlabels9', $$ CREATE (:d {age:32, title:'d'}) $$) as (a agtype); +SELECT * FROM cypher('mlabels9', $$ MATCH (x:a) CREATE (x)-[:rel {start:'a'}]->(:m) $$) as (a agtype); +SELECT * FROM cypher('mlabels9', $$ MATCH (x:b) CREATE (x)-[:rel {start:'b'}]->(:m) $$) as (a agtype); +SELECT * FROM cypher('mlabels9', $$ MATCH (x:c) CREATE (x)-[:rel {start:'c'}]->(:m) $$) as (a agtype); +SELECT * FROM cypher('mlabels9', $$ MATCH (x:d) CREATE (x)-[:rel {start:'d'}]->(:m) $$) as (a agtype); +-- join +SELECT * FROM cypher('mlabels9', $$ MATCH (x:a|b|c)-[e:rel]->(:m) RETURN e.start $$) as (a agtype); +SELECT * FROM cypher('mlabels9', $$ MATCH (:a|b|c)-[e:rel]->(:m) RETURN e.start $$) as (a agtype); +SELECT * FROM cypher('mlabels9', $$ MATCH (x:a|b|c) WITH x MATCH (x)-[e]->() RETURN e.start $$) as (a agtype); +-- filters +SELECT * FROM cypher('mlabels9', $$ MATCH (x:a|b|c) WHERE x.age > 24 RETURN x.title $$) as (a agtype); +SELECT * FROM cypher('mlabels9', $$ MATCH (x:a|b|c {age:27}) RETURN x.title $$) as (a agtype); +-- plans: to check alias +SELECT * FROM cypher('mlabels9', $$ EXPLAIN (COSTS off) MATCH (x:a)-[e:rel]->(:m) RETURN e.start $$) as (a agtype); +SELECT * FROM cypher('mlabels9', $$ EXPLAIN (COSTS off) MATCH (x:a|b|c)-[e:rel]->(:m) RETURN e.start $$) as (a agtype); +SELECT * FROM cypher('mlabels9', $$ EXPLAIN (COSTS off) MATCH (:a|b|c)-[e:rel]->(:m) RETURN e.start $$) as (a agtype); +SELECT * FROM cypher('mlabels9', $$ EXPLAIN (COSTS off) MATCH (x:a|b|c) WHERE x.age > 24 RETURN x.title $$) as (a agtype); +SELECT * FROM cypher('mlabels9', $$ EXPLAIN (COSTS off) MATCH (x:a|b|c {age:27}) RETURN x.title $$) as (a agtype); +-- cleanup +SElECT drop_graph('mlabels9', true); --- label M does not exists (should output same as MATCH (x)-[:A|B]->(y)) -SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:A|B|M]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); --- no label exists (should output empty) -SELECT * FROM cypher('multiple-label-2', $$ MATCH (x)-[:M|N|O]->(y) RETURN x.name, y.name $$) as (x agtype, y agtype); +/* + * Match without variables + */ +SElECT create_graph('mlabels10'); +SELECT * FROM cypher('mlabels10', $$ CREATE (:a:b)-[:rel{title:'ab->pq'}]->(:p:q) $$) as (a agtype); +SELECT * FROM cypher('mlabels10', $$ CREATE (:c)-[:rel{title:'c->m'}]->(:m) $$) as (a agtype); +SELECT * FROM cypher('mlabels10', $$ CREATE (:d)-[:rel{title:'d->n'}]->(:n) $$) as (a agtype); +-- AND +SELECT * FROM cypher('mlabels10', $$ MATCH (:a:b)-[e:rel]->() RETURN e.title $$) as (a agtype); +SELECT * FROM cypher('mlabels10', $$ MATCH ()-[e:rel]->(:p:q) RETURN e.title $$) as (a agtype); +SELECT * FROM cypher('mlabels10', $$ MATCH (:a:b)-[e:rel]->(:p:q) RETURN e.title $$) as (a agtype); +-- OR +SELECT * FROM cypher('mlabels10', $$ MATCH (:c|d)-[e:rel]->() RETURN e.title $$) as (a agtype); +SELECT * FROM cypher('mlabels10', $$ MATCH ()-[e:rel]->(:m|n) RETURN e.title $$) as (a agtype); +SELECT * FROM cypher('mlabels10', $$ MATCH (:c|d)-[e:rel]->(:m|n) RETURN e.title $$) as (a agtype); +-- Single +SELECT * FROM cypher('mlabels10', $$ MATCH (:c)-[e:rel]->() RETURN e.title $$) as (a agtype); +SELECT * FROM cypher('mlabels10', $$ MATCH ()-[e:rel]->(:m) RETURN e.title $$) as (a agtype); +SELECT * FROM cypher('mlabels10', $$ MATCH (:c)-[e:rel]->(:m) RETURN e.title $$) as (a agtype); -- cleanup -SELECT drop_graph('multiple-label-2', true); +SElECT drop_graph('mlabels10', true); + + +/* + * Prevent label names with reserved prefix + */ +SElECT create_graph('mlabels11'); +SELECT * FROM cypher('mlabels11', $$ CREATE (:a:b {title:'ab'}) $$) as (a agtype); +SELECT * FROM cypher('mlabels11', $$ CREATE (:_agr_ab {title:'_agr_ab'}) $$) as (a agtype); +SELECT create_vlabel('mlabels11', '_agr_xy'); +SELECT create_elabel('mlabels11', '_agr_pq'); +-- check +SELECT * FROM cypher('mlabels11', $$ MATCH (x:a:b) RETURN x.title $$) as (a agtype); +-- cleanup +SElECT drop_graph('mlabels11', true); diff --git a/sql/age_main.sql b/sql/age_main.sql index 59ada0f9f..838dfd4b1 100644 --- a/sql/age_main.sql +++ b/sql/age_main.sql @@ -53,6 +53,7 @@ CREATE TABLE ag_label ( kind label_kind, relation regclass NOT NULL, seq_name name NOT NULL, + allrelations regclass[] DEFAULT '{}', CONSTRAINT fk_graph_oid FOREIGN KEY(graph) REFERENCES ag_graph(graphid) diff --git a/src/backend/catalog/ag_label.c b/src/backend/catalog/ag_label.c index 3c242a000..9f32ce4aa 100644 --- a/src/backend/catalog/ag_label.c +++ b/src/backend/catalog/ag_label.c @@ -45,6 +45,8 @@ void insert_label(const char *label_name, Oid graph_oid, int32 label_id, bool nulls[Natts_ag_label]; Relation ag_label; HeapTuple tuple; + Datum relation; + ArrayType *allrelations; /* * NOTE: Is it better to make use of label_id and label_kind domain types @@ -72,13 +74,23 @@ void insert_label(const char *label_name, Oid graph_oid, int32 label_id, values[Anum_ag_label_kind - 1] = CharGetDatum(label_kind); nulls[Anum_ag_label_kind - 1] = false; - values[Anum_ag_label_relation - 1] = ObjectIdGetDatum(label_relation); + relation = ObjectIdGetDatum(label_relation); + values[Anum_ag_label_relation - 1] = relation; nulls[Anum_ag_label_relation - 1] = false; namestrcpy(&seq_name_data, seq_name); values[Anum_ag_label_seq_name - 1] = NameGetDatum(&seq_name_data); nulls[Anum_ag_label_seq_name - 1] = false; + /* + * By default, allrelations starts with 1 element = ag_label.relation. + * Note: the regclass type info are taken from bootstrap.c. + */ + allrelations = construct_array(&relation, 1, REGCLASSOID, 4, true, + TYPALIGN_INT); + values[Anum_ag_label_allrelations - 1] = PointerGetDatum(allrelations); + nulls[Anum_ag_label_allrelations - 1] = false; + tuple = heap_form_tuple(RelationGetDescr(ag_label), values, nulls); /* diff --git a/src/backend/commands/label_commands.c b/src/backend/commands/label_commands.c index 4cabba9f0..73097a5be 100644 --- a/src/backend/commands/label_commands.c +++ b/src/backend/commands/label_commands.c @@ -39,6 +39,7 @@ #include "commands/label_commands.h" #include "utils/ag_cache.h" #include "utils/name_validation.h" +#include "parser/cypher_label_expr.h" /* * Relation name doesn't have to be label name but the same name is used so @@ -177,6 +178,8 @@ Datum create_vlabel(PG_FUNCTION_ARGS) errmsg("label name is invalid"))); } + check_reserved_label_name(label_name); + /* Check if graph does not exist */ if (!graph_exists(graph_name)) { @@ -258,6 +261,8 @@ Datum create_elabel(PG_FUNCTION_ARGS) errmsg("label name is invalid"))); } + check_reserved_label_name(label_name); + /* Check if graph does not exist */ if (!graph_exists(graph_name)) { diff --git a/src/backend/parser/cypher_clause.c b/src/backend/parser/cypher_clause.c index 0b7c604f9..feaa40071 100644 --- a/src/backend/parser/cypher_clause.c +++ b/src/backend/parser/cypher_clause.c @@ -183,6 +183,13 @@ static TargetEntry *findTarget(List *targetList, char *resname); static transform_entity *transform_VLE_edge_entity(cypher_parsestate *cpstate, cypher_relationship *rel, Query *query); +static Query *create_union_query(cypher_parsestate *cpstate, + List *relation_oids, Alias *alias); +static ParseNamespaceItem *create_pnsi_for_match(cypher_parsestate *cpstate, + cypher_label_expr *label_expr, + char label_expr_kind, + Alias *alias, + bool valid_label); /* create clause */ static Query *transform_cypher_create(cypher_parsestate *cpstate, cypher_clause *clause); @@ -2333,8 +2340,9 @@ static bool match_check_valid_label(cypher_match *match, node = lfirst(cell2); - if (!label_expr_has_tables(node->label_expr, LABEL_KIND_VERTEX, - cpstate->graph_oid)) + if (!LABEL_EXPR_HAS_RELATIONS(node->label_expr, + LABEL_KIND_VERTEX, + cpstate->graph_oid)) { return false; } @@ -2345,8 +2353,8 @@ static bool match_check_valid_label(cypher_match *match, rel = lfirst(cell2); - if (!label_expr_has_tables(rel->label_expr, LABEL_KIND_EDGE, - cpstate->graph_oid)) + if (!LABEL_EXPR_HAS_RELATIONS(rel->label_expr, LABEL_KIND_EDGE, + cpstate->graph_oid)) { return false; } @@ -3770,24 +3778,6 @@ static A_Expr *filter_vertices_on_label_id(cypher_parsestate *cpstate, Node *id_field, cypher_label_expr *label_expr) { - // TODO: this function neeeds to be updated once label_id columns are arrays. - /* - left array start_label_ids or _extract_label_id = Label IDs the vertex already has - right array filter_label_ids = Label IDs we want to filter - - - - if filter = empty: - add no filter = this is not called for empty filters - else if filter = single: - {filter} <@ {actual label ids} - List * <@ Datum - - - actual label ids are Datum - - filter label ids are (List *) - - - */ A_Const *n; FuncCall *fc; String *ag_catalog, *extract_label_id; @@ -3797,10 +3787,13 @@ static A_Expr *filter_vertices_on_label_id(cypher_parsestate *cpstate, A_ArrayExpr *filter_ids; A_ArrayExpr *empty_array; A_Const *minus_one_const; - char *table_name; + char *relname; - table_name = label_expr_table_name(label_expr, LABEL_KIND_VERTEX); - lcd = search_label_name_graph_cache(table_name, cpstate->graph_oid); + ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("not yet implemented for multiple label"))); + + relname = label_expr_relname(label_expr, LABEL_KIND_VERTEX); + lcd = search_label_name_graph_cache(relname, cpstate->graph_oid); if (lcd) { @@ -4360,8 +4353,8 @@ static bool path_check_valid_label(cypher_path *path, node = lfirst(lc); - if (!label_expr_has_tables(node->label_expr, LABEL_KIND_VERTEX, - cpstate->graph_oid)) + if (!LABEL_EXPR_HAS_RELATIONS(node->label_expr, LABEL_KIND_VERTEX, + cpstate->graph_oid)) { return false; } @@ -4372,8 +4365,8 @@ static bool path_check_valid_label(cypher_path *path, rel = lfirst(lc); - if (!label_expr_has_tables(rel->label_expr, LABEL_KIND_EDGE, - cpstate->graph_oid)) + if (!LABEL_EXPR_HAS_RELATIONS(rel->label_expr, LABEL_KIND_EDGE, + cpstate->graph_oid)) { return false; } @@ -4977,55 +4970,44 @@ static Node *make_qual(cypher_parsestate *cpstate, } /* - * Transforms label expression type OR to a SQL union query. + * Builds a SQL union all query from the relation_oids. * * For example, - * MATCH (:A|B|C) - * is transformed into- + * If relation_oids are for relations A, B and C, + * it builds- * SELECT * FROM ( -- top select stmt * ((SELECT * FROM A) UNION (SELECT * FROM B)) -- left arg * UNION * (SELECT * FROM C); -- right arg * ); */ -static Query *label_expr_union_query(cypher_parsestate *cpstate, - cypher_label_expr *label_expr, - char label_expr_kind) +static Query *create_union_query(cypher_parsestate *cpstate, + List *relation_oids, Alias *alias) { ParseState *pstate; Query *query; SelectStmt *top_select_stmt; ListCell *lc; - Assert(LABEL_EXPR_TYPE(label_expr) == LABEL_EXPR_TYPE_OR); - top_select_stmt = NULL; pstate = (ParseState *)make_parsestate(&cpstate->pstate); - foreach (lc, label_expr->label_names) + foreach (lc, relation_oids) { - char *label_name; + Oid relid; char *schemaname; char *relname; - label_cache_data *lcd; RangeVar *label_rv; SelectStmt *select_stmt; ColumnRef *cr; ResTarget *rt; - label_name = strVal(lfirst(lc)); - - /* ignore labels that does not exist */ - lcd = search_label_name_graph_cache(label_name, cpstate->graph_oid); - if (lcd == NULL || lcd->kind != label_expr_kind) - { - continue; - } - /* make rangevar */ schemaname = get_graph_namespace_name(cpstate->graph_name); - relname = get_label_relation_name(label_name, cpstate->graph_oid); + relid = lfirst_oid(lc); + relname = get_rel_name(relid); label_rv = makeRangeVar(schemaname, relname, -1); + label_rv->alias = copyObject(alias); /* make (SELECT * FROM relname) */ cr = makeNode(ColumnRef); @@ -5062,8 +5044,8 @@ static Query *label_expr_union_query(cypher_parsestate *cpstate, } /* - * top_select_stmt == NULL only when no labels in label_expr - * exists. This function is not called in that case. + * top_select_stmt == NULL only when relation_oids is empty. + * In that case, this function should not be called. */ Assert(top_select_stmt != NULL); @@ -5074,9 +5056,6 @@ static Query *label_expr_union_query(cypher_parsestate *cpstate, /* * Adds a RTE for the `label_expr` in `cpstate` and returns the PNSI. - * - * For invalid label, empty label and single label, the rte is a relation. - * For multiple label, the rte is a subquery. */ static ParseNamespaceItem *create_pnsi_for_match(cypher_parsestate *cpstate, cypher_label_expr *label_expr, @@ -5085,60 +5064,39 @@ static ParseNamespaceItem *create_pnsi_for_match(cypher_parsestate *cpstate, bool valid_label) { ParseState *pstate; - RangeVar *label_rv; ParseNamespaceItem *pnsi; - Query *subquery; - char *schemaname; - char *relname; + List *reloids; pstate = (ParseState *)cpstate; - schemaname = get_graph_namespace_name(cpstate->graph_name); + reloids = get_label_expr_relations(label_expr, label_expr_kind, + cpstate->graph_oid); /* - * For invalid label, although no rows will be output, a pnsi still needs - * to be created in order to construct an empty rte. + * In case label expr is invalid or no relations to scan, although no rows + * will be output, a pnsi still needs to be created in order to construct + * an empty rte. */ - if (!valid_label) + if (!valid_label || list_length(reloids) == 0) { + char *schemaname; + char *relname; + RangeVar *label_rv; + + schemaname = get_graph_namespace_name(cpstate->graph_name); relname = label_expr_kind == LABEL_KIND_VERTEX ? AG_DEFAULT_LABEL_VERTEX : AG_DEFAULT_LABEL_EDGE; label_rv = makeRangeVar(schemaname, relname, -1); pnsi = addRangeTableEntry(pstate, label_rv, alias, label_rv->inh, true); - - return pnsi; } - - switch (LABEL_EXPR_TYPE(label_expr)) + else { - case LABEL_EXPR_TYPE_EMPTY: - case LABEL_EXPR_TYPE_SINGLE: - relname = label_expr_table_name(label_expr, label_expr_kind); - relname = get_label_relation_name(relname, cpstate->graph_oid); + Query *subquery; - label_rv = makeRangeVar(schemaname, relname, -1); - pnsi = addRangeTableEntry(pstate, label_rv, alias, label_rv->inh, - true); - break; - - case LABEL_EXPR_TYPE_OR: - subquery = label_expr_union_query(cpstate, label_expr, - label_expr_kind); + subquery = create_union_query(cpstate, reloids, alias); pnsi = addRangeTableEntryForSubquery(pstate, subquery, alias, false, true); - break; - - case LABEL_EXPR_TYPE_AND: - // TODO: implement - ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("label expression type AND is not implemented"))); - break; - - default: - elog(ERROR, "Unknown label expression type"); - break; } return pnsi; @@ -5159,6 +5117,16 @@ static Expr *transform_cypher_edge(cypher_parsestate *cpstate, bool refs_var = false; ParseNamespaceItem *pnsi = NULL; + if (LABEL_EXPR_TYPE(rel->label_expr) == LABEL_EXPR_TYPE_AND) + { + ereport( + ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg( + "label expression type AND is not allowed for relationships in a MATCH clause"), + parser_errposition((ParseState *)cpstate, rel->location))); + } + /* * If we have an edge name, get any potential variable or column * references. Additionally, verify that they are for edges. @@ -5932,10 +5900,9 @@ transform_create_cypher_edge(cypher_parsestate *cpstate, List **target_list, AttrNumber resno; ParseNamespaceItem *pnsi; char *invalid_label; - char *table_name; + char *relname; - // TODO: Error if not (EMPTY or SINGLE). - // because edges can have zero or one label + check_label_expr_type_for_create(pstate, (Node *)edge); invalid_label = find_first_invalid_label(edge->label_expr, LABEL_KIND_EDGE, cpstate->graph_oid); @@ -5948,7 +5915,7 @@ transform_create_cypher_edge(cypher_parsestate *cpstate, List **target_list, parser_errposition(pstate, edge->location))); } - table_name = label_expr_table_name(edge->label_expr, LABEL_KIND_EDGE); + relname = label_expr_relname(edge->label_expr, LABEL_KIND_EDGE); rel->type = LABEL_KIND_EDGE; rel->flags = CYPHER_TARGET_NODE_FLAG_INSERT; @@ -6004,21 +5971,11 @@ transform_create_cypher_edge(cypher_parsestate *cpstate, List **target_list, parser_errposition(&cpstate->pstate, edge->location))); } - /* create the label entry if it does not exist */ - if (!label_exists(table_name, cpstate->graph_oid)) - { - List *parent; - - rv = get_label_range_var(cpstate->graph_name, cpstate->graph_oid, - AG_DEFAULT_LABEL_EDGE); - - parent = list_make1(rv); - - create_label(cpstate->graph_name, table_name, LABEL_TYPE_EDGE, parent); - } + create_label_expr_relations(cpstate->graph_oid, cpstate->graph_name, + edge->label_expr, LABEL_KIND_EDGE); /* lock the relation of the label */ - rv = makeRangeVar(cpstate->graph_name, table_name, -1); + rv = makeRangeVar(cpstate->graph_name, relname, -1); label_relation = parserOpenTable(&cpstate->pstate, rv, RowExclusiveLock); /* Store the relid */ @@ -6259,35 +6216,25 @@ transform_create_cypher_new_node(cypher_parsestate *cpstate, char *alias; int resno; ParseNamespaceItem *pnsi; - char *table_name; + char *relname; + + check_label_expr_type_for_create(pstate, (Node *)node); rel->type = LABEL_KIND_VERTEX; rel->tuple_position = InvalidAttrNumber; rel->variable_name = NULL; rel->resultRelInfo = NULL; - // TODO: error if OR - - table_name = label_expr_table_name(node->label_expr, LABEL_KIND_VERTEX); + relname = label_expr_relname(node->label_expr, LABEL_KIND_VERTEX); rel->label_expr = node->label_expr; - /* create the label entry if it does not exist */ - if (!label_exists(table_name, cpstate->graph_oid)) - { - List *parent; - - rv = get_label_range_var(cpstate->graph_name, cpstate->graph_oid, - AG_DEFAULT_LABEL_VERTEX); - - parent = list_make1(rv); - - create_label(cpstate->graph_name, table_name, LABEL_TYPE_VERTEX, - parent); - } + /* create the label entry */ + create_label_expr_relations(cpstate->graph_oid, cpstate->graph_name, + node->label_expr, LABEL_KIND_VERTEX); rel->flags = CYPHER_TARGET_NODE_FLAG_INSERT; - rv = makeRangeVar(cpstate->graph_name, table_name, -1); + rv = makeRangeVar(cpstate->graph_name, relname, -1); label_relation = parserOpenTable(&cpstate->pstate, rv, RowExclusiveLock); /* Store the relid */ @@ -7307,7 +7254,9 @@ transform_merge_cypher_edge(cypher_parsestate *cpstate, List **target_list, RangeVar *rv; RTEPermissionInfo *rte_pi; ParseNamespaceItem *pnsi; - char *table_name; + char *relname; + + check_label_expr_type_for_create(pstate, (Node *)edge); if (edge->name != NULL) { @@ -7331,8 +7280,6 @@ transform_merge_cypher_edge(cypher_parsestate *cpstate, List **target_list, edge->name = get_next_default_alias(cpstate); } - // TODO: error if OR - rel->type = LABEL_KIND_EDGE; /* all edges are marked with insert */ @@ -7351,28 +7298,13 @@ transform_merge_cypher_edge(cypher_parsestate *cpstate, List **target_list, parser_errposition(&cpstate->pstate, edge->location))); } - table_name = label_expr_table_name(edge->label_expr, LABEL_KIND_EDGE); + relname = label_expr_relname(edge->label_expr, LABEL_KIND_EDGE); - /* check to see if the label exists, create the label entry if it does not. */ - if (table_name && !label_exists(table_name, cpstate->graph_oid)) - { - List *parent; - /* - * setup the default edge table as the parent table, that we - * will inherit from. - */ - rv = get_label_range_var(cpstate->graph_name, cpstate->graph_oid, - AG_DEFAULT_LABEL_EDGE); - - parent = list_make1(rv); - - /* create the label */ - create_label(cpstate->graph_name, table_name, LABEL_TYPE_EDGE, - parent); - } + create_label_expr_relations(cpstate->graph_oid, cpstate->graph_name, + edge->label_expr, LABEL_KIND_EDGE); /* lock the relation of the label */ - rv = makeRangeVar(cpstate->graph_name, table_name, -1); + rv = makeRangeVar(cpstate->graph_name, relname, -1); label_relation = parserOpenTable(&cpstate->pstate, rv, RowExclusiveLock); /* @@ -7426,7 +7358,9 @@ transform_merge_cypher_node(cypher_parsestate *cpstate, List **target_list, RangeVar *rv; RTEPermissionInfo *rte_pi; ParseNamespaceItem *pnsi; - char *table_name; + char *relname; + + check_label_expr_type_for_create((ParseState *)cpstate, (Node *)node); if (node->name != NULL) { @@ -7475,33 +7409,15 @@ transform_merge_cypher_node(cypher_parsestate *cpstate, List **target_list, rel->variable_name = node->name; rel->resultRelInfo = NULL; - // TODO: error if OR - - table_name = label_expr_table_name(node->label_expr, LABEL_KIND_VERTEX); + relname = label_expr_relname(node->label_expr, LABEL_KIND_VERTEX); rel->label_expr = node->label_expr; - /* check to see if the label exists, create the label entry if it does not. */ - if (table_name && !label_exists(table_name, cpstate->graph_oid)) - { - List *parent; - - /* - * setup the default vertex table as the parent table, that we - * will inherit from. - */ - rv = get_label_range_var(cpstate->graph_name, cpstate->graph_oid, - AG_DEFAULT_LABEL_VERTEX); - - parent = list_make1(rv); - - /* create the label */ - create_label(cpstate->graph_name, table_name, LABEL_TYPE_VERTEX, - parent); - } + create_label_expr_relations(cpstate->graph_oid, cpstate->graph_name, + node->label_expr, LABEL_KIND_VERTEX); rel->flags |= CYPHER_TARGET_NODE_FLAG_INSERT; - rv = makeRangeVar(cpstate->graph_name, table_name, -1); + rv = makeRangeVar(cpstate->graph_name, relname, -1); label_relation = parserOpenTable(&cpstate->pstate, rv, RowExclusiveLock); /* diff --git a/src/backend/parser/cypher_gram.y b/src/backend/parser/cypher_gram.y index 0dc79fe8f..92f170a07 100644 --- a/src/backend/parser/cypher_gram.y +++ b/src/backend/parser/cypher_gram.y @@ -1528,7 +1528,30 @@ label_expr_non_empty: default: ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("Cannot mix different label expressions"), + errmsg("cannot mix different label expressions"), + ag_scanner_errposition(@2, scanner))); + } + + $$ = (Node *) n; + } + /* and expression */ + | label_expr_non_empty ':' label_name + { + cypher_label_expr *n = (cypher_label_expr *)$1; + + switch (n->type) + { + case LABEL_EXPR_TYPE_SINGLE: + n->type = LABEL_EXPR_TYPE_AND; + n->label_names = list_append_unique(n->label_names, makeString($3)); + break; + case LABEL_EXPR_TYPE_AND: + n->label_names = list_append_unique(n->label_names, makeString($3)); + break; + default: + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("cannot mix different label expressions"), ag_scanner_errposition(@2, scanner))); } @@ -2402,6 +2425,10 @@ var_name_opt: label_name: schema_name + { + check_reserved_label_name($1); + $$ = $1; + } ; symbolic_name: diff --git a/src/backend/parser/cypher_label_expr.c b/src/backend/parser/cypher_label_expr.c index 05eb548b8..f829bf5bf 100644 --- a/src/backend/parser/cypher_label_expr.c +++ b/src/backend/parser/cypher_label_expr.c @@ -1,16 +1,324 @@ +#include "postgres.h" + +#include "access/genam.h" +#include "access/heapam.h" +#include "utils/builtins.h" +#include "utils/inval.h" +#include "utils/lsyscache.h" + #include "catalog/ag_label.h" #include "commands/label_commands.h" #include "nodes/cypher_nodes.h" +#include "parser/cypher_label_expr.h" +#include "parser/cypher_transform_entity.h" #include "utils/ag_cache.h" -#include "parser/cypher_label_expr.h" +static void append_to_allrelations(Relation ag_label, char *label_name, + char *intr_relname, Oid graphoid); + +/* + * Creates ag_label entries and relations required for the given `label_expr` + * if does not exists. + * + * The label_expr may represent empty, single or multiple labels. For empty + * (default labels) and single label, a relation is created and an ag_label + * entry is added for that label. In the ag_label entry, the newly created + * relation is pointed by the ag_label.relation column. This is the primary + * relation for that label. All entities that has exactly that one label (not + * any other labels), are stored in that label's ag_label.relation. This + * concept is not new, but an additional concept is needed for multiple labels, + * which is explained below. + * + * For multiple labels, only label expression type AND is supported in the + * context of create and merge. For example, CREATE (:a:b). The expression :a:b + * represents intersection of the label a and b. To avoid duplicating an entity + * into both a and b's relation, it will be stored in an 'intersection + * relation.' So, an intersection relation is created for :a:b and an ag_label + * entry is added. Although an intersection relation is not a label, it is + * treated like a label. The reason is explained later below. Next, for each + * individual labels (i.e. a and b), their relations and ag_label entries are + * created if does not exist already. Then, the intersection relation is + * appended to each individual label's ag_label.allrelations column. The + * allrelation column of a label represents all relations containing entities + * that has at least that label among other labels. This column serves its + * purpose for the MATCH clause. See the get_label_expr_relations function. + * + * Now, the reason for treating an intersection relation as a label is due to + * the fact that an entity ID has its label ID encoded in it. So, entities with + * multiple labels need to have multiple label ID encoded in the ID. The other + * option is just encoding its intersection relation's label id (since it is + * being treated as a label, it has a label ID). The latter option is easier to + * implement. + */ +void create_label_expr_relations(Oid graphoid, char *graphname, + cypher_label_expr *label_expr, + char label_expr_kind) +{ + List *parents; + char *ag_label_relation; + + Assert(LABEL_EXPR_TYPE(label_expr) != LABEL_EXPR_TYPE_OR); + + /* set default labels as parent unless it is the default label itself */ + if (LABEL_EXPR_TYPE(label_expr) == LABEL_EXPR_TYPE_EMPTY) + { + parents = NIL; + } + else + { + char *parent_label_name; + RangeVar *parent_rv; + + parent_label_name = label_expr_kind == LABEL_KIND_VERTEX ? + AG_DEFAULT_LABEL_VERTEX : + AG_DEFAULT_LABEL_EDGE; + parent_rv = get_label_range_var(graphname, graphoid, parent_label_name); + parents = list_make1(parent_rv); + } + + /* + * Content for the column: ag_label.relation. For empty and single labels, + * this is a primary relation. For multiple labels (AND expr), this is the + * intersection relation name. Note that, although intersection relations + * are not labels, they have ag_label entries where the relation column + * holds the intersection relation name. + */ + ag_label_relation = label_expr_relname(label_expr, label_expr_kind); + + /* + * If the relation exists, it can be assumed that all required ag_label + * entries and relations also exists. + */ + if (ag_relation_exists(ag_label_relation, graphoid)) + { + return; + } + + /* this function creates ag_label entry and relation */ + create_label(graphname, ag_label_relation, label_expr_kind, parents); + + /* + * For multiple labels (AND expression), processes each individual labels + * as described above. + */ + if (LABEL_EXPR_TYPE(label_expr) == LABEL_EXPR_TYPE_AND) + { + ListCell *lc; + Relation ag_label; + + Assert(list_length(label_expr->label_names) > 1); + + ag_label = table_open(ag_label_relation_id(), RowShareLock); + + foreach (lc, label_expr->label_names) + { + char *label_name; + + label_name = strVal(lfirst(lc)); + + if (!label_exists(label_name, graphoid)) + { + create_label(graphname, label_name, label_expr_kind, parents); + } + + /* + * appends intersection relation name the individual label's + * allrelations column + */ + append_to_allrelations(ag_label, label_name, ag_label_relation, + graphoid); + } + table_close(ag_label, NoLock); + + /* signals to rebuild the ag_label cache */ + CacheInvalidateRelcacheAll(); + CommandCounterIncrement(); + } +} + +/* + * Helper function for `create_label_expr_relations`. Appends intersection + * relation name to label_name's ag_label.allrelations column. + * + * `ag_label` must an opened table. + * + * UPDATE ag_label + * SET ag_label.allrelations = ag_label.allrelations || `intr_relname` + * WHERE name = `label_name`; + */ +static void append_to_allrelations(Relation ag_label, char *label_name, + char *intr_relname, Oid graphoid) +{ + SysScanDesc ag_label_scan; + Name label_name_data; + ScanKey skeys; + TupleDesc ag_label_tupdesc; + HeapTuple ag_label_tup; + bool isNull; + Datum intr_relid; + Datum lhs_arraycat; + Datum rhs_arraycat; + Datum res_arraycat; + HeapTuple new_ag_label_tup; + int replCols; + bool replIsNull; + + /* gets ag_label tuple for name=label_name */ + ag_label_tupdesc = RelationGetDescr(ag_label); + label_name_data = (NameData *)palloc(sizeof(NameData)); + namestrcpy(label_name_data, label_name); + + skeys = (ScanKeyData *)palloc(sizeof(ScanKeyData) * 2); + ScanKeyInit(&skeys[0], Anum_ag_label_name, BTEqualStrategyNumber, F_NAMEEQ, + NameGetDatum(label_name_data)); + ScanKeyInit(&skeys[1], Anum_ag_label_graph, BTEqualStrategyNumber, + F_INT4EQ, ObjectIdGetDatum(graphoid)); + + ag_label_scan = systable_beginscan( + ag_label, ag_label_name_graph_index_id(), true, NULL, 2, skeys); + ag_label_tup = systable_getnext(ag_label_scan); + Assert(HeapTupleIsValid(ag_label_tup)); + + /* creates new datum for the allrelations column */ + lhs_arraycat = heap_getattr(ag_label_tup, Anum_ag_label_allrelations, + ag_label_tupdesc, &isNull); + Assert(!isNull); + intr_relid = ObjectIdGetDatum(get_relname_relid(intr_relname, graphoid)); + rhs_arraycat = PointerGetDatum( + construct_array(&intr_relid, 1, REGCLASSOID, 4, true, TYPALIGN_INT)); + res_arraycat = DirectFunctionCall2(array_cat, lhs_arraycat, rhs_arraycat); + + /* update tuple */ + replCols = Anum_ag_label_allrelations; + replIsNull = false; + new_ag_label_tup = + heap_modify_tuple_by_cols(ag_label_tup, ag_label_tupdesc, 1, &replCols, + &res_arraycat, &replIsNull); + simple_heap_update(ag_label, &ag_label_tup->t_data->t_ctid, + new_ag_label_tup); + CommandCounterIncrement(); + systable_endscan(ag_label_scan); +} + +/* + * Returns a list of relations (as OIDs) that are MATCHed by the given + * `label_expr`. It may return empty list (NIL) in case no relations to scan. + * + * MATCH's transformation function uses the returned list of relations to build + * a chain of union-all subquery. The subquery contains the entities + * represented by the given label_expr. + * + * The list of relations is built from ag_label.allrelations column (accessed + * via cache). This column represents all relations that belong to a label. For + * each label in the label_expr, the contents of allrelations column are + * combined depending on the type of label_expr. + */ +List *get_label_expr_relations(cypher_label_expr *label_expr, + char label_expr_kind, Oid graph_oid) +{ + cypher_label_expr_type label_expr_type = LABEL_EXPR_TYPE(label_expr); + char *label_name; + label_cache_data *lcd; + + switch (label_expr_type) + { + case LABEL_EXPR_TYPE_EMPTY: + label_name = label_expr_kind == LABEL_KIND_VERTEX ? + AG_DEFAULT_LABEL_VERTEX : + AG_DEFAULT_LABEL_EDGE; + lcd = search_label_name_graph_cache(label_name, graph_oid); + Assert(lcd); + + return list_copy(lcd->allrelations); + + case LABEL_EXPR_TYPE_SINGLE: + label_name = strVal(linitial(label_expr->label_names)); + lcd = search_label_name_graph_cache(label_name, graph_oid); + + if (!lcd || lcd->kind != label_expr_kind) + { + return NIL; + } + + return list_copy(lcd->allrelations); + + case LABEL_EXPR_TYPE_AND: + case LABEL_EXPR_TYPE_OR: + List *reloids; + List *(*merge_lists)(List *, const List *); + ListCell *lc; + + reloids = NIL; + + /* + * This function pointer describes how to combine two lists of relation + * oids. + * + * For AND, uses intersection. + * MATCH (:A:B) -> intersection of allrelations of A and B. + * To scan only common relations of A and B. + * + * For OR, uses concat (similar to union). + * MATCH (:A|B) -> union of allrelations of A and B. + * To scan all relations of A and B. + */ + merge_lists = label_expr_type == LABEL_EXPR_TYPE_AND ? + &list_intersection_oid : + &list_concat_unique_oid; + + foreach (lc, label_expr->label_names) + { + label_name = strVal(lfirst(lc)); + lcd = search_label_name_graph_cache(label_name, graph_oid); + + /* if some label_name does not exist in cache */ + if (!lcd || lcd->kind != label_expr_kind) + { + if (label_expr_type == LABEL_EXPR_TYPE_AND) + { + /* for AND, no relation to scan */ + return NIL; + } + else + { + /* for OR, skip that label */ + continue; + } + } + + /* if first iteration */ + if (list_length(reloids) == 0) + { + reloids = list_copy(lcd->allrelations); + continue; + } + else + { + /* + * "Merges" lcd->allrelations into reloids. + * + * At the end of the loop, reloids is a result of all labels' + * allrelations merged together using the merge_list funciton. + * For example, for OR, reloids is a result of a chain of + * union. + */ + reloids = merge_lists(reloids, lcd->allrelations); + } + } + return reloids; + + default: + elog(ERROR, "invalid cypher_label_expr type"); + return NIL; + } +} /* - * Returns the first label in label_expr that exists in the cache and is not - * of type label_kind. + * Returns the first label in label_expr that exists but not the same kind as + * `label_expr_kind`. * * This is a helper function to check if all labels in label_expr are valid in - * kind, during node\edge creation. + * kind during node\edge creation. */ char *find_first_invalid_label(cypher_label_expr *label_expr, char label_expr_kind, Oid graph_oid) @@ -34,48 +342,51 @@ char *find_first_invalid_label(cypher_label_expr *label_expr, return NULL; } -// TODO: can be moved to utils? /* - * List comparator for String nodes. The ListCells a and b must - * contain node pointer of type T_String. - */ -int list_string_cmp(const ListCell *a, const ListCell *b) -{ - Node *na = lfirst(a); - Node *nb = lfirst(b); - - Assert(IsA(na, String)); - Assert(IsA(nb, String)); - - return strcmp(strVal(na), strVal(nb)); -} - -/* - * Generates table name for label_expr. It does not check if a table exists - * for that name. The caller must do existence check before using the table. - * This function is not applicable for LABEL_EXPR_TYPE_OR. + * Generates relation name for label_expr. It does not check if the relation + * exists for that name. The caller must do existence check before using the + * table. This function is not applicable for LABEL_EXPR_TYPE_OR. */ -char *label_expr_table_name(cypher_label_expr *label_expr, - char label_expr_kind) +char *label_expr_relname(cypher_label_expr *label_expr, char label_expr_kind) { switch (label_expr->type) { case LABEL_EXPR_TYPE_EMPTY: + /* returns default label names */ return label_expr_kind == LABEL_KIND_VERTEX ? AG_DEFAULT_LABEL_VERTEX : AG_DEFAULT_LABEL_EDGE; case LABEL_EXPR_TYPE_SINGLE: + /* returns the first label's name */ + Assert(list_length(label_expr->label_names) == 1); return (char *)strVal(linitial(label_expr->label_names)); case LABEL_EXPR_TYPE_AND: - // TODO: implement - ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("label expression type AND is not implemented"))); - return NULL; + /* + * generates a name for intersection relation + * i.e. for CREATE (:A:B:C), _agr_ABC + */ + StringInfo relname_strinfo; + ListCell *lc; + char *relname; + + Assert(list_length(label_expr->label_names) > 1); + + relname_strinfo = makeStringInfo(); + appendStringInfoString(relname_strinfo, INTR_REL_PREFIX); + + foreach (lc, label_expr->label_names) + { + char *label_name = strVal(lfirst(lc)); + appendStringInfoString(relname_strinfo, label_name); + } + + relname = relname_strinfo->data; + pfree(relname_strinfo); + + return relname; case LABEL_EXPR_TYPE_OR: - // TODO: implement elog(ERROR, "label expression type OR cannot have a table"); return NULL; @@ -85,7 +396,9 @@ char *label_expr_table_name(cypher_label_expr *label_expr, } } -// TODO: whenever a new field is added, update this one. +/* + * Returns if two label expressions are equal. + */ bool label_expr_are_equal(cypher_label_expr *le1, cypher_label_expr *le2) { ListCell *lc1; @@ -96,10 +409,6 @@ bool label_expr_are_equal(cypher_label_expr *le1, cypher_label_expr *le2) return true; } - /** - * If exactly one is null, return false. - * TODO: should null be allowed? - */ if ((le1 == NULL && le2 != NULL) || (le2 == NULL && le1 != NULL)) { return false; @@ -133,44 +442,139 @@ bool label_expr_are_equal(cypher_label_expr *le1, cypher_label_expr *le2) } /* - * Returns true if there is at least one table to be scanned for this - * label_expr. + * Checks unsupported label expression type in CREATE\MERGE clause and reports + * error. * - * This helper function is used in the MATCH clause transformation. + * This is used in CREATE and MERGE's transformation. */ -bool label_expr_has_tables(cypher_label_expr *label_expr, char label_expr_kind, - Oid graph_oid) +void check_label_expr_type_for_create(ParseState *pstate, Node *entity) { - char *table_name; - label_cache_data *lcd; - ListCell *lc; + cypher_label_expr *label_expr; + int location; + char label_expr_kind; + char *variable_name; - switch (label_expr->type) + if (is_ag_node(entity, cypher_node)) { - case LABEL_EXPR_TYPE_EMPTY: - return true; + cypher_node *node = (cypher_node *)entity; + label_expr = node->label_expr; + location = node->location; + label_expr_kind = LABEL_KIND_VERTEX; + variable_name = node->name; + } + else if (is_ag_node(entity, cypher_relationship)) + { + cypher_relationship *rel = (cypher_relationship *)entity; + label_expr = rel->label_expr; + location = rel->location; + label_expr_kind = LABEL_KIND_EDGE; + variable_name = rel->name; + } + else + { + ereport(ERROR, + (errmsg_internal("unrecognized node in create pattern"))); + } - case LABEL_EXPR_TYPE_SINGLE: - case LABEL_EXPR_TYPE_AND: - table_name = label_expr_table_name(label_expr, label_expr_kind); - lcd = search_label_name_graph_cache(table_name, graph_oid); - return (lcd != NULL && lcd->kind == label_expr_kind); + /* + * If the entity has a variable which was declared in a previous clause, + * then skip the check since the check has been done already. + */ + if (variable_name && + find_variable((cypher_parsestate *)pstate, variable_name)) + { + return; + } - case LABEL_EXPR_TYPE_OR: - foreach (lc, label_expr->label_names) - { - table_name = strVal(lfirst(lc)); - lcd = search_label_name_graph_cache(table_name, graph_oid); + /* + * In a CREATE\MERGE clause, following types are allowed- + * for vertices: empty, single, and + * for edges : single + */ + if (LABEL_EXPR_TYPE(label_expr) == LABEL_EXPR_TYPE_OR) + { + ereport( + ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg( + "label expression type OR is not allowed in a CREATE\\MERGE clause"), + parser_errposition(pstate, location))); + } - if (lcd != NULL && lcd->kind == label_expr_kind) - { - return true; - } - } - return false; + if (label_expr_kind == LABEL_KIND_EDGE && + LABEL_EXPR_TYPE(label_expr) != LABEL_EXPR_TYPE_SINGLE) + { + ereport( + ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg( + "relationships must have exactly one label in a CREATE\\MERGE clause"), + parser_errposition(pstate, location))); + } - default: - elog(ERROR, "invalid cypher_label_expr type"); - return false; + return; +} + +/* + * Reports an error if the given `label_name` or part of it is reserved. + */ +void check_reserved_label_name(char *label_name) +{ + /* prevents label names with same prefix as INTR_REL_PREFIX */ + if (strncmp(label_name, INTR_REL_PREFIX, INTR_REL_PREFIX_LEN) == 0) + { + ereport( + ERROR, + (errcode(ERRCODE_RESERVED_NAME), + errmsg("label names cannot start with the reserved word: \"%s\"", + INTR_REL_PREFIX))); + } + + return; +} + +/* + * This code is borrowed from Postgres' list_intersection for pointers since it + * does not implement an intersection function for OIDs. Use of non-public + * functions and macros are commented out. + */ +List *list_intersection_oid(List *list1, const List *list2) +{ + List *result; + const ListCell *cell; + + if (list1 == NIL || list2 == NIL) + { + return NIL; + } + + // Assert(IsOidList(list1)); + // Assert(IsOidList(list2)); + + result = NIL; + foreach (cell, list1) + { + if (list_member_oid(list2, lfirst_oid(cell))) + { + result = lappend_oid(result, lfirst_oid(cell)); + } } + + // check_list_invariants(result); + return result; +} + +/* + * List comparator for String nodes. The ListCells a and b must + * contain Node pointer of type T_String. + */ +int list_string_cmp(const ListCell *a, const ListCell *b) +{ + Node *na = lfirst(a); + Node *nb = lfirst(b); + + Assert(IsA(na, String)); + Assert(IsA(nb, String)); + + return strcmp(strVal(na), strVal(nb)); } diff --git a/src/backend/utils/cache/ag_cache.c b/src/backend/utils/cache/ag_cache.c index e3c4d0794..6fb566926 100644 --- a/src/backend/utils/cache/ag_cache.c +++ b/src/backend/utils/cache/ag_cache.c @@ -500,7 +500,7 @@ static void initialize_label_caches(void) /* ag_label.relation */ ag_cache_scan_key_init(&label_relation_scan_keys[0], Anum_ag_label_relation, F_OIDEQ); - + /* ag_label.seq_name, ag_label.graph */ ag_cache_scan_key_init(&label_seq_name_graph_scan_keys[0], Anum_ag_label_seq_name, F_NAMEEQ); @@ -619,6 +619,11 @@ static void invalidate_label_caches(Datum arg, Oid relid) invalidate_label_graph_oid_cache(relid); invalidate_label_relation_cache(relid); invalidate_label_seq_name_graph_cache(relid); + + // TODO: this is a temporary fix to cache being + // corrupted after invalidation by create_label_expr_relations + label_relation_cache_hash = NULL; + create_label_relation_cache(); } else { @@ -626,6 +631,11 @@ static void invalidate_label_caches(Datum arg, Oid relid) flush_label_graph_oid_cache(); flush_label_relation_cache(); flush_label_seq_name_graph_cache(); + + // TODO: this is a temporary fix to cache being + // corrupted after invalidation by create_label_expr_relations + label_relation_cache_hash = NULL; + create_label_relation_cache(); } } @@ -1156,6 +1166,11 @@ static void fill_label_cache_data(label_cache_data *cache_data, bool is_null; Datum value; Name name; + MemoryContext oldctx; + Oid *allrelations_oids; + ArrayType *allrelations_arr; + int allrelations_len; + int i; /* ag_label.name */ value = heap_getattr(tuple, Anum_ag_label_name, tuple_desc, &is_null); @@ -1183,4 +1198,19 @@ static void fill_label_cache_data(label_cache_data *cache_data, value = heap_getattr(tuple, Anum_ag_label_seq_name, tuple_desc, &is_null); Assert(!is_null); namestrcpy(&cache_data->seq_name, DatumGetName(value)->data); + // ag_label.allrelations + value = heap_getattr(tuple, Anum_ag_label_allrelations, tuple_desc, &is_null); + Assert(!is_null); + allrelations_arr = DatumGetArrayTypeP(value); + allrelations_len = ArrayGetNItems(ARR_NDIM(allrelations_arr), + ARR_DIMS(allrelations_arr)); + allrelations_oids = (Oid *) ARR_DATA_PTR(allrelations_arr); + cache_data->allrelations = NIL; + oldctx = MemoryContextSwitchTo(CacheMemoryContext); + for (i = 0; i < allrelations_len; i++) + { + cache_data->allrelations = lappend_oid(cache_data->allrelations, + allrelations_oids[i]); + } + MemoryContextSwitchTo(oldctx); } diff --git a/src/include/catalog/ag_label.h b/src/include/catalog/ag_label.h index 0a8480b1a..b373de947 100644 --- a/src/include/catalog/ag_label.h +++ b/src/include/catalog/ag_label.h @@ -46,9 +46,10 @@ #define Anum_ag_label_kind 4 #define Anum_ag_label_relation 5 #define Anum_ag_label_seq_name 6 +#define Anum_ag_label_allrelations 7 -#define Natts_ag_label 6 +#define Natts_ag_label 7 #define ag_label_relation_id() ag_relation_id("ag_label", "table") #define ag_label_name_graph_index_id() \ @@ -85,4 +86,7 @@ List *get_all_edge_labels_per_graph(EState *estate, Oid graph_oid); #define label_exists(label_name, label_graph) \ OidIsValid(get_label_id(label_name, label_graph)) +#define ag_relation_exists(relname, graphoid) \ + label_exists((relname), (graphoid)) + #endif diff --git a/src/include/nodes/cypher_nodes.h b/src/include/nodes/cypher_nodes.h index bf87caf04..e3c605aa3 100644 --- a/src/include/nodes/cypher_nodes.h +++ b/src/include/nodes/cypher_nodes.h @@ -153,11 +153,29 @@ typedef enum } cypher_label_expr_type; /* - * Represents label expressions. + * Represents a label expression. A label expression is either single label, + * multiple labels or no label at all. See `cypher_label_expr_type` for + * examples. * - * Note: There is a comparator function for this type- label_expr_are_equal. - * If any new fields are added, the comparator function should be updated if - * necessary. + * Label expressions are mainly used in a cypher path. Cypher clauses that + * deals with paths have to deal with label expressions as well. Different + * clauses process label expressions differently. + * + * To see how CREATE and MERGE clause use label expressions to store entities, + * refer to- + * create_label_expr_relations() + * + * To see how the MATCH clause uses label expressions to build queries, refer + * to- + * get_label_expr_relations() + * + * For now, SET and REMOVE clause does not deal with label expressions. + * + * Additional notes: + * ----------------- + * There is a comparator function for this struct defined in + * cypher_label_expr.c. If new fields are added to it, that function may need + * to be updated. */ typedef struct cypher_label_expr { diff --git a/src/include/parser/cypher_label_expr.h b/src/include/parser/cypher_label_expr.h index 60d3bdb1c..43a88613e 100644 --- a/src/include/parser/cypher_label_expr.h +++ b/src/include/parser/cypher_label_expr.h @@ -23,24 +23,46 @@ #include "postgres.h" #include "nodes/cypher_nodes.h" -#define FIRST_LABEL_NAME(label_expr) \ - (list_length((label_expr)->label_names) == 0) ? \ - NULL : \ - linitial((label_expr)->label_names) +/* + * Functions and macros associated with the cypher node: cypher_label_expr + * defined in cypher_nodes.h. + * + * Most functions that takes cypher_label_expr as an argument also takes a + * char type argument `label_expr_kind`. It tells whether the label_expr + * belongs to a cypher_node or a cypher_relationship. It does not say anything + * about the actual type of any label in the ag_label catalog. + */ + +/* Prefix for intersection relations. */ +#define INTR_REL_PREFIX "_agr_" +#define INTR_REL_PREFIX_LEN 5 -// TODO: more readable name LABEL_EXPR_HAS_LABEL returning the oppposite? #define LABEL_EXPR_LENGTH(label_expr) (list_length((label_expr)->label_names)) -#define LABEL_EXPR_IS_EMPTY(label_expr) \ - (LABEL_EXPR_TYPE((label_expr)) == LABEL_EXPR_TYPE_EMPTY) // TODO: maybe redundant to LABEL_EXPR_TYPE + #define LABEL_EXPR_TYPE(label_expr) \ ((label_expr) ? (label_expr)->type : LABEL_EXPR_TYPE_EMPTY) +#define LABEL_EXPR_IS_EMPTY(label_expr) \ + (LABEL_EXPR_TYPE((label_expr)) == LABEL_EXPR_TYPE_EMPTY) + +#define LABEL_EXPR_HAS_RELATIONS(label_expr, label_expr_kind, graph_oid) \ + (list_length(get_label_expr_relations((label_expr), (label_expr_kind), \ + (graph_oid))) > 0) + +void create_label_expr_relations(Oid graphoid, char *graphname, + cypher_label_expr *label_expr, + char label_expr_kind); +List *get_label_expr_relations(cypher_label_expr *label_expr, + char label_expr_kind, Oid graph_oid); + char *find_first_invalid_label(cypher_label_expr *label_expr, char label_expr_kind, Oid graph_oid); -int list_string_cmp(const ListCell *a, const ListCell *b); -char *label_expr_table_name(cypher_label_expr *label_expr, char label_expr_kind); +char *label_expr_relname(cypher_label_expr *label_expr, char label_expr_kind); bool label_expr_are_equal(cypher_label_expr *le1, cypher_label_expr *le2); -bool label_expr_has_tables(cypher_label_expr *label_expr, char label_expr_kind, - Oid graph_oid); +void check_label_expr_type_for_create(ParseState *pstate, Node *entity); +void check_reserved_label_name(char *label_name); + +List *list_intersection_oid(List *list1, const List *list2); +int list_string_cmp(const ListCell *a, const ListCell *b); #endif diff --git a/src/include/utils/ag_cache.h b/src/include/utils/ag_cache.h index 0e2c3a91f..215e01d09 100644 --- a/src/include/utils/ag_cache.h +++ b/src/include/utils/ag_cache.h @@ -37,6 +37,7 @@ typedef struct label_cache_data char kind; Oid relation; NameData seq_name; + List *allrelations; } label_cache_data; /* callers of these functions must not modify the returned struct */ From 1a702a91d7f51b0317955e2c414a81ccf6b9b26a Mon Sep 17 00:00:00 2001 From: Rafsun Masud Date: Mon, 4 Dec 2023 12:53:33 -0800 Subject: [PATCH 05/13] Update vertex object builders to support multiple labels The logic for building vertex objects is updated. Agtype vertex objects can be built from either a single label (as a cstring) or multiple labels (as an agtype array). The following functions are updated to reflect this- agtype_typecast_vertex, agtype_in and _agtype_build_vertex. if _agtype_build_vertex is called from SQL, its label argument must be explicitly cast to avoid ambiguity in function overload. The `_label_names` function is added to extract label names from a vertex ID as a list of string. It is used as a helper function to build vertex objects. A new cache called `allrelations` is also added. This is used by _label_names to search for all labels that are related to a given relation. Multiple helper functions are added to extract label infromation from an entity ID. For example, entity's relation ID, relation name, label names. These are used by CREATE, DELETE, MERGE, VLE and SET executors for building a vertex's object or updating its relation. All test files are updated to show the label field as an array in the output. In all test SQLs, _agtype_build_vertex's label argument is explicity cast. --- regress/expected/age_global_graph.out | 72 +- regress/expected/agtype.out | 479 ++++++++----- regress/expected/analyze.out | 4 +- regress/expected/cypher_call.out | 16 +- regress/expected/cypher_create.out | 254 +++---- regress/expected/cypher_delete.out | 256 +++---- regress/expected/cypher_match.out | 862 +++++++++++------------ regress/expected/cypher_merge.out | 262 +++---- regress/expected/cypher_remove.out | 424 +++++------ regress/expected/cypher_set.out | 800 ++++++++++----------- regress/expected/cypher_union.out | 24 +- regress/expected/cypher_unwind.out | 26 +- regress/expected/cypher_vle.out | 234 +++--- regress/expected/cypher_with.out | 44 +- regress/expected/expr.out | 722 +++++++++---------- regress/expected/index.out | 66 +- regress/expected/jsonb_operators.out | 72 +- regress/expected/multiple_label.out | 251 ++++++- regress/sql/agtype.sql | 193 +++-- regress/sql/multiple_label.sql | 51 +- sql/age_agtype.sql | 7 + sql/age_main.sql | 11 + sql/agtype_graphid.sql | 10 +- src/backend/catalog/ag_label.c | 84 ++- src/backend/commands/graph_commands.c | 8 +- src/backend/commands/label_commands.c | 10 +- src/backend/executor/cypher_create.c | 8 +- src/backend/executor/cypher_delete.c | 10 +- src/backend/executor/cypher_merge.c | 8 +- src/backend/executor/cypher_set.c | 22 +- src/backend/parser/cypher_clause.c | 4 +- src/backend/parser/cypher_label_expr.c | 23 +- src/backend/utils/adt/age_global_graph.c | 2 +- src/backend/utils/adt/age_vle.c | 9 +- src/backend/utils/adt/agtype.c | 180 ++++- src/backend/utils/cache/ag_cache.c | 214 ++++++ src/include/catalog/ag_label.h | 19 +- src/include/commands/label_commands.h | 2 +- src/include/utils/ag_cache.h | 2 + src/include/utils/agtype.h | 2 +- 40 files changed, 3330 insertions(+), 2417 deletions(-) diff --git a/regress/expected/age_global_graph.out b/regress/expected/age_global_graph.out index f2d9b059f..e0ed26a1d 100644 --- a/regress/expected/age_global_graph.out +++ b/regress/expected/age_global_graph.out @@ -12,9 +12,9 @@ NOTICE: graph "ag_graph_1" has been created (1 row) SELECT * FROM cypher('ag_graph_1', $$ CREATE (v:vertex1) RETURN v $$) AS (v agtype); - v ------------------------------------------------------------------------ - {"id": 844424930131969, "label": "vertex1", "properties": {}}::vertex + v +------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["vertex1"], "properties": {}}::vertex (1 row) SELECT * FROM create_graph('ag_graph_2'); @@ -25,9 +25,9 @@ NOTICE: graph "ag_graph_2" has been created (1 row) SELECT * FROM cypher('ag_graph_2', $$ CREATE (v:vertex2) RETURN v $$) AS (v agtype); - v ------------------------------------------------------------------------ - {"id": 844424930131969, "label": "vertex2", "properties": {}}::vertex + v +------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["vertex2"], "properties": {}}::vertex (1 row) SELECT * FROM create_graph('ag_graph_3'); @@ -38,28 +38,28 @@ NOTICE: graph "ag_graph_3" has been created (1 row) SELECT * FROM cypher('ag_graph_3', $$ CREATE (v:vertex3) RETURN v $$) AS (v agtype); - v ------------------------------------------------------------------------ - {"id": 844424930131969, "label": "vertex3", "properties": {}}::vertex + v +------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["vertex3"], "properties": {}}::vertex (1 row) -- load contexts using the vertex_stats command SELECT * FROM cypher('ag_graph_3', $$ MATCH (u) RETURN vertex_stats(u) $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "vertex3", "in_degree": 0, "out_degree": 0, "self_loops": 0} + result +------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["vertex3"], "in_degree": 0, "out_degree": 0, "self_loops": 0} (1 row) SELECT * FROM cypher('ag_graph_2', $$ MATCH (u) RETURN vertex_stats(u) $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "vertex2", "in_degree": 0, "out_degree": 0, "self_loops": 0} + result +------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["vertex2"], "in_degree": 0, "out_degree": 0, "self_loops": 0} (1 row) SELECT * FROM cypher('ag_graph_1', $$ MATCH (u) RETURN vertex_stats(u) $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "vertex1", "in_degree": 0, "out_degree": 0, "self_loops": 0} + result +------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["vertex1"], "in_degree": 0, "out_degree": 0, "self_loops": 0} (1 row) --- loading undefined contexts @@ -131,21 +131,21 @@ LINE 1: SELECT * FROM cypher('ag_graph_4', $$ RETURN delete_global_g... -- -- load contexts again SELECT * FROM cypher('ag_graph_3', $$ MATCH (u) RETURN vertex_stats(u) $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "vertex3", "in_degree": 0, "out_degree": 0, "self_loops": 0} + result +------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["vertex3"], "in_degree": 0, "out_degree": 0, "self_loops": 0} (1 row) SELECT * FROM cypher('ag_graph_2', $$ MATCH (u) RETURN vertex_stats(u) $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "vertex2", "in_degree": 0, "out_degree": 0, "self_loops": 0} + result +------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["vertex2"], "in_degree": 0, "out_degree": 0, "self_loops": 0} (1 row) SELECT * FROM cypher('ag_graph_1', $$ MATCH (u) RETURN vertex_stats(u) $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "vertex1", "in_degree": 0, "out_degree": 0, "self_loops": 0} + result +------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["vertex1"], "in_degree": 0, "out_degree": 0, "self_loops": 0} (1 row) -- delete all graph contexts @@ -201,19 +201,19 @@ SELECT * FROM cypher('ag_graph_2', $$ MATCH (a:Person), (b:Person) WHERE a.name --checking if vertex stats have been updated along with the new label --should return 3 vertices SELECT * FROM cypher('ag_graph_1', $$ MATCH (n) RETURN vertex_stats(n) $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------ - {"id": 281474976710657, "label": "", "in_degree": 0, "out_degree": 0, "self_loops": 0} - {"id": 281474976710658, "label": "", "in_degree": 0, "out_degree": 0, "self_loops": 0} - {"id": 844424930131969, "label": "vertex1", "in_degree": 0, "out_degree": 0, "self_loops": 0} + result +------------------------------------------------------------------------------------------------- + {"id": 281474976710657, "label": [], "in_degree": 0, "out_degree": 0, "self_loops": 0} + {"id": 281474976710658, "label": [], "in_degree": 0, "out_degree": 0, "self_loops": 0} + {"id": 844424930131969, "label": ["vertex1"], "in_degree": 0, "out_degree": 0, "self_loops": 0} (3 rows) --should return 1 vertice and 1 label SELECT * FROM cypher('ag_graph_2', $$ MATCH (a) RETURN vertex_stats(a) $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "vertex2", "in_degree": 0, "out_degree": 0, "self_loops": 0} - {"id": 1125899906842625, "label": "Person", "in_degree": 0, "out_degree": 0, "self_loops": 0} + result +------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["vertex2"], "in_degree": 0, "out_degree": 0, "self_loops": 0} + {"id": 1125899906842625, "label": ["Person"], "in_degree": 0, "out_degree": 0, "self_loops": 0} (2 rows) -- diff --git a/regress/expected/agtype.out b/regress/expected/agtype.out index d4a577c00..4f39484ae 100644 --- a/regress/expected/agtype.out +++ b/regress/expected/agtype.out @@ -1069,15 +1069,15 @@ SELECT 'null'::agtype - '1'; ERROR: Invalid input parameter types for agtype_sub SELECT 'null'::agtype - '[1]'; ERROR: must be object or array, not a scalar value -SELECT '{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype - '"a"'; +SELECT '{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype - '"a"'; ERROR: Invalid input parameter types for agtype_sub -SELECT '{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype - '["a"]'; +SELECT '{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype - '["a"]'; ERROR: must be object or array, not a scalar value -SELECT '{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype - '[1]'; +SELECT '{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype - '[1]'; ERROR: must be object or array, not a scalar value SELECT '{"id": 1688849860263951, "label": "e_var", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {"id": 0}}::edge'::agtype - '{"id": 1688849860263951, "label": "e_var", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {"id": 0}}::edge'::agtype; ERROR: Invalid input parameter types for agtype_sub -SELECT '{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype - '[]'; +SELECT '{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype - '[]'; ERROR: must be object or array, not a scalar value -- -- Test operator + for extended functionality @@ -1118,16 +1118,16 @@ SELECT '["b", 2, {"d": 4}]'::agtype + '{"a":1 , "b":2, "c":3}'::agtype; ["b", 2, {"d": 4}, {"a": 1, "b": 2, "c": 3}] (1 row) -SELECT '{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype + '[1]'; - ?column? ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex, 1] +SELECT '{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype + '[1]'; + ?column? +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex, 1] (1 row) -SELECT '{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex'::agtype + '[1, "e", true]'; - ?column? --------------------------------------------------------------------------------------------------------------------------- - [{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex, 1, "e", true] +SELECT '{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex'::agtype + '[1, "e", true]'; + ?column? +---------------------------------------------------------------------------------------------------------------------------- + [{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex, 1, "e", true] (1 row) SELECT '[]'::agtype + '{}'; @@ -1178,28 +1178,28 @@ SELECT '1'::agtype + '[{"a":1 , "b":2, "c":3}]'::agtype; [1, {"a": 1, "b": 2, "c": 3}] (1 row) -SELECT '{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex'::agtype + '{"d": 4}'; - ?column? ----------------------------------------------------------------------------------------------------------------------- - [{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex, {"d": 4}] +SELECT '{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex'::agtype + '{"d": 4}'; + ?column? +------------------------------------------------------------------------------------------------------------------------ + [{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex, {"d": 4}] (1 row) -SELECT '{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex'::agtype + '{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex'::agtype; - ?column? ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex, {"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex] +SELECT '{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex'::agtype + '{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex'::agtype; + ?column? +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex, {"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex] (1 row) -SELECT '[{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex]::path'::agtype + ' [{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex]::path'::agtype; - ?column? --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [[{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex]::path, [{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex]::path] +SELECT '[{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex]::path'::agtype + ' [{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex]::path'::agtype; + ?column? +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [[{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex]::path, [{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex]::path] (1 row) -SELECT '[{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex]::path'::agtype + '{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype; - ?column? ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [[{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex]::path, {"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex] +SELECT '[{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex]::path'::agtype + '{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype; + ?column? +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + [[{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex]::path, {"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex] (1 row) SELECT '{"id": 1688849860263951, "label": "e_var", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {"id": 0}}::edge'::agtype + '{"id": 1688849860263951, "label": "e_var", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {"id": 0}}::edge'::agtype; @@ -1208,10 +1208,10 @@ SELECT '{"id": 1688849860263951, "label": "e_var", "end_id": 281474976710664, "s [{"id": 1688849860263951, "label": "e_var", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {"id": 0}}::edge, {"id": 1688849860263951, "label": "e_var", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {"id": 0}}::edge] (1 row) -SELECT '{"id": 1688849860263951, "label": "e_var", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {"id": 0}}::edge'::agtype + '{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex'::agtype; - ?column? ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - [{"id": 1688849860263951, "label": "e_var", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {"id": 0}}::edge, {"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex] +SELECT '{"id": 1688849860263951, "label": "e_var", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {"id": 0}}::edge'::agtype + '{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex'::agtype; + ?column? +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 1688849860263951, "label": "e_var", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {"id": 0}}::edge, {"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex] (1 row) -- errors out @@ -2118,19 +2118,19 @@ SELECT agtype_in('{"bool":true, "integer":1}') < agtype_in('{"bool":true, "integ t (1 row) -SELECT agtype_in('{"id":0, "label": "v", "properties":{"i":0}}::vertex') < agtype_in('{"bool":true, "i":0}'); +SELECT agtype_in('{"id":0, "label": ["v"], "properties":{"i":0}}::vertex') < agtype_in('{"bool":true, "i":0}'); ?column? ---------- t (1 row) -SELECT agtype_in('{"id":2, "start_id":0, "end_id":1, "label": "e", "properties":{"i":0}}::edge') < agtype_in('{"id":0, "label": "v", "properties":{"i":0}}::vertex'); +SELECT agtype_in('{"id":2, "start_id":0, "end_id":1, "label": "e", "properties":{"i":0}}::edge') < agtype_in('{"id":0, "label": ["v"], "properties":{"i":0}}::vertex'); ?column? ---------- t (1 row) -SELECT agtype_in('[{"id": 0, "label": "v", "properties": {"i": 0}}::vertex, {"id": 2, "start_id": 0, "end_id": 1, "label": "e", "properties": {"i": 0}}::edge, {"id": 1, "label": "v", "properties": {"i": 0}}::vertex]::path') < agtype_in('{"id":2, "start_id":0, "end_id":1, "label": "e", "properties":{"i":0}}::edge'); +SELECT agtype_in('[{"id": 0, "label": ["v"], "properties": {"i": 0}}::vertex, {"id": 2, "start_id": 0, "end_id": 1, "label": "e", "properties": {"i": 0}}::edge, {"id": 1, "label": ["v"], "properties": {"i": 0}}::vertex]::path') < agtype_in('{"id":2, "start_id":0, "end_id":1, "label": "e", "properties":{"i":0}}::edge'); ?column? ---------- t @@ -2156,45 +2156,45 @@ NOTICE: graph "orderability_graph" has been created (1 row) -SELECT * FROM cypher('orderability_graph', $$ CREATE (:vertex {prop: null}), (:vertex {prop: 1}), (:vertex {prop: 1.01}),(:vertex {prop: true}), (:vertex {prop:"string"}),(:vertex {prop:"string_2"}), (:vertex {prop:[1, 2, 3]}), (:vertex {prop:[1, 2, 3, 4, 5]}), (:vertex {prop:{bool:true, i:0}}), (:vertex {prop:{bool:true, i:null}}), (:vertex {prop: {id:0, label: "v", properties:{i:0}}::vertex}), (:vertex {prop: {id: 2, start_id: 0, end_id: 1, label: "e", properties: {i: 0}}::edge}), (:vertex {prop: [{id: 0, label: "v", properties: {i: 0}}::vertex, {id: 2, start_id: 0, end_id: 1, label: "e", properties: {i: 0}}::edge, {id: 1, label: "v", properties: {i: 0}}::vertex]::path}) $$) AS (x agtype); +SELECT * FROM cypher('orderability_graph', $$ CREATE (:vertex {prop: null}), (:vertex {prop: 1}), (:vertex {prop: 1.01}),(:vertex {prop: true}), (:vertex {prop:"string"}),(:vertex {prop:"string_2"}), (:vertex {prop:[1, 2, 3]}), (:vertex {prop:[1, 2, 3, 4, 5]}), (:vertex {prop:{bool:true, i:0}}), (:vertex {prop:{bool:true, i:null}}), (:vertex {prop: {id:0, label: ["v"], properties:{i:0}}::vertex}), (:vertex {prop: {id: 2, start_id: 0, end_id: 1, label: "e", properties: {i: 0}}::edge}), (:vertex {prop: [{id: 0, label: ["v"], properties: {i: 0}}::vertex, {id: 2, start_id: 0, end_id: 1, label: "e", properties: {i: 0}}::edge, {id: 1, label: ["v"], properties: {i: 0}}::vertex]::path}) $$) AS (x agtype); x --- (0 rows) SELECT * FROM cypher('orderability_graph', $$ MATCH (n) RETURN n ORDER BY n.prop $$) AS (sorted agtype); - sorted ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - {"id": 844424930131981, "label": "vertex", "properties": {"prop": [{"id": 0, "label": "v", "properties": {"i": 0}}::vertex, {"id": 2, "label": "e", "end_id": 1, "start_id": 0, "properties": {"i": 0}}::edge, {"id": 1, "label": "v", "properties": {"i": 0}}::vertex]::path}}::vertex - {"id": 844424930131980, "label": "vertex", "properties": {"prop": {"id": 2, "label": "e", "end_id": 1, "start_id": 0, "properties": {"i": 0}}::edge}}::vertex - {"id": 844424930131979, "label": "vertex", "properties": {"prop": {"id": 0, "label": "v", "properties": {"i": 0}}::vertex}}::vertex - {"id": 844424930131978, "label": "vertex", "properties": {"prop": {"bool": true}}}::vertex - {"id": 844424930131977, "label": "vertex", "properties": {"prop": {"i": 0, "bool": true}}}::vertex - {"id": 844424930131975, "label": "vertex", "properties": {"prop": [1, 2, 3]}}::vertex - {"id": 844424930131976, "label": "vertex", "properties": {"prop": [1, 2, 3, 4, 5]}}::vertex - {"id": 844424930131973, "label": "vertex", "properties": {"prop": "string"}}::vertex - {"id": 844424930131974, "label": "vertex", "properties": {"prop": "string_2"}}::vertex - {"id": 844424930131972, "label": "vertex", "properties": {"prop": true}}::vertex - {"id": 844424930131970, "label": "vertex", "properties": {"prop": 1}}::vertex - {"id": 844424930131971, "label": "vertex", "properties": {"prop": 1.01}}::vertex - {"id": 844424930131969, "label": "vertex", "properties": {}}::vertex + sorted +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131981, "label": ["vertex"], "properties": {"prop": [{"id": 0, "label": ["v"], "properties": {"i": 0}}::vertex, {"id": 2, "label": "e", "end_id": 1, "start_id": 0, "properties": {"i": 0}}::edge, {"id": 1, "label": ["v"], "properties": {"i": 0}}::vertex]::path}}::vertex + {"id": 844424930131980, "label": ["vertex"], "properties": {"prop": {"id": 2, "label": "e", "end_id": 1, "start_id": 0, "properties": {"i": 0}}::edge}}::vertex + {"id": 844424930131979, "label": ["vertex"], "properties": {"prop": {"id": 0, "label": ["v"], "properties": {"i": 0}}::vertex}}::vertex + {"id": 844424930131978, "label": ["vertex"], "properties": {"prop": {"bool": true}}}::vertex + {"id": 844424930131977, "label": ["vertex"], "properties": {"prop": {"i": 0, "bool": true}}}::vertex + {"id": 844424930131975, "label": ["vertex"], "properties": {"prop": [1, 2, 3]}}::vertex + {"id": 844424930131976, "label": ["vertex"], "properties": {"prop": [1, 2, 3, 4, 5]}}::vertex + {"id": 844424930131973, "label": ["vertex"], "properties": {"prop": "string"}}::vertex + {"id": 844424930131974, "label": ["vertex"], "properties": {"prop": "string_2"}}::vertex + {"id": 844424930131972, "label": ["vertex"], "properties": {"prop": true}}::vertex + {"id": 844424930131970, "label": ["vertex"], "properties": {"prop": 1}}::vertex + {"id": 844424930131971, "label": ["vertex"], "properties": {"prop": 1.01}}::vertex + {"id": 844424930131969, "label": ["vertex"], "properties": {}}::vertex (13 rows) SELECT * FROM cypher('orderability_graph', $$ MATCH (n) RETURN n ORDER BY n.prop DESC $$) AS (sorted agtype); - sorted ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "vertex", "properties": {}}::vertex - {"id": 844424930131971, "label": "vertex", "properties": {"prop": 1.01}}::vertex - {"id": 844424930131970, "label": "vertex", "properties": {"prop": 1}}::vertex - {"id": 844424930131972, "label": "vertex", "properties": {"prop": true}}::vertex - {"id": 844424930131974, "label": "vertex", "properties": {"prop": "string_2"}}::vertex - {"id": 844424930131973, "label": "vertex", "properties": {"prop": "string"}}::vertex - {"id": 844424930131976, "label": "vertex", "properties": {"prop": [1, 2, 3, 4, 5]}}::vertex - {"id": 844424930131975, "label": "vertex", "properties": {"prop": [1, 2, 3]}}::vertex - {"id": 844424930131977, "label": "vertex", "properties": {"prop": {"i": 0, "bool": true}}}::vertex - {"id": 844424930131978, "label": "vertex", "properties": {"prop": {"bool": true}}}::vertex - {"id": 844424930131979, "label": "vertex", "properties": {"prop": {"id": 0, "label": "v", "properties": {"i": 0}}::vertex}}::vertex - {"id": 844424930131980, "label": "vertex", "properties": {"prop": {"id": 2, "label": "e", "end_id": 1, "start_id": 0, "properties": {"i": 0}}::edge}}::vertex - {"id": 844424930131981, "label": "vertex", "properties": {"prop": [{"id": 0, "label": "v", "properties": {"i": 0}}::vertex, {"id": 2, "label": "e", "end_id": 1, "start_id": 0, "properties": {"i": 0}}::edge, {"id": 1, "label": "v", "properties": {"i": 0}}::vertex]::path}}::vertex + sorted +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["vertex"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["vertex"], "properties": {"prop": 1.01}}::vertex + {"id": 844424930131970, "label": ["vertex"], "properties": {"prop": 1}}::vertex + {"id": 844424930131972, "label": ["vertex"], "properties": {"prop": true}}::vertex + {"id": 844424930131974, "label": ["vertex"], "properties": {"prop": "string_2"}}::vertex + {"id": 844424930131973, "label": ["vertex"], "properties": {"prop": "string"}}::vertex + {"id": 844424930131976, "label": ["vertex"], "properties": {"prop": [1, 2, 3, 4, 5]}}::vertex + {"id": 844424930131975, "label": ["vertex"], "properties": {"prop": [1, 2, 3]}}::vertex + {"id": 844424930131977, "label": ["vertex"], "properties": {"prop": {"i": 0, "bool": true}}}::vertex + {"id": 844424930131978, "label": ["vertex"], "properties": {"prop": {"bool": true}}}::vertex + {"id": 844424930131979, "label": ["vertex"], "properties": {"prop": {"id": 0, "label": ["v"], "properties": {"i": 0}}::vertex}}::vertex + {"id": 844424930131980, "label": ["vertex"], "properties": {"prop": {"id": 2, "label": "e", "end_id": 1, "start_id": 0, "properties": {"i": 0}}::edge}}::vertex + {"id": 844424930131981, "label": ["vertex"], "properties": {"prop": [{"id": 0, "label": ["v"], "properties": {"i": 0}}::vertex, {"id": 2, "label": "e", "end_id": 1, "start_id": 0, "properties": {"i": 0}}::edge, {"id": 1, "label": ["v"], "properties": {"i": 0}}::vertex]::path}}::vertex (13 rows) SELECT * FROM drop_graph('orderability_graph', true); @@ -3210,31 +3210,31 @@ NOTICE: graph "agtype_null_duplicate_test" has been created SELECT * FROM cypher('agtype_null_duplicate_test', $$ CREATE (a { a:NULL, b:'bb', c:'cc', d:'dd' }) RETURN a $$) AS (a agtype); a ----------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"b": "bb", "c": "cc", "d": "dd"}}::vertex + {"id": 281474976710657, "label": [], "properties": {"b": "bb", "c": "cc", "d": "dd"}}::vertex (1 row) SELECT * FROM cypher('agtype_null_duplicate_test', $$ CREATE (a { a:'aa', b:'bb', c:'cc', d:'dd' }) RETURN a $$) AS (a agtype); a ---------------------------------------------------------------------------------------------------------- - {"id": 281474976710658, "label": "", "properties": {"a": "aa", "b": "bb", "c": "cc", "d": "dd"}}::vertex + {"id": 281474976710658, "label": [], "properties": {"a": "aa", "b": "bb", "c": "cc", "d": "dd"}}::vertex (1 row) SELECT * FROM cypher('agtype_null_duplicate_test', $$ CREATE (a { a:'aa', b:'bb', b:NULL , d:NULL }) RETURN a $$) AS (a agtype); a ------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"a": "aa"}}::vertex + {"id": 281474976710659, "label": [], "properties": {"a": "aa"}}::vertex (1 row) SELECT * FROM cypher('agtype_null_duplicate_test', $$ CREATE (a { a:'aa', b:'bb', b:'xx', d:NULL }) RETURN a $$) AS (a agtype); a ------------------------------------------------------------------------------------ - {"id": 281474976710660, "label": "", "properties": {"a": "aa", "b": "xx"}}::vertex + {"id": 281474976710660, "label": [], "properties": {"a": "aa", "b": "xx"}}::vertex (1 row) SELECT * FROM cypher('agtype_null_duplicate_test', $$ CREATE (a { a:NULL }) RETURN a $$) AS (a agtype); a ---------------------------------------------------------------- - {"id": 281474976710661, "label": "", "properties": {}}::vertex + {"id": 281474976710661, "label": [], "properties": {}}::vertex (1 row) SELECT * FROM drop_graph('agtype_null_duplicate_test', true); @@ -3251,74 +3251,74 @@ NOTICE: graph "agtype_null_duplicate_test" has been dropped -- Vertex -- --Basic Vertex Creation -SELECT _agtype_build_vertex('1'::graphid, $$label_name$$, agtype_build_map()); - _agtype_build_vertex ------------------------------------------------------------- - {"id": 1, "label": "label_name", "properties": {}}::vertex -(1 row) - -SELECT _agtype_build_vertex('1'::graphid, $$label$$, agtype_build_map('id', 2)); +SELECT _agtype_build_vertex('1'::graphid, $$label_name$$::cstring, agtype_build_map()); _agtype_build_vertex -------------------------------------------------------------- - {"id": 1, "label": "label", "properties": {"id": 2}}::vertex + {"id": 1, "label": ["label_name"], "properties": {}}::vertex +(1 row) + +SELECT _agtype_build_vertex('1'::graphid, $$label$$::cstring, agtype_build_map('id', 2)); + _agtype_build_vertex +---------------------------------------------------------------- + {"id": 1, "label": ["label"], "properties": {"id": 2}}::vertex (1 row) --Null properties -SELECT _agtype_build_vertex('1'::graphid, $$label_name$$, NULL); - _agtype_build_vertex ------------------------------------------------------------- - {"id": 1, "label": "label_name", "properties": {}}::vertex +SELECT _agtype_build_vertex('1'::graphid, $$label_name$$::cstring, NULL); + _agtype_build_vertex +-------------------------------------------------------------- + {"id": 1, "label": ["label_name"], "properties": {}}::vertex (1 row) --Test access operator -SELECT agtype_access_operator(_agtype_build_vertex('1'::graphid, $$label$$, +SELECT agtype_access_operator(_agtype_build_vertex('1'::graphid, $$label$$::cstring, agtype_build_map('id', 2)), '"id"'); agtype_access_operator ------------------------ 2 (1 row) -SELECT _agtype_build_vertex('1'::graphid, $$label$$, agtype_build_list()); +SELECT _agtype_build_vertex('1'::graphid, $$label$$::cstring, agtype_build_list()); ERROR: _agtype_build_vertex() properties argument must be an object --Vertex in a map SELECT agtype_build_map( 'vertex', - _agtype_build_vertex('1'::graphid, $$label_name$$, agtype_build_map())); - agtype_build_map ------------------------------------------------------------------------- - {"vertex": {"id": 1, "label": "label_name", "properties": {}}::vertex} + _agtype_build_vertex('1'::graphid, $$label_name$$::cstring, agtype_build_map())); + agtype_build_map +-------------------------------------------------------------------------- + {"vertex": {"id": 1, "label": ["label_name"], "properties": {}}::vertex} (1 row) SELECT agtype_access_operator( agtype_build_map( - 'vertex', _agtype_build_vertex('1'::graphid, $$label_name$$, + 'vertex', _agtype_build_vertex('1'::graphid, $$label_name$$::cstring, agtype_build_map('key', 'value')), - 'other_vertex', _agtype_build_vertex('1'::graphid, $$label_name$$, + 'other_vertex', _agtype_build_vertex('1'::graphid, $$label_name$$::cstring, agtype_build_map('key', 'other_value'))), '"vertex"'); - agtype_access_operator --------------------------------------------------------------------------- - {"id": 1, "label": "label_name", "properties": {"key": "value"}}::vertex + agtype_access_operator +---------------------------------------------------------------------------- + {"id": 1, "label": ["label_name"], "properties": {"key": "value"}}::vertex (1 row) --Vertex in a list SELECT agtype_build_list( - _agtype_build_vertex('1'::graphid, $$label_name$$, agtype_build_map()), - _agtype_build_vertex('2'::graphid, $$label_name$$, agtype_build_map())); - agtype_build_list --------------------------------------------------------------------------------------------------------------------------- - [{"id": 1, "label": "label_name", "properties": {}}::vertex, {"id": 2, "label": "label_name", "properties": {}}::vertex] + _agtype_build_vertex('1'::graphid, $$label_name$$::cstring, agtype_build_map()), + _agtype_build_vertex('2'::graphid, $$label_name$$::cstring, agtype_build_map())); + agtype_build_list +------------------------------------------------------------------------------------------------------------------------------ + [{"id": 1, "label": ["label_name"], "properties": {}}::vertex, {"id": 2, "label": ["label_name"], "properties": {}}::vertex] (1 row) SELECT agtype_access_operator( agtype_build_list( - _agtype_build_vertex('1'::graphid, $$label_name$$, + _agtype_build_vertex('1'::graphid, $$label_name$$::cstring, agtype_build_map('id', 3)), - _agtype_build_vertex('2'::graphid, $$label_name$$, + _agtype_build_vertex('2'::graphid, $$label_name$$::cstring, agtype_build_map('id', 4))), '0'); - agtype_access_operator -------------------------------------------------------------------- - {"id": 1, "label": "label_name", "properties": {"id": 3}}::vertex + agtype_access_operator +--------------------------------------------------------------------- + {"id": 1, "label": ["label_name"], "properties": {"id": 3}}::vertex (1 row) -- @@ -3326,14 +3326,14 @@ SELECT agtype_access_operator( -- --Basic Edge Creation SELECT _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label_name$$, agtype_build_map()); + $$label_name$$::cstring, agtype_build_map()); _agtype_build_edge -------------------------------------------------------------------------------------- {"id": 1, "label": "label_name", "end_id": 3, "start_id": 2, "properties": {}}::edge (1 row) SELECT _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label$$, agtype_build_map('id', 2)); + $$label$$::cstring, agtype_build_map('id', 2)); _agtype_build_edge ---------------------------------------------------------------------------------------- {"id": 1, "label": "label", "end_id": 3, "start_id": 2, "properties": {"id": 2}}::edge @@ -3341,7 +3341,7 @@ SELECT _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, --Null properties SELECT _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label_name$$, NULL); + $$label_name$$::cstring, NULL); _agtype_build_edge -------------------------------------------------------------------------------------- {"id": 1, "label": "label_name", "end_id": 3, "start_id": 2, "properties": {}}::edge @@ -3349,7 +3349,7 @@ SELECT _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, --Test access operator SELECT agtype_access_operator(_agtype_build_edge('1'::graphid, '2'::graphid, - '3'::graphid, $$label$$, agtype_build_map('id', 2)),'"id"'); + '3'::graphid, $$label$$::cstring, agtype_build_map('id', 2)),'"id"'); agtype_access_operator ------------------------ 2 @@ -3359,7 +3359,7 @@ SELECT agtype_access_operator(_agtype_build_edge('1'::graphid, '2'::graphid, SELECT agtype_build_map( 'edge', _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label_name$$, agtype_build_map())); + $$label_name$$::cstring, agtype_build_map())); agtype_build_map ------------------------------------------------------------------------------------------------ {"edge": {"id": 1, "label": "label_name", "end_id": 3, "start_id": 2, "properties": {}}::edge} @@ -3368,9 +3368,9 @@ SELECT agtype_build_map( SELECT agtype_access_operator( agtype_build_map( 'edge', _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label_name$$, agtype_build_map('key', 'value')), + $$label_name$$::cstring, agtype_build_map('key', 'value')), 'other_edge', _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label_name$$, agtype_build_map('key', 'other_value'))), + $$label_name$$::cstring, agtype_build_map('key', 'other_value'))), '"edge"'); agtype_access_operator ---------------------------------------------------------------------------------------------------- @@ -3380,9 +3380,9 @@ SELECT agtype_access_operator( --Edge in a list SELECT agtype_build_list( _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label_name$$, agtype_build_map()), + $$label_name$$::cstring, agtype_build_map()), _agtype_build_edge('2'::graphid, '2'::graphid, '3'::graphid, - $$label_name$$, agtype_build_map())); + $$label_name$$::cstring, agtype_build_map())); agtype_build_list ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ [{"id": 1, "label": "label_name", "end_id": 3, "start_id": 2, "properties": {}}::edge, {"id": 2, "label": "label_name", "end_id": 3, "start_id": 2, "properties": {}}::edge] @@ -3390,9 +3390,9 @@ SELECT agtype_build_list( SELECT agtype_access_operator( agtype_build_list( - _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, $$label_name$$, + _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, $$label_name$$::cstring, agtype_build_map('id', 3)), - _agtype_build_edge('2'::graphid, '2'::graphid, '3'::graphid, $$label_name$$, + _agtype_build_edge('2'::graphid, '2'::graphid, '3'::graphid, $$label_name$$::cstring, agtype_build_map('id', 4))), '0'); agtype_access_operator --------------------------------------------------------------------------------------------- @@ -3401,90 +3401,90 @@ SELECT agtype_access_operator( -- Path SELECT _agtype_build_path( - _agtype_build_vertex('2'::graphid, $$label_name$$, agtype_build_map()), + _agtype_build_vertex('2'::graphid, $$label_name$$::cstring, agtype_build_map()), _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label$$, agtype_build_map('id', 2)), - _agtype_build_vertex('3'::graphid, $$label_name$$, agtype_build_map()) + $$label$$::cstring, agtype_build_map('id', 2)), + _agtype_build_vertex('3'::graphid, $$label_name$$::cstring, agtype_build_map()) ); - _agtype_build_path ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 2, "label": "label_name", "properties": {}}::vertex, {"id": 1, "label": "label", "end_id": 3, "start_id": 2, "properties": {"id": 2}}::edge, {"id": 3, "label": "label_name", "properties": {}}::vertex]::path + _agtype_build_path +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 2, "label": ["label_name"], "properties": {}}::vertex, {"id": 1, "label": "label", "end_id": 3, "start_id": 2, "properties": {"id": 2}}::edge, {"id": 3, "label": ["label_name"], "properties": {}}::vertex]::path (1 row) --All these paths should produce Errors SELECT _agtype_build_path( - _agtype_build_vertex('2'::graphid, $$label_name$$, agtype_build_map()), + _agtype_build_vertex('2'::graphid, $$label_name$$::cstring, agtype_build_map()), _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label$$, agtype_build_map('id', 2)) + $$label$$::cstring, agtype_build_map('id', 2)) ); ERROR: a path is of the form: [vertex, (edge, vertex)*i] where i >= 0 SELECT _agtype_build_path( - _agtype_build_vertex('2'::graphid, $$label_name$$, agtype_build_map()), + _agtype_build_vertex('2'::graphid, $$label_name$$::cstring, agtype_build_map()), _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label$$, agtype_build_map('id', 2)), - _agtype_build_vertex('3'::graphid, $$label_name$$, agtype_build_map()), + $$label$$::cstring, agtype_build_map('id', 2)), + _agtype_build_vertex('3'::graphid, $$label_name$$::cstring, agtype_build_map()), _agtype_build_edge('1'::graphid, '4'::graphid, '5'::graphid, - $$label$$, agtype_build_map('id', 2)) + $$label$$::cstring, agtype_build_map('id', 2)) ); ERROR: a path is of the form: [vertex, (edge, vertex)*i] where i >= 0 SELECT _agtype_build_path( - _agtype_build_vertex('2'::graphid, $$label_name$$, agtype_build_map()), + _agtype_build_vertex('2'::graphid, $$label_name$$::cstring, agtype_build_map()), _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label$$, agtype_build_map('id', 2)), + $$label$$::cstring, agtype_build_map('id', 2)), NULL ); ERROR: argument 3 must not be null SELECT _agtype_build_path( - _agtype_build_vertex('2'::graphid, $$label_name$$, agtype_build_map()), + _agtype_build_vertex('2'::graphid, $$label_name$$::cstring, agtype_build_map()), _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label$$, agtype_build_map('id', 2)), + $$label$$::cstring, agtype_build_map('id', 2)), 1 ); ERROR: argument 3 must be an agtype SELECT _agtype_build_path( - _agtype_build_vertex('2'::graphid, $$label_name$$, agtype_build_map()), + _agtype_build_vertex('2'::graphid, $$label_name$$::cstring, agtype_build_map()), _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label$$, agtype_build_map('id', 2)), + $$label$$::cstring, agtype_build_map('id', 2)), _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label$$, agtype_build_map('id', 2)) + $$label$$::cstring, agtype_build_map('id', 2)) ); ERROR: paths consist of alternating vertices and edges HINT: argument 3 must be an vertex -- -- id, startid, endid -- -SELECT age_id(_agtype_build_vertex('1'::graphid, $$label_name$$, agtype_build_map())); +SELECT age_id(_agtype_build_vertex('1'::graphid, $$label_name$$::cstring, agtype_build_map())); age_id -------- 1 (1 row) SELECT age_id(_agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label_name$$, agtype_build_map('id', 2))); + $$label_name$$::cstring, agtype_build_map('id', 2))); age_id -------- 1 (1 row) SELECT age_start_id(_agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label_name$$, agtype_build_map('id', 2))); + $$label_name$$::cstring, agtype_build_map('id', 2))); age_start_id -------------- 2 (1 row) SELECT age_end_id(_agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label_name$$, agtype_build_map('id', 2))); + $$label_name$$::cstring, agtype_build_map('id', 2))); age_end_id ------------ 3 (1 row) SELECT age_id(_agtype_build_path( - _agtype_build_vertex('2'::graphid, $$label_name$$, agtype_build_map()), + _agtype_build_vertex('2'::graphid, $$label_name$$::cstring, agtype_build_map()), _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label$$, agtype_build_map('id', 2)), - _agtype_build_vertex('3'::graphid, $$label$$, agtype_build_map('id', 2)) + $$label$$::cstring, agtype_build_map('id', 2)), + _agtype_build_vertex('3'::graphid, $$label$$::cstring, agtype_build_map('id', 2)) )); ERROR: id() argument must be a vertex, an edge or null SELECT age_id(agtype_in('1')); @@ -3577,6 +3577,169 @@ SELECT agtype_string_match_contains('"abcdefghijklmnopqrstuvwxyz"', '"hijl"'); false (1 row) +--Agtype Hash Comparison Function +SELECT agtype_hash_cmp(NULL); + agtype_hash_cmp +----------------- + 0 +(1 row) + +SELECT agtype_hash_cmp('1'::agtype); + agtype_hash_cmp +----------------- + -123017199 +(1 row) + +SELECT agtype_hash_cmp('1.0'::agtype); + agtype_hash_cmp +----------------- + 614780178 +(1 row) + +SELECT agtype_hash_cmp('"1"'::agtype); + agtype_hash_cmp +----------------- + -888576106 +(1 row) + +SELECT agtype_hash_cmp('[1]'::agtype); + agtype_hash_cmp +----------------- + 434414509 +(1 row) + +SELECT agtype_hash_cmp('[1, 1]'::agtype); + agtype_hash_cmp +----------------- + -1551022880 +(1 row) + +SELECT agtype_hash_cmp('[1, 1, 1]'::agtype); + agtype_hash_cmp +----------------- + -3900769 +(1 row) + +SELECT agtype_hash_cmp('[1, 1, 1, 1]'::agtype); + agtype_hash_cmp +----------------- + 1756986519 +(1 row) + +SELECT agtype_hash_cmp('[1, 1, 1, 1, 1]'::agtype); + agtype_hash_cmp +----------------- + -47741579 +(1 row) + +SELECT agtype_hash_cmp('[[1]]'::agtype); + agtype_hash_cmp +----------------- + 878744030 +(1 row) + +SELECT agtype_hash_cmp('[[1, 1]]'::agtype); + agtype_hash_cmp +----------------- + -1254522284 +(1 row) + +SELECT agtype_hash_cmp('[[1], 1]'::agtype); + agtype_hash_cmp +----------------- + -1005036 +(1 row) + +SELECT agtype_hash_cmp('[1543872]'::agtype); + agtype_hash_cmp +----------------- + -1925093371 +(1 row) + +SELECT agtype_hash_cmp('[1, "abcde", 2.0]'::agtype); + agtype_hash_cmp +----------------- + -1128310748 +(1 row) + +SELECT agtype_hash_cmp(agtype_in('null')); + agtype_hash_cmp +----------------- + -505290271 +(1 row) + +SELECT agtype_hash_cmp(agtype_in('[null]')); + agtype_hash_cmp +----------------- + 505290241 +(1 row) + +SELECT agtype_hash_cmp(agtype_in('[null, null]')); + agtype_hash_cmp +----------------- + 3 +(1 row) + +SELECT agtype_hash_cmp(agtype_in('[null, null, null]')); + agtype_hash_cmp +----------------- + 2021160967 +(1 row) + +SELECT agtype_hash_cmp(agtype_in('[null, null, null, null]')); + agtype_hash_cmp +----------------- + 15 +(1 row) + +SELECT agtype_hash_cmp(agtype_in('[null, null, null, null, null]')); + agtype_hash_cmp +----------------- + -505290721 +(1 row) + +SELECT agtype_hash_cmp('{"id":1, "label": ["test"], "properties":{"id":100}}'::agtype); + agtype_hash_cmp +----------------- + 153197719 +(1 row) + +SELECT agtype_hash_cmp('{"id":1, "label": ["test"], "properties":{"id":100}}::vertex'::agtype); + agtype_hash_cmp +----------------- + 1848106598 +(1 row) + +SELECT agtype_hash_cmp('{"id":2, "start_id":1, "end_id": 3, "label":"elabel", "properties":{}}'::agtype); + agtype_hash_cmp +----------------- + 1064722414 +(1 row) + +SELECT agtype_hash_cmp('{"id":2, "start_id":1, "end_id": 3, "label":"elabel", "properties":{}}::edge'::agtype); + agtype_hash_cmp +----------------- + -1790838958 +(1 row) + +SELECT agtype_hash_cmp(' + [{"id":1, "label": ["test"], "properties":{"id":100}}::vertex, + {"id":2, "start_id":1, "end_id": 3, "label":"elabel", "properties":{}}::edge, + {"id":5, "label": ["vlabel"], "properties":{}}::vertex]'::agtype); + agtype_hash_cmp +----------------- + -231467898 +(1 row) + +SELECT agtype_hash_cmp(' + [{"id":1, "label": ["test"], "properties":{"id":100}}::vertex, + {"id":2, "start_id":1, "end_id": 3, "label":"elabel", "properties":{}}::edge, + {"id":5, "label": ["vlabel"], "properties":{}}::vertex]::path'::agtype); + agtype_hash_cmp +----------------- + 843330291 +(1 row) + --Agtype BTree Comparison Function SELECT agtype_btree_cmp('1'::agtype, '1'::agtype); agtype_btree_cmp @@ -3634,39 +3797,39 @@ SELECT agtype_btree_cmp(agtype_in('null'), NULL); SELECT agtype_btree_cmp( '1'::agtype, - '{"id":1, "label":"test", "properties":{"id":100}}::vertex'::agtype); + '{"id":1, "label": ["test"], "properties":{"id":100}}::vertex'::agtype); agtype_btree_cmp ------------------ 1 (1 row) SELECT agtype_btree_cmp( - '{"id":1, "label":"test", "properties":{"id":100}}'::agtype, - '{"id":1, "label":"test", "properties":{"id":100}}'::agtype); + '{"id":1, "label": ["test"], "properties":{"id":100}}'::agtype, + '{"id":1, "label": ["test"], "properties":{"id":100}}'::agtype); agtype_btree_cmp ------------------ 0 (1 row) SELECT agtype_btree_cmp( - '{"id":1, "label":"test", "properties":{"id":100}}'::agtype, - '{"id":1, "label":"test", "properties":{"id":200}}'::agtype); + '{"id":1, "label": ["test"], "properties":{"id":100}}'::agtype, + '{"id":1, "label": ["test"], "properties":{"id":200}}'::agtype); agtype_btree_cmp ------------------ -1 (1 row) SELECT agtype_btree_cmp( - '{"id":1, "label":"test", "properties":{"id":100}}::vertex'::agtype, - '{"id":1, "label":"test", "properties":{"id":100}}::vertex'::agtype); + '{"id":1, "label": ["test"], "properties":{"id":100}}::vertex'::agtype, + '{"id":1, "label": ["test"], "properties":{"id":100}}::vertex'::agtype); agtype_btree_cmp ------------------ 0 (1 row) SELECT agtype_btree_cmp( - '{"id":1, "label":"test", "properties":{"id":100}}::vertex'::agtype, - '{"id":1, "label":"test", "properties":{"id":200}}::vertex'::agtype); + '{"id":1, "label": ["test"], "properties":{"id":100}}::vertex'::agtype, + '{"id":1, "label": ["test"], "properties":{"id":200}}::vertex'::agtype); agtype_btree_cmp ------------------ 0 @@ -3697,24 +3860,24 @@ SELECT agtype_btree_cmp( (1 row) SELECT agtype_btree_cmp( - '[{"id":1, "label":"test", "properties":{"id":100}}::vertex, + '[{"id":1, "label": ["test"], "properties":{"id":100}}::vertex, {"id":2, "start_id":1, "end_id": 3, "label":"elabel", "properties":{}}::edge, - {"id":3, "label":"vlabel", "properties":{}}::vertex]::path'::agtype, - '[{"id":1, "label":"test", "properties":{"id":100}}::vertex, + {"id":3, "label": ["vlabel"], "properties":{}}::vertex]::path'::agtype, + '[{"id":1, "label": ["test"], "properties":{"id":100}}::vertex, {"id":2, "start_id":1, "end_id": 3, "label":"elabel", "properties":{}}::edge, - {"id":3, "label":"vlabel", "properties":{}}::vertex]::path'::agtype); + {"id":3, "label": ["vlabel"], "properties":{}}::vertex]::path'::agtype); agtype_btree_cmp ------------------ 0 (1 row) SELECT agtype_btree_cmp( - '[{"id":1, "label":"test", "properties":{"id":100}}::vertex, + '[{"id":1, "label": ["test"], "properties":{"id":100}}::vertex, {"id":2, "start_id":1, "end_id": 3, "label":"elabel", "properties":{}}::edge, - {"id":3, "label":"vlabel", "properties":{}}::vertex]::path'::agtype, - '[{"id":1, "label":"test", "properties":{"id":100}}::vertex, + {"id":3, "label": ["vlabel"], "properties":{}}::vertex]::path'::agtype, + '[{"id":1, "label": ["test"], "properties":{"id":100}}::vertex, {"id":2, "start_id":1, "end_id": 3, "label":"elabel", "properties":{}}::edge, - {"id":4, "label":"vlabel", "properties":{}}::vertex]::path'::agtype); + {"id":4, "label": ["vlabel"], "properties":{}}::vertex]::path'::agtype); agtype_btree_cmp ------------------ -1 diff --git a/regress/expected/analyze.out b/regress/expected/analyze.out index 676dab9da..b60a219a7 100644 --- a/regress/expected/analyze.out +++ b/regress/expected/analyze.out @@ -31,7 +31,7 @@ NOTICE: graph "analyze" has been created SELECT * FROM cypher('analyze', $$ CREATE (u) RETURN u $$) AS (result agtype); result ---------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {}}::vertex (1 row) -- should error due to invalid input to cypher function @@ -100,7 +100,7 @@ SELECT * FROM age_prepare_cypher('analyze', 'MATCH (u) RETURN (u)'); SELECT * FROM cypher(NULL, NULL) AS (result agtype); result ---------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {}}::vertex (1 row) -- should error due to invalid input to cypher function diff --git a/regress/expected/cypher_call.out b/regress/expected/cypher_call.out index 6980abe4b..a195f6a3c 100644 --- a/regress/expected/cypher_call.out +++ b/regress/expected/cypher_call.out @@ -135,8 +135,8 @@ HINT: Name explicitly using `YIELD` instead SELECT * FROM cypher('cypher_call', $$ MATCH (a) CALL sqrt(64) YIELD sqrt RETURN a, sqrt $$) as (a agtype, sqrt agtype); a | sqrt ------------------------------------------------------------------------+------ - {"id": 281474976710657, "label": "", "properties": {"n": "a"}}::vertex | 8.0 - {"id": 281474976710658, "label": "", "properties": {"n": "b"}}::vertex | 8.0 + {"id": 281474976710657, "label": [], "properties": {"n": "a"}}::vertex | 8.0 + {"id": 281474976710658, "label": [], "properties": {"n": "b"}}::vertex | 8.0 (2 rows) /* MATCH CALL YIELD WHERE UPDATE/RETURN */ @@ -163,8 +163,8 @@ SELECT * FROM cypher('cypher_call', $$ MATCH (a) CALL sqrt(64) YIELD sqrt WHERE SELECT * FROM cypher('cypher_call', $$ MATCH (a) CALL sqrt(64) YIELD sqrt WHERE sqrt = 8 RETURN a, sqrt $$) as (a agtype, sqrt agtype); a | sqrt ------------------------------------------------------------------------+------ - {"id": 281474976710657, "label": "", "properties": {"n": "a"}}::vertex | 8.0 - {"id": 281474976710658, "label": "", "properties": {"n": "b"}}::vertex | 8.0 + {"id": 281474976710657, "label": [], "properties": {"n": "a"}}::vertex | 8.0 + {"id": 281474976710658, "label": [], "properties": {"n": "b"}}::vertex | 8.0 (2 rows) SELECT * FROM cypher('cypher_call', $$ MATCH (a) CALL sqrt(64) YIELD sqrt WHERE b = 8 RETURN a, sqrt $$) as (a agtype, sqrt agtype); @@ -195,15 +195,15 @@ SELECT * FROM cypher('cypher_call', $$ CALL sqrt(64) YIELD sqrt MATCH (a) WHERE SELECT * FROM cypher('cypher_call', $$ CALL sqrt(64) YIELD sqrt MATCH (a) WHERE sqrt = 8 RETURN a, sqrt $$) as (a agtype, sqrt agtype); a | sqrt ------------------------------------------------------------------------+------ - {"id": 281474976710657, "label": "", "properties": {"n": "a"}}::vertex | 8.0 - {"id": 281474976710658, "label": "", "properties": {"n": "b"}}::vertex | 8.0 + {"id": 281474976710657, "label": [], "properties": {"n": "a"}}::vertex | 8.0 + {"id": 281474976710658, "label": [], "properties": {"n": "b"}}::vertex | 8.0 (2 rows) SELECT * FROM cypher('cypher_call', $$ CALL sqrt(64) YIELD sqrt WHERE sqrt = 8 MATCH (a) RETURN a, sqrt $$) as (a agtype, sqrt agtype); a | sqrt ------------------------------------------------------------------------+------ - {"id": 281474976710657, "label": "", "properties": {"n": "a"}}::vertex | 8.0 - {"id": 281474976710658, "label": "", "properties": {"n": "b"}}::vertex | 8.0 + {"id": 281474976710657, "label": [], "properties": {"n": "a"}}::vertex | 8.0 + {"id": 281474976710658, "label": [], "properties": {"n": "b"}}::vertex | 8.0 (2 rows) /* Multiple Calls: CALL YIELD CALL YIELD... RETURN */ diff --git a/regress/expected/cypher_create.out b/regress/expected/cypher_create.out index efdf73fcb..ccf119328 100644 --- a/regress/expected/cypher_create.out +++ b/regress/expected/cypher_create.out @@ -47,11 +47,11 @@ SELECT * FROM cypher('cypher_create', $$CREATE (:v {key: 'value'})$$) AS (a agty (0 rows) SELECT * FROM cypher('cypher_create', $$MATCH (n:v) RETURN n$$) AS (n agtype); - n -------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "v", "properties": {}}::vertex - {"id": 844424930131970, "label": "v", "properties": {}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"key": "value"}}::vertex + n +--------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["v"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"key": "value"}}::vertex (3 rows) -- Left relationship @@ -219,7 +219,7 @@ SELECT * FROM cypher('cypher_create', $$ $$) as (a agtype, b agtype); a | b ----------------------------------------------------------------+----------------- - {"id": 281474976710659, "label": "", "properties": {}}::vertex | 281474976710659 + {"id": 281474976710659, "label": [], "properties": {}}::vertex | 281474976710659 (1 row) SELECT * FROM cypher('cypher_create', $$ @@ -237,7 +237,7 @@ SELECT * FROM cypher('cypher_create', $$ $$) as (a agtype, b agtype, c agtype, d agtype); a | b | c | d ----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+---+--- - {"id": 281474976710663, "label": "", "properties": {}}::vertex | {"id": 1688849860263951, "label": "e_var", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {"id": 0}}::edge | 0 | 1 + {"id": 281474976710663, "label": [], "properties": {}}::vertex | {"id": 1688849860263951, "label": "e_var", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {"id": 0}}::edge | 0 | 1 (1 row) SELECT * FROM cypher('cypher_create', $$ @@ -245,11 +245,11 @@ SELECT * FROM cypher('cypher_create', $$ CREATE (a)-[b:e_var]->(a) RETURN a, b $$) as (a agtype, b agtype); - a | b ---------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------ - {"id": 1407374883553281, "label": "n_var", "properties": {"name": "Node A"}}::vertex | {"id": 1688849860263952, "label": "e_var", "end_id": 1407374883553281, "start_id": 1407374883553281, "properties": {}}::edge - {"id": 1407374883553282, "label": "n_var", "properties": {"name": "Node B"}}::vertex | {"id": 1688849860263953, "label": "e_var", "end_id": 1407374883553282, "start_id": 1407374883553282, "properties": {}}::edge - {"id": 1407374883553283, "label": "n_var", "properties": {"name": "Node C"}}::vertex | {"id": 1688849860263954, "label": "e_var", "end_id": 1407374883553283, "start_id": 1407374883553283, "properties": {}}::edge + a | b +----------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------ + {"id": 1407374883553281, "label": ["n_var"], "properties": {"name": "Node A"}}::vertex | {"id": 1688849860263952, "label": "e_var", "end_id": 1407374883553281, "start_id": 1407374883553281, "properties": {}}::edge + {"id": 1407374883553282, "label": ["n_var"], "properties": {"name": "Node B"}}::vertex | {"id": 1688849860263953, "label": "e_var", "end_id": 1407374883553282, "start_id": 1407374883553282, "properties": {}}::edge + {"id": 1407374883553283, "label": ["n_var"], "properties": {"name": "Node C"}}::vertex | {"id": 1688849860263954, "label": "e_var", "end_id": 1407374883553283, "start_id": 1407374883553283, "properties": {}}::edge (3 rows) SELECT * FROM cypher('cypher_create', $$ @@ -257,11 +257,11 @@ SELECT * FROM cypher('cypher_create', $$ CREATE (a)-[b:e_var]->(c) RETURN a, b, c $$) as (a agtype, b agtype, c agtype); - a | b | c ---------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------- - {"id": 1407374883553281, "label": "n_var", "properties": {"name": "Node A"}}::vertex | {"id": 1688849860263955, "label": "e_var", "end_id": 281474976710665, "start_id": 1407374883553281, "properties": {}}::edge | {"id": 281474976710665, "label": "", "properties": {}}::vertex - {"id": 1407374883553282, "label": "n_var", "properties": {"name": "Node B"}}::vertex | {"id": 1688849860263956, "label": "e_var", "end_id": 281474976710666, "start_id": 1407374883553282, "properties": {}}::edge | {"id": 281474976710666, "label": "", "properties": {}}::vertex - {"id": 1407374883553283, "label": "n_var", "properties": {"name": "Node C"}}::vertex | {"id": 1688849860263957, "label": "e_var", "end_id": 281474976710667, "start_id": 1407374883553283, "properties": {}}::edge | {"id": 281474976710667, "label": "", "properties": {}}::vertex + a | b | c +----------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------- + {"id": 1407374883553281, "label": ["n_var"], "properties": {"name": "Node A"}}::vertex | {"id": 1688849860263955, "label": "e_var", "end_id": 281474976710665, "start_id": 1407374883553281, "properties": {}}::edge | {"id": 281474976710665, "label": [], "properties": {}}::vertex + {"id": 1407374883553282, "label": ["n_var"], "properties": {"name": "Node B"}}::vertex | {"id": 1688849860263956, "label": "e_var", "end_id": 281474976710666, "start_id": 1407374883553282, "properties": {}}::edge | {"id": 281474976710666, "label": [], "properties": {}}::vertex + {"id": 1407374883553283, "label": ["n_var"], "properties": {"name": "Node C"}}::vertex | {"id": 1688849860263957, "label": "e_var", "end_id": 281474976710667, "start_id": 1407374883553283, "properties": {}}::edge | {"id": 281474976710667, "label": [], "properties": {}}::vertex (3 rows) SELECT * FROM cypher('cypher_create', $$ @@ -270,7 +270,7 @@ SELECT * FROM cypher('cypher_create', $$ $$) as (b agtype); b ---------------------------------------------------------------- - {"id": 281474976710668, "label": "", "properties": {}}::vertex + {"id": 281474976710668, "label": [], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_create', $$ @@ -288,7 +288,7 @@ SELECT * FROM cypher('cypher_create', $$ $$) as (b agtype); b -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710672, "label": "", "properties": {}}::vertex, {"id": 1688849860263960, "label": "e_var", "end_id": 281474976710673, "start_id": 281474976710672, "properties": {}}::edge, {"id": 281474976710673, "label": "", "properties": {}}::vertex]::path + [{"id": 281474976710672, "label": [], "properties": {}}::vertex, {"id": 1688849860263960, "label": "e_var", "end_id": 281474976710673, "start_id": 281474976710672, "properties": {}}::edge, {"id": 281474976710673, "label": [], "properties": {}}::vertex]::path (1 row) SELECT * FROM cypher('cypher_create', $$ @@ -297,7 +297,7 @@ SELECT * FROM cypher('cypher_create', $$ $$) as (b agtype); b ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710674, "label": "", "properties": {"id": 0}}::vertex, {"id": 1688849860263961, "label": "e_var", "end_id": 281474976710674, "start_id": 281474976710674, "properties": {}}::edge, {"id": 281474976710674, "label": "", "properties": {"id": 0}}::vertex]::path + [{"id": 281474976710674, "label": [], "properties": {"id": 0}}::vertex, {"id": 1688849860263961, "label": "e_var", "end_id": 281474976710674, "start_id": 281474976710674, "properties": {}}::edge, {"id": 281474976710674, "label": [], "properties": {"id": 0}}::vertex]::path (1 row) SELECT * FROM cypher('cypher_create', $$ @@ -305,11 +305,11 @@ SELECT * FROM cypher('cypher_create', $$ CREATE p=(a)-[:e_var]->(a) RETURN p $$) as (b agtype); - b ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 1407374883553281, "label": "n_var", "properties": {"name": "Node A"}}::vertex, {"id": 1688849860263962, "label": "e_var", "end_id": 1407374883553281, "start_id": 1407374883553281, "properties": {}}::edge, {"id": 1407374883553281, "label": "n_var", "properties": {"name": "Node A"}}::vertex]::path - [{"id": 1407374883553282, "label": "n_var", "properties": {"name": "Node B"}}::vertex, {"id": 1688849860263963, "label": "e_var", "end_id": 1407374883553282, "start_id": 1407374883553282, "properties": {}}::edge, {"id": 1407374883553282, "label": "n_var", "properties": {"name": "Node B"}}::vertex]::path - [{"id": 1407374883553283, "label": "n_var", "properties": {"name": "Node C"}}::vertex, {"id": 1688849860263964, "label": "e_var", "end_id": 1407374883553283, "start_id": 1407374883553283, "properties": {}}::edge, {"id": 1407374883553283, "label": "n_var", "properties": {"name": "Node C"}}::vertex]::path + b +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 1407374883553281, "label": ["n_var"], "properties": {"name": "Node A"}}::vertex, {"id": 1688849860263962, "label": "e_var", "end_id": 1407374883553281, "start_id": 1407374883553281, "properties": {}}::edge, {"id": 1407374883553281, "label": ["n_var"], "properties": {"name": "Node A"}}::vertex]::path + [{"id": 1407374883553282, "label": ["n_var"], "properties": {"name": "Node B"}}::vertex, {"id": 1688849860263963, "label": "e_var", "end_id": 1407374883553282, "start_id": 1407374883553282, "properties": {}}::edge, {"id": 1407374883553282, "label": ["n_var"], "properties": {"name": "Node B"}}::vertex]::path + [{"id": 1407374883553283, "label": ["n_var"], "properties": {"name": "Node C"}}::vertex, {"id": 1688849860263964, "label": "e_var", "end_id": 1407374883553283, "start_id": 1407374883553283, "properties": {}}::edge, {"id": 1407374883553283, "label": ["n_var"], "properties": {"name": "Node C"}}::vertex]::path (3 rows) SELECT * FROM cypher('cypher_create', $$ @@ -318,7 +318,7 @@ SELECT * FROM cypher('cypher_create', $$ $$) as (a agtype, b agtype); a | b --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710675, "label": "", "properties": {}}::vertex, {"id": 1688849860263965, "label": "e_var", "end_id": 281474976710676, "start_id": 281474976710675, "properties": {}}::edge, {"id": 281474976710676, "label": "", "properties": {}}::vertex]::path | {"id": 1688849860263966, "label": "e_var", "end_id": 281474976710675, "start_id": 281474976710675, "properties": {}}::edge + [{"id": 281474976710675, "label": [], "properties": {}}::vertex, {"id": 1688849860263965, "label": "e_var", "end_id": 281474976710676, "start_id": 281474976710675, "properties": {}}::edge, {"id": 281474976710676, "label": [], "properties": {}}::vertex]::path | {"id": 1688849860263966, "label": "e_var", "end_id": 281474976710675, "start_id": 281474976710675, "properties": {}}::edge (1 row) SELECT * FROM cypher('cypher_create', $$ @@ -390,81 +390,81 @@ SELECT name, kind FROM ag_label ORDER BY name; --Validate every vertex has the correct label SELECT * FROM cypher('cypher_create', $$MATCH (n) RETURN n$$) AS (n agtype); - n -------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex - {"id": 281474976710658, "label": "", "properties": {}}::vertex - {"id": 281474976710659, "label": "", "properties": {}}::vertex - {"id": 281474976710660, "label": "", "properties": {}}::vertex - {"id": 281474976710661, "label": "", "properties": {}}::vertex - {"id": 281474976710662, "label": "", "properties": {}}::vertex - {"id": 281474976710663, "label": "", "properties": {}}::vertex - {"id": 281474976710664, "label": "", "properties": {}}::vertex - {"id": 281474976710665, "label": "", "properties": {}}::vertex - {"id": 281474976710666, "label": "", "properties": {}}::vertex - {"id": 281474976710667, "label": "", "properties": {}}::vertex - {"id": 281474976710668, "label": "", "properties": {}}::vertex - {"id": 281474976710669, "label": "", "properties": {}}::vertex - {"id": 281474976710670, "label": "", "properties": {}}::vertex - {"id": 281474976710671, "label": "", "properties": {}}::vertex - {"id": 281474976710672, "label": "", "properties": {}}::vertex - {"id": 281474976710673, "label": "", "properties": {}}::vertex - {"id": 281474976710674, "label": "", "properties": {"id": 0}}::vertex - {"id": 281474976710675, "label": "", "properties": {}}::vertex - {"id": 281474976710676, "label": "", "properties": {}}::vertex - {"id": 844424930131969, "label": "v", "properties": {}}::vertex - {"id": 844424930131970, "label": "v", "properties": {}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"key": "value"}}::vertex - {"id": 844424930131972, "label": "v", "properties": {"id": "right rel, initial node"}}::vertex - {"id": 844424930131973, "label": "v", "properties": {"id": "right rel, end node"}}::vertex - {"id": 844424930131974, "label": "v", "properties": {"id": "left rel, initial node"}}::vertex - {"id": 844424930131975, "label": "v", "properties": {"id": "left rel, end node"}}::vertex - {"id": 844424930131976, "label": "v", "properties": {"id": "path, initial node"}}::vertex - {"id": 844424930131977, "label": "v", "properties": {"id": "path, middle node"}}::vertex - {"id": 844424930131978, "label": "v", "properties": {"id": "path, last node"}}::vertex - {"id": 844424930131979, "label": "v", "properties": {"id": "divergent, initial node"}}::vertex - {"id": 844424930131980, "label": "v", "properties": {"id": "divergent middle node"}}::vertex - {"id": 844424930131981, "label": "v", "properties": {"id": "divergent, end node"}}::vertex - {"id": 844424930131982, "label": "v", "properties": {"id": "convergent, initial node"}}::vertex - {"id": 844424930131983, "label": "v", "properties": {"id": "convergent middle node"}}::vertex - {"id": 844424930131984, "label": "v", "properties": {"id": "convergent, end node"}}::vertex - {"id": 844424930131985, "label": "v", "properties": {"id": "paths, vertex one"}}::vertex - {"id": 844424930131986, "label": "v", "properties": {"id": "paths, vertex two"}}::vertex - {"id": 844424930131987, "label": "v", "properties": {"id": "paths, vertex three"}}::vertex - {"id": 844424930131988, "label": "v", "properties": {"id": "paths, vertex four"}}::vertex - {"id": 1407374883553281, "label": "n_var", "properties": {"name": "Node A"}}::vertex - {"id": 1407374883553282, "label": "n_var", "properties": {"name": "Node B"}}::vertex - {"id": 1407374883553283, "label": "n_var", "properties": {"name": "Node C"}}::vertex - {"id": 1970324836974593, "label": "n_other_node", "properties": {}}::vertex - {"id": 1970324836974594, "label": "n_other_node", "properties": {}}::vertex - {"id": 1970324836974595, "label": "n_other_node", "properties": {}}::vertex + n +--------------------------------------------------------------------------------------------------- + {"id": 281474976710657, "label": [], "properties": {}}::vertex + {"id": 281474976710658, "label": [], "properties": {}}::vertex + {"id": 281474976710659, "label": [], "properties": {}}::vertex + {"id": 281474976710660, "label": [], "properties": {}}::vertex + {"id": 281474976710661, "label": [], "properties": {}}::vertex + {"id": 281474976710662, "label": [], "properties": {}}::vertex + {"id": 281474976710663, "label": [], "properties": {}}::vertex + {"id": 281474976710664, "label": [], "properties": {}}::vertex + {"id": 281474976710665, "label": [], "properties": {}}::vertex + {"id": 281474976710666, "label": [], "properties": {}}::vertex + {"id": 281474976710667, "label": [], "properties": {}}::vertex + {"id": 281474976710668, "label": [], "properties": {}}::vertex + {"id": 281474976710669, "label": [], "properties": {}}::vertex + {"id": 281474976710670, "label": [], "properties": {}}::vertex + {"id": 281474976710671, "label": [], "properties": {}}::vertex + {"id": 281474976710672, "label": [], "properties": {}}::vertex + {"id": 281474976710673, "label": [], "properties": {}}::vertex + {"id": 281474976710674, "label": [], "properties": {"id": 0}}::vertex + {"id": 281474976710675, "label": [], "properties": {}}::vertex + {"id": 281474976710676, "label": [], "properties": {}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"key": "value"}}::vertex + {"id": 844424930131972, "label": ["v"], "properties": {"id": "right rel, initial node"}}::vertex + {"id": 844424930131973, "label": ["v"], "properties": {"id": "right rel, end node"}}::vertex + {"id": 844424930131974, "label": ["v"], "properties": {"id": "left rel, initial node"}}::vertex + {"id": 844424930131975, "label": ["v"], "properties": {"id": "left rel, end node"}}::vertex + {"id": 844424930131976, "label": ["v"], "properties": {"id": "path, initial node"}}::vertex + {"id": 844424930131977, "label": ["v"], "properties": {"id": "path, middle node"}}::vertex + {"id": 844424930131978, "label": ["v"], "properties": {"id": "path, last node"}}::vertex + {"id": 844424930131979, "label": ["v"], "properties": {"id": "divergent, initial node"}}::vertex + {"id": 844424930131980, "label": ["v"], "properties": {"id": "divergent middle node"}}::vertex + {"id": 844424930131981, "label": ["v"], "properties": {"id": "divergent, end node"}}::vertex + {"id": 844424930131982, "label": ["v"], "properties": {"id": "convergent, initial node"}}::vertex + {"id": 844424930131983, "label": ["v"], "properties": {"id": "convergent middle node"}}::vertex + {"id": 844424930131984, "label": ["v"], "properties": {"id": "convergent, end node"}}::vertex + {"id": 844424930131985, "label": ["v"], "properties": {"id": "paths, vertex one"}}::vertex + {"id": 844424930131986, "label": ["v"], "properties": {"id": "paths, vertex two"}}::vertex + {"id": 844424930131987, "label": ["v"], "properties": {"id": "paths, vertex three"}}::vertex + {"id": 844424930131988, "label": ["v"], "properties": {"id": "paths, vertex four"}}::vertex + {"id": 1407374883553281, "label": ["n_var"], "properties": {"name": "Node A"}}::vertex + {"id": 1407374883553282, "label": ["n_var"], "properties": {"name": "Node B"}}::vertex + {"id": 1407374883553283, "label": ["n_var"], "properties": {"name": "Node C"}}::vertex + {"id": 1970324836974593, "label": ["n_other_node"], "properties": {}}::vertex + {"id": 1970324836974594, "label": ["n_other_node"], "properties": {}}::vertex + {"id": 1970324836974595, "label": ["n_other_node"], "properties": {}}::vertex (46 rows) -- prepared statements PREPARE p_1 AS SELECT * FROM cypher('cypher_create', $$CREATE (v:new_vertex {key: 'value'}) RETURN v$$) AS (a agtype); EXECUTE p_1; - a ------------------------------------------------------------------------------------------ - {"id": 2533274790395905, "label": "new_vertex", "properties": {"key": "value"}}::vertex + a +------------------------------------------------------------------------------------------- + {"id": 2533274790395905, "label": ["new_vertex"], "properties": {"key": "value"}}::vertex (1 row) EXECUTE p_1; - a ------------------------------------------------------------------------------------------ - {"id": 2533274790395906, "label": "new_vertex", "properties": {"key": "value"}}::vertex + a +------------------------------------------------------------------------------------------- + {"id": 2533274790395906, "label": ["new_vertex"], "properties": {"key": "value"}}::vertex (1 row) PREPARE p_2 AS SELECT * FROM cypher('cypher_create', $$CREATE (v:new_vertex {key: $var_name}) RETURN v$$, $1) AS (a agtype); EXECUTE p_2('{"var_name": "Hello Prepared Statements"}'); - a -------------------------------------------------------------------------------------------------------------- - {"id": 2533274790395907, "label": "new_vertex", "properties": {"key": "Hello Prepared Statements"}}::vertex + a +--------------------------------------------------------------------------------------------------------------- + {"id": 2533274790395907, "label": ["new_vertex"], "properties": {"key": "Hello Prepared Statements"}}::vertex (1 row) EXECUTE p_2('{"var_name": "Hello Prepared Statements 2"}'); - a ---------------------------------------------------------------------------------------------------------------- - {"id": 2533274790395908, "label": "new_vertex", "properties": {"key": "Hello Prepared Statements 2"}}::vertex + a +----------------------------------------------------------------------------------------------------------------- + {"id": 2533274790395908, "label": ["new_vertex"], "properties": {"key": "Hello Prepared Statements 2"}}::vertex (1 row) -- pl/pgsql @@ -478,15 +478,15 @@ BEGIN END $BODY$; SELECT create_test(); - create_test ------------------------------------------------------------------------------------------ - {"id": 2533274790395909, "label": "new_vertex", "properties": {"key": "value"}}::vertex + create_test +------------------------------------------------------------------------------------------- + {"id": 2533274790395909, "label": ["new_vertex"], "properties": {"key": "value"}}::vertex (1 row) SELECT create_test(); - create_test ------------------------------------------------------------------------------------------ - {"id": 2533274790395910, "label": "new_vertex", "properties": {"key": "value"}}::vertex + create_test +------------------------------------------------------------------------------------------- + {"id": 2533274790395910, "label": ["new_vertex"], "properties": {"key": "value"}}::vertex (1 row) -- @@ -525,7 +525,7 @@ SELECT * FROM cypher('cypher_create', $$ $$) as (a agtype); a ------------------------------------------------------------------------ - [{"id": 281474976710677, "label": "", "properties": {}}::vertex]::path + [{"id": 281474976710677, "label": [], "properties": {}}::vertex]::path (1 row) --CREATE with joins @@ -602,9 +602,9 @@ SELECT * FROM cypher('cypher_create', $$ CREATE (a:Part {part_num: '670'}) $$) a (0 rows) SELECT * FROM cypher('cypher_create', $$ MATCH (a:Part) RETURN a $$) as (a agtype); - a --------------------------------------------------------------------------------------- - {"id": 3659174697238529, "label": "Part", "properties": {"part_num": "670"}}::vertex + a +---------------------------------------------------------------------------------------- + {"id": 3659174697238529, "label": ["Part"], "properties": {"part_num": "670"}}::vertex (1 row) SELECT * FROM cypher('cypher_create', $$ CREATE (a:Part {part_num: '671'}) $$) as (a agtype); @@ -618,11 +618,11 @@ SELECT * FROM cypher('cypher_create', $$ CREATE (a:Part {part_num: '672'}) $$) a (0 rows) SELECT * FROM cypher('cypher_create', $$ MATCH (a:Part) RETURN a $$) as (a agtype); - a --------------------------------------------------------------------------------------- - {"id": 3659174697238529, "label": "Part", "properties": {"part_num": "670"}}::vertex - {"id": 3659174697238530, "label": "Part", "properties": {"part_num": "671"}}::vertex - {"id": 3659174697238531, "label": "Part", "properties": {"part_num": "672"}}::vertex + a +---------------------------------------------------------------------------------------- + {"id": 3659174697238529, "label": ["Part"], "properties": {"part_num": "670"}}::vertex + {"id": 3659174697238530, "label": ["Part"], "properties": {"part_num": "671"}}::vertex + {"id": 3659174697238531, "label": ["Part"], "properties": {"part_num": "672"}}::vertex (3 rows) SELECT * FROM cypher('cypher_create', $$ CREATE (a:Part {part_num: '673'}) $$) as (a agtype); @@ -631,12 +631,12 @@ SELECT * FROM cypher('cypher_create', $$ CREATE (a:Part {part_num: '673'}) $$) a (0 rows) SELECT * FROM cypher('cypher_create', $$ MATCH (a:Part) RETURN a $$) as (a agtype); - a --------------------------------------------------------------------------------------- - {"id": 3659174697238529, "label": "Part", "properties": {"part_num": "670"}}::vertex - {"id": 3659174697238530, "label": "Part", "properties": {"part_num": "671"}}::vertex - {"id": 3659174697238531, "label": "Part", "properties": {"part_num": "672"}}::vertex - {"id": 3659174697238532, "label": "Part", "properties": {"part_num": "673"}}::vertex + a +---------------------------------------------------------------------------------------- + {"id": 3659174697238529, "label": ["Part"], "properties": {"part_num": "670"}}::vertex + {"id": 3659174697238530, "label": ["Part"], "properties": {"part_num": "671"}}::vertex + {"id": 3659174697238531, "label": ["Part"], "properties": {"part_num": "672"}}::vertex + {"id": 3659174697238532, "label": ["Part"], "properties": {"part_num": "673"}}::vertex (4 rows) END; @@ -650,16 +650,16 @@ SELECT * FROM cypher('cypher_create', $$ $$) as (n1 agtype, e agtype, n2 agtype); n1 | e | n2 ----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------- - {"id": 281474976710681, "label": "", "properties": {}}::vertex | {"id": 3940649673949185, "label": "new", "end_id": 281474976710681, "start_id": 281474976710681, "properties": {}}::edge | {"id": 281474976710681, "label": "", "properties": {}}::vertex + {"id": 281474976710681, "label": [], "properties": {}}::vertex | {"id": 3940649673949185, "label": "new", "end_id": 281474976710681, "start_id": 281474976710681, "properties": {}}::edge | {"id": 281474976710681, "label": [], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_create', $$ CREATE (p:node)-[e:new]->(p) RETURN p,e,p $$) as (n1 agtype, e agtype, n2 agtype); - n1 | e | n2 ----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------- - {"id": 4222124650659841, "label": "node", "properties": {}}::vertex | {"id": 3940649673949186, "label": "new", "end_id": 4222124650659841, "start_id": 4222124650659841, "properties": {}}::edge | {"id": 4222124650659841, "label": "node", "properties": {}}::vertex + n1 | e | n2 +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------- + {"id": 4222124650659841, "label": ["node"], "properties": {}}::vertex | {"id": 3940649673949186, "label": "new", "end_id": 4222124650659841, "start_id": 4222124650659841, "properties": {}}::edge | {"id": 4222124650659841, "label": ["node"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_create', $$ @@ -669,7 +669,7 @@ SELECT * FROM cypher('cypher_create', $$ $$) as (n1 agtype, e agtype, n2 agtype); n1 | e | n2 ----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------- - {"id": 281474976710682, "label": "", "properties": {}}::vertex | {"id": 3940649673949187, "label": "new", "end_id": 281474976710682, "start_id": 281474976710682, "properties": {}}::edge | {"id": 281474976710682, "label": "", "properties": {}}::vertex + {"id": 281474976710682, "label": [], "properties": {}}::vertex | {"id": 3940649673949187, "label": "new", "end_id": 281474976710682, "start_id": 281474976710682, "properties": {}}::edge | {"id": 281474976710682, "label": [], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_create', $$ @@ -677,9 +677,9 @@ SELECT * FROM cypher('cypher_create', $$ CREATE (p)-[a:new]->(p) RETURN p,a,p $$) as (n1 agtype, e agtype, n2 agtype); - n1 | e | n2 --------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------- - {"id": 4503599627370497, "label": "n1", "properties": {}}::vertex | {"id": 3940649673949188, "label": "new", "end_id": 4503599627370497, "start_id": 4503599627370497, "properties": {}}::edge | {"id": 4503599627370497, "label": "n1", "properties": {}}::vertex + n1 | e | n2 +---------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------- + {"id": 4503599627370497, "label": ["n1"], "properties": {}}::vertex | {"id": 3940649673949188, "label": "new", "end_id": 4503599627370497, "start_id": 4503599627370497, "properties": {}}::edge | {"id": 4503599627370497, "label": ["n1"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_create', $$ @@ -687,9 +687,9 @@ SELECT * FROM cypher('cypher_create', $$ CREATE (p)-[a:new]->(p) RETURN p,a,p $$) as (n1 agtype, e agtype, n2 agtype); - n1 | e | n2 ----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------- - {"id": 4222124650659841, "label": "node", "properties": {}}::vertex | {"id": 3940649673949189, "label": "new", "end_id": 4222124650659841, "start_id": 4222124650659841, "properties": {}}::edge | {"id": 4222124650659841, "label": "node", "properties": {}}::vertex + n1 | e | n2 +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------- + {"id": 4222124650659841, "label": ["node"], "properties": {}}::vertex | {"id": 3940649673949189, "label": "new", "end_id": 4222124650659841, "start_id": 4222124650659841, "properties": {}}::edge | {"id": 4222124650659841, "label": ["node"], "properties": {}}::vertex (1 row) -- Invalid variable reuse @@ -772,27 +772,27 @@ SELECT * FROM cypher('cypher_create', $$ CREATE (a:CREATE) RETURN a $$) as (a agtype); - a ------------------------------------------------------------------------ - {"id": 5348024557502465, "label": "CREATE", "properties": {}}::vertex + a +------------------------------------------------------------------------- + {"id": 5348024557502465, "label": ["CREATE"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_create', $$ CREATE (a:create) RETURN a $$) as (a agtype); - a ------------------------------------------------------------------------ - {"id": 5629499534213121, "label": "create", "properties": {}}::vertex + a +------------------------------------------------------------------------- + {"id": 5629499534213121, "label": ["create"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_create', $$ CREATE (a:CrEaTe) RETURN a $$) as (a agtype); - a ------------------------------------------------------------------------ - {"id": 5910974510923777, "label": "CrEaTe", "properties": {}}::vertex + a +------------------------------------------------------------------------- + {"id": 5910974510923777, "label": ["CrEaTe"], "properties": {}}::vertex (1 row) -- diff --git a/regress/expected/cypher_delete.out b/regress/expected/cypher_delete.out index 3cdbbf8bb..d1756afac 100644 --- a/regress/expected/cypher_delete.out +++ b/regress/expected/cypher_delete.out @@ -42,11 +42,11 @@ SELECT * FROM cypher('cypher_delete', $$CREATE (:v {i: 1})$$) AS (a agtype); (0 rows) SELECT * FROM cypher('cypher_delete', $$MATCH(n) DELETE n RETURN n$$) AS (a agtype); - a ---------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "v", "properties": {}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 0, "j": 5}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": 1}}::vertex + a +----------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["v"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 0, "j": 5}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": 1}}::vertex (3 rows) SELECT * FROM cypher('cypher_delete', $$MATCH(n) RETURN n$$) AS (a agtype); @@ -78,10 +78,10 @@ SELECT * FROM cypher('cypher_delete', $$MATCH()-[e]->() DELETE e RETURN e$$) AS --Cleanup SELECT * FROM cypher('cypher_delete', $$MATCH(n) DELETE n RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------ - {"id": 844424930131972, "label": "v", "properties": {}}::vertex - {"id": 844424930131973, "label": "v", "properties": {}}::vertex + a +------------------------------------------------------------------- + {"id": 844424930131972, "label": ["v"], "properties": {}}::vertex + {"id": 844424930131973, "label": ["v"], "properties": {}}::vertex (2 rows) --Test 4: DETACH DELETE a vertex @@ -98,9 +98,9 @@ SELECT * FROM cypher('cypher_delete', $$MATCH(n1)-[e]->(n2) DETACH DELETE n1 RET --Cleanup SELECT * FROM cypher('cypher_delete', $$MATCH(n) RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------ - {"id": 844424930131975, "label": "v", "properties": {}}::vertex + a +------------------------------------------------------------------- + {"id": 844424930131975, "label": ["v"], "properties": {}}::vertex (1 row) --Test 4: DETACH DELETE two vertices tied to the same edge @@ -168,12 +168,12 @@ SELECT * FROM cypher('cypher_delete', $$CREATE (:v {i: 1})$$) AS (a agtype); (0 rows) SELECT * FROM cypher('cypher_delete', $$MATCH(n) DELETE n SET n.lol = 'ftw' RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------------------------------------------ - {"id": 844424930131975, "label": "v", "properties": {"lol": "ftw"}}::vertex - {"id": 844424930131982, "label": "v", "properties": {"lol": "ftw"}}::vertex - {"id": 844424930131983, "label": "v", "properties": {"a": 0, "i": 0, "j": 5, "lol": "ftw"}}::vertex - {"id": 844424930131984, "label": "v", "properties": {"i": 1, "lol": "ftw"}}::vertex + a +------------------------------------------------------------------------------------------------------- + {"id": 844424930131975, "label": ["v"], "properties": {"lol": "ftw"}}::vertex + {"id": 844424930131982, "label": ["v"], "properties": {"lol": "ftw"}}::vertex + {"id": 844424930131983, "label": ["v"], "properties": {"a": 0, "i": 0, "j": 5, "lol": "ftw"}}::vertex + {"id": 844424930131984, "label": ["v"], "properties": {"i": 1, "lol": "ftw"}}::vertex (4 rows) SELECT * FROM cypher('cypher_delete', $$MATCH(n) RETURN n$$) AS (a agtype); @@ -191,11 +191,11 @@ SELECT * FROM cypher('cypher_delete', $$MATCH(n1)-[]->() DELETE n1 RETURN n1$$) ERROR: Cannot delete a vertex that has edge(s). Delete the edge(s) first, or try DETACH DELETE. --Cleanup SELECT * FROM cypher('cypher_delete', $$MATCH(n) DETACH DELETE n RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------ - {"id": 844424930131985, "label": "v", "properties": {}}::vertex - {"id": 844424930131986, "label": "v", "properties": {}}::vertex - {"id": 844424930131987, "label": "v", "properties": {}}::vertex + a +------------------------------------------------------------------- + {"id": 844424930131985, "label": ["v"], "properties": {}}::vertex + {"id": 844424930131986, "label": ["v"], "properties": {}}::vertex + {"id": 844424930131987, "label": ["v"], "properties": {}}::vertex (3 rows) SELECT * FROM cypher('cypher_delete', $$MATCH(n) RETURN n$$) AS (a agtype); @@ -210,16 +210,16 @@ SELECT * FROM cypher('cypher_delete', $$CREATE (n:v)-[:e]->(:v)$$) AS (a agtype) (0 rows) SELECT * FROM cypher('cypher_delete', $$MATCH(n1)-[e]->() DELETE e, n1 RETURN n1$$) AS (a agtype); - a ------------------------------------------------------------------ - {"id": 844424930131988, "label": "v", "properties": {}}::vertex + a +------------------------------------------------------------------- + {"id": 844424930131988, "label": ["v"], "properties": {}}::vertex (1 row) --Cleanup SELECT * FROM cypher('cypher_delete', $$MATCH(n) DETACH DELETE n RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------ - {"id": 844424930131989, "label": "v", "properties": {}}::vertex + a +------------------------------------------------------------------- + {"id": 844424930131989, "label": ["v"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_delete', $$MATCH(n) RETURN n$$) AS (a agtype); @@ -234,16 +234,16 @@ SELECT * FROM cypher('cypher_delete', $$CREATE (n:v)-[:e]->(:v)$$) AS (a agtype) (0 rows) SELECT * FROM cypher('cypher_delete', $$MATCH(n1)-[e]->() DELETE n1, e RETURN n1$$) AS (a agtype); - a ------------------------------------------------------------------ - {"id": 844424930131990, "label": "v", "properties": {}}::vertex + a +------------------------------------------------------------------- + {"id": 844424930131990, "label": ["v"], "properties": {}}::vertex (1 row) --Cleanup SELECT * FROM cypher('cypher_delete', $$MATCH(n) DETACH DELETE n RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------ - {"id": 844424930131991, "label": "v", "properties": {}}::vertex + a +------------------------------------------------------------------- + {"id": 844424930131991, "label": ["v"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_delete', $$MATCH(n) RETURN n$$) AS (a agtype); @@ -253,24 +253,24 @@ SELECT * FROM cypher('cypher_delete', $$MATCH(n) RETURN n$$) AS (a agtype); --Test 11: Delete a vertex twice SELECT * FROM cypher('cypher_delete', $$CREATE (n:v)-[:e]->(:v), (n)-[:e]->(:v) RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------ - {"id": 844424930131992, "label": "v", "properties": {}}::vertex + a +------------------------------------------------------------------- + {"id": 844424930131992, "label": ["v"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_delete', $$MATCH(n1)-[e]->() DETACH DELETE n1 RETURN n1, e$$) AS (a agtype, b agtype); - a | b ------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------ - {"id": 844424930131992, "label": "v", "properties": {}}::vertex | {"id": 1125899906842635, "label": "e", "end_id": 844424930131993, "start_id": 844424930131992, "properties": {}}::edge - {"id": 844424930131992, "label": "v", "properties": {}}::vertex | {"id": 1125899906842636, "label": "e", "end_id": 844424930131994, "start_id": 844424930131992, "properties": {}}::edge + a | b +-------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------ + {"id": 844424930131992, "label": ["v"], "properties": {}}::vertex | {"id": 1125899906842635, "label": "e", "end_id": 844424930131993, "start_id": 844424930131992, "properties": {}}::edge + {"id": 844424930131992, "label": ["v"], "properties": {}}::vertex | {"id": 1125899906842636, "label": "e", "end_id": 844424930131994, "start_id": 844424930131992, "properties": {}}::edge (2 rows) --Cleanup SELECT * FROM cypher('cypher_delete', $$MATCH(n) DELETE n RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------ - {"id": 844424930131993, "label": "v", "properties": {}}::vertex - {"id": 844424930131994, "label": "v", "properties": {}}::vertex + a +------------------------------------------------------------------- + {"id": 844424930131993, "label": ["v"], "properties": {}}::vertex + {"id": 844424930131994, "label": ["v"], "properties": {}}::vertex (2 rows) SELECT * FROM cypher('cypher_delete', $$MATCH(n) RETURN n$$) AS (a agtype); @@ -288,10 +288,10 @@ SELECT * FROM cypher('cypher_delete', $$MATCH(n)-[e]->() DETACH DELETE n CREATE ERROR: vertex assigned to variable n was deleted --Cleanup SELECT * FROM cypher('cypher_delete', $$MATCH(n) DETACH DELETE n RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------ - {"id": 844424930131995, "label": "v", "properties": {}}::vertex - {"id": 844424930131996, "label": "v", "properties": {}}::vertex + a +------------------------------------------------------------------- + {"id": 844424930131995, "label": ["v"], "properties": {}}::vertex + {"id": 844424930131996, "label": ["v"], "properties": {}}::vertex (2 rows) SELECT * FROM cypher('cypher_delete', $$MATCH(n) RETURN n$$) AS (a agtype); @@ -309,9 +309,9 @@ SELECT * FROM cypher('cypher_delete', $$MATCH(n)-[e]->(m) DETACH DELETE n CREATE ERROR: vertex assigned to variable m was deleted --Cleanup SELECT * FROM cypher('cypher_delete', $$MATCH(n) DETACH DELETE n RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------ - {"id": 844424930131997, "label": "v", "properties": {}}::vertex + a +------------------------------------------------------------------- + {"id": 844424930131997, "label": ["v"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_delete', $$MATCH(n) RETURN n$$) AS (a agtype); @@ -334,11 +334,11 @@ SELECT * FROM cypher('cypher_delete', $$MATCH(n)-[e]->(m) DETACH DELETE n CREATE ERROR: vertex assigned to variable m was deleted --Cleanup SELECT * FROM cypher('cypher_delete', $$MATCH(n) DETACH DELETE n RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------ - {"id": 844424930131998, "label": "v", "properties": {}}::vertex - {"id": 844424930131999, "label": "v", "properties": {}}::vertex - {"id": 844424930132000, "label": "v", "properties": {}}::vertex + a +------------------------------------------------------------------- + {"id": 844424930131998, "label": ["v"], "properties": {}}::vertex + {"id": 844424930131999, "label": ["v"], "properties": {}}::vertex + {"id": 844424930132000, "label": ["v"], "properties": {}}::vertex (3 rows) SELECT * FROM cypher('cypher_delete', $$MATCH(n) RETURN n$$) AS (a agtype); @@ -353,9 +353,9 @@ SELECT * FROM cypher('cypher_delete', $$CREATE (:v)$$) AS (a agtype); (0 rows) SELECT * FROM cypher('cypher_delete', $$MATCH(n) SET n.i = 0 DELETE n RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------------ - {"id": 844424930132001, "label": "v", "properties": {"i": 0}}::vertex + a +------------------------------------------------------------------------- + {"id": 844424930132001, "label": ["v"], "properties": {"i": 0}}::vertex (1 row) --Cleanup @@ -371,9 +371,9 @@ SELECT * FROM cypher('cypher_delete', $$CREATE (:v)$$) AS (a agtype); (0 rows) SELECT * FROM cypher('cypher_delete', $$MATCH(n) DELETE n SET n.i = 0 RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------------ - {"id": 844424930132002, "label": "v", "properties": {"i": 0}}::vertex + a +------------------------------------------------------------------------- + {"id": 844424930132002, "label": ["v"], "properties": {"i": 0}}::vertex (1 row) --Cleanup @@ -397,9 +397,9 @@ SELECT * FROM cypher('cypher_delete', $$MATCH(n)-[e]->(m) DETACH DELETE n SET e. --Cleanup --Note: Expect 1 vertex SELECT * FROM cypher('cypher_delete', $$MATCH(n) DELETE n RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------ - {"id": 844424930132004, "label": "v", "properties": {}}::vertex + a +------------------------------------------------------------------- + {"id": 844424930132004, "label": ["v"], "properties": {}}::vertex (1 row) --Test 18: @@ -416,9 +416,9 @@ SELECT * FROM cypher('cypher_delete', $$MATCH(n)-[e]->(m) SET e.i = 1 DETACH DEL --Cleanup SELECT * FROM cypher('cypher_delete', $$MATCH(n) DELETE n RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------ - {"id": 844424930132006, "label": "v", "properties": {}}::vertex + a +------------------------------------------------------------------- + {"id": 844424930132006, "label": ["v"], "properties": {}}::vertex (1 row) --Test 19: @@ -431,9 +431,9 @@ SELECT * FROM cypher('cypher_delete', $$MATCH (n) DELETE n CREATE (n)-[:e]->(:v) ERROR: vertex assigned to variable n was deleted --Cleanup SELECT * FROM cypher('cypher_delete', $$MATCH(n) DELETE n RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------ - {"id": 844424930132007, "label": "v", "properties": {}}::vertex + a +------------------------------------------------------------------- + {"id": 844424930132007, "label": ["v"], "properties": {}}::vertex (1 row) --Test 20 Undefined Reference: @@ -449,9 +449,9 @@ SELECT * FROM cypher('cypher_delete', $$CREATE (v:v)$$) AS (a agtype); PREPARE d AS SELECT * FROM cypher('cypher_delete', $$MATCH (v) DELETE (v) RETURN v$$) AS (a agtype); EXECUTE d; - a ------------------------------------------------------------------ - {"id": 844424930132008, "label": "v", "properties": {}}::vertex + a +------------------------------------------------------------------- + {"id": 844424930132008, "label": ["v"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_delete', $$CREATE (v:v)$$) AS (a agtype); @@ -460,9 +460,9 @@ SELECT * FROM cypher('cypher_delete', $$CREATE (v:v)$$) AS (a agtype); (0 rows) EXECUTE d; - a ------------------------------------------------------------------ - {"id": 844424930132009, "label": "v", "properties": {}}::vertex + a +------------------------------------------------------------------- + {"id": 844424930132009, "label": ["v"], "properties": {}}::vertex (1 row) --Test 22 pl/pgsql Functions @@ -481,9 +481,9 @@ BEGIN END $BODY$; SELECT delete_test(); - delete_test ------------------------------------------------------------------ - {"id": 844424930132010, "label": "v", "properties": {}}::vertex + delete_test +------------------------------------------------------------------- + {"id": 844424930132010, "label": ["v"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_delete', $$CREATE (v:v)$$) AS (a agtype); @@ -492,9 +492,9 @@ SELECT * FROM cypher('cypher_delete', $$CREATE (v:v)$$) AS (a agtype); (0 rows) SELECT delete_test(); - delete_test ------------------------------------------------------------------ - {"id": 844424930132011, "label": "v", "properties": {}}::vertex + delete_test +------------------------------------------------------------------- + {"id": 844424930132011, "label": ["v"], "properties": {}}::vertex (1 row) -- Clean Up @@ -515,10 +515,10 @@ SELECT * FROM cypher('cypher_delete', $$CREATE (n:v)-[:e2]->()$$) AS (a agtype); (0 rows) SELECT * FROM cypher('cypher_delete', $$MATCH p=()-[]->() RETURN p$$) AS (a agtype); - a ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 844424930132012, "label": "v", "properties": {}}::vertex, {"id": 1125899906842643, "label": "e", "end_id": 281474976710657, "start_id": 844424930132012, "properties": {}}::edge, {"id": 281474976710657, "label": "", "properties": {}}::vertex]::path - [{"id": 844424930132013, "label": "v", "properties": {}}::vertex, {"id": 2251799813685249, "label": "e2", "end_id": 281474976710658, "start_id": 844424930132013, "properties": {}}::edge, {"id": 281474976710658, "label": "", "properties": {}}::vertex]::path + a +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 844424930132012, "label": ["v"], "properties": {}}::vertex, {"id": 1125899906842643, "label": "e", "end_id": 281474976710657, "start_id": 844424930132012, "properties": {}}::edge, {"id": 281474976710657, "label": [], "properties": {}}::vertex]::path + [{"id": 844424930132013, "label": ["v"], "properties": {}}::vertex, {"id": 2251799813685249, "label": "e2", "end_id": 281474976710658, "start_id": 844424930132013, "properties": {}}::edge, {"id": 281474976710658, "label": [], "properties": {}}::vertex]::path (2 rows) SELECT * FROM cypher('cypher_delete', $$MATCH(n)-[e]->(m) DELETE e$$) AS (a agtype); @@ -533,12 +533,12 @@ SELECT * FROM cypher('cypher_delete', $$MATCH p=()-[]->() RETURN p$$) AS (a agty -- Clean Up SELECT * FROM cypher('cypher_delete', $$MATCH(n) DELETE n RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------ - {"id": 281474976710657, "label": "", "properties": {}}::vertex - {"id": 281474976710658, "label": "", "properties": {}}::vertex - {"id": 844424930132012, "label": "v", "properties": {}}::vertex - {"id": 844424930132013, "label": "v", "properties": {}}::vertex + a +------------------------------------------------------------------- + {"id": 281474976710657, "label": [], "properties": {}}::vertex + {"id": 281474976710658, "label": [], "properties": {}}::vertex + {"id": 844424930132012, "label": ["v"], "properties": {}}::vertex + {"id": 844424930132013, "label": ["v"], "properties": {}}::vertex (4 rows) --Test 24 @@ -553,10 +553,10 @@ SELECT * FROM cypher('cypher_delete', $$CREATE (n:v)-[:e2]->()$$) AS (a agtype); (0 rows) SELECT * FROM cypher('cypher_delete', $$MATCH p=()-[]->() RETURN p$$) AS (a agtype); - a ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 844424930132014, "label": "v", "properties": {}}::vertex, {"id": 1125899906842644, "label": "e", "end_id": 281474976710659, "start_id": 844424930132014, "properties": {}}::edge, {"id": 281474976710659, "label": "", "properties": {}}::vertex]::path - [{"id": 844424930132015, "label": "v", "properties": {}}::vertex, {"id": 2251799813685250, "label": "e2", "end_id": 281474976710660, "start_id": 844424930132015, "properties": {}}::edge, {"id": 281474976710660, "label": "", "properties": {}}::vertex]::path + a +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 844424930132014, "label": ["v"], "properties": {}}::vertex, {"id": 1125899906842644, "label": "e", "end_id": 281474976710659, "start_id": 844424930132014, "properties": {}}::edge, {"id": 281474976710659, "label": [], "properties": {}}::vertex]::path + [{"id": 844424930132015, "label": ["v"], "properties": {}}::vertex, {"id": 2251799813685250, "label": "e2", "end_id": 281474976710660, "start_id": 844424930132015, "properties": {}}::edge, {"id": 281474976710660, "label": [], "properties": {}}::vertex]::path (2 rows) SELECT * FROM cypher('cypher_delete', $$MATCH(n)-[]->() DETACH DELETE n$$) AS (a agtype); @@ -573,28 +573,28 @@ SELECT * FROM cypher('cypher_delete', $$MATCH p=()-[]->() RETURN p$$) AS (a agty SELECT * FROM cypher('cypher_delete', $$MATCH(n) DELETE n RETURN n$$) AS (a agtype); a ---------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {}}::vertex - {"id": 281474976710660, "label": "", "properties": {}}::vertex + {"id": 281474976710659, "label": [], "properties": {}}::vertex + {"id": 281474976710660, "label": [], "properties": {}}::vertex (2 rows) -- test DELETE in transaction block SELECT * FROM cypher('cypher_delete', $$CREATE (u:vertices) RETURN u $$) AS (result agtype); - result -------------------------------------------------------------------------- - {"id": 2533274790395905, "label": "vertices", "properties": {}}::vertex + result +--------------------------------------------------------------------------- + {"id": 2533274790395905, "label": ["vertices"], "properties": {}}::vertex (1 row) BEGIN; SELECT * FROM cypher('cypher_delete', $$MATCH (u:vertices) RETURN u $$) AS (result agtype); - result -------------------------------------------------------------------------- - {"id": 2533274790395905, "label": "vertices", "properties": {}}::vertex + result +--------------------------------------------------------------------------- + {"id": 2533274790395905, "label": ["vertices"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_delete', $$MATCH (u:vertices) DELETE u RETURN u $$) AS (result agtype); - result -------------------------------------------------------------------------- - {"id": 2533274790395905, "label": "vertices", "properties": {}}::vertex + result +--------------------------------------------------------------------------- + {"id": 2533274790395905, "label": ["vertices"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_delete', $$MATCH (u:vertices) RETURN u $$) AS (result agtype); @@ -603,21 +603,21 @@ SELECT * FROM cypher('cypher_delete', $$MATCH (u:vertices) RETURN u $$) AS (resu (0 rows) SELECT * FROM cypher('cypher_delete', $$CREATE (u:vertices) RETURN u $$) AS (result agtype); - result -------------------------------------------------------------------------- - {"id": 2533274790395906, "label": "vertices", "properties": {}}::vertex + result +--------------------------------------------------------------------------- + {"id": 2533274790395906, "label": ["vertices"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_delete', $$MATCH (u:vertices) RETURN u $$) AS (result agtype); - result -------------------------------------------------------------------------- - {"id": 2533274790395906, "label": "vertices", "properties": {}}::vertex + result +--------------------------------------------------------------------------- + {"id": 2533274790395906, "label": ["vertices"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_delete', $$MATCH (u:vertices) DELETE u RETURN u $$) AS (result agtype); - result -------------------------------------------------------------------------- - {"id": 2533274790395906, "label": "vertices", "properties": {}}::vertex + result +--------------------------------------------------------------------------- + {"id": 2533274790395906, "label": ["vertices"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_delete', $$MATCH (u:vertices) RETURN u $$) AS (result agtype); @@ -626,21 +626,21 @@ SELECT * FROM cypher('cypher_delete', $$MATCH (u:vertices) RETURN u $$) AS (resu (0 rows) SELECT * FROM cypher('cypher_delete', $$CREATE (u:vertices) RETURN u $$) AS (result agtype); - result -------------------------------------------------------------------------- - {"id": 2533274790395907, "label": "vertices", "properties": {}}::vertex + result +--------------------------------------------------------------------------- + {"id": 2533274790395907, "label": ["vertices"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_delete', $$MATCH (u:vertices) RETURN u $$) AS (result agtype); - result -------------------------------------------------------------------------- - {"id": 2533274790395907, "label": "vertices", "properties": {}}::vertex + result +--------------------------------------------------------------------------- + {"id": 2533274790395907, "label": ["vertices"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_delete', $$MATCH (u:vertices) DELETE u SET u.i = 1 RETURN u $$) AS (result agtype); - result -------------------------------------------------------------------------------- - {"id": 2533274790395907, "label": "vertices", "properties": {"i": 1}}::vertex + result +--------------------------------------------------------------------------------- + {"id": 2533274790395907, "label": ["vertices"], "properties": {"i": 1}}::vertex (1 row) SELECT * FROM cypher('cypher_delete', $$MATCH (u:vertices) RETURN u $$) AS (result agtype); diff --git a/regress/expected/cypher_match.out b/regress/expected/cypher_match.out index e25584788..7cd2287b8 100644 --- a/regress/expected/cypher_match.out +++ b/regress/expected/cypher_match.out @@ -41,11 +41,11 @@ SELECT * FROM cypher('cypher_match', $$CREATE (:v {i: 1})$$) AS (a agtype); (0 rows) SELECT * FROM cypher('cypher_match', $$MATCH (n:v) RETURN n$$) AS (n agtype); - n ------------------------------------------------------------------------ - {"id": 844424930131969, "label": "v", "properties": {}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"i": 0}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": 1}}::vertex + n +------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["v"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"i": 0}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": 1}}::vertex (3 rows) SELECT * FROM cypher('cypher_match', $$MATCH (n:v) RETURN n.i$$) AS (i agtype); @@ -77,37 +77,37 @@ $$) AS (a agtype); SELECT * FROM cypher('cypher_match', $$ MATCH p=(:v1)-[:e1]-(:v1)-[:e1]-(:v1) RETURN p $$) AS (a agtype); - a ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex]::path - [{"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex]::path + a +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex]::path + [{"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex]::path (2 rows) SELECT * FROM cypher('cypher_match', $$ MATCH p=(a:v1)-[]-()-[]-() RETURN a $$) AS (a agtype); - a ----------------------------------------------------------------------------------- - {"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex - {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex + a +------------------------------------------------------------------------------------ + {"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex + {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex (2 rows) SELECT * FROM cypher('cypher_match', $$ MATCH ()-[]-()-[]-(a:v1) RETURN a $$) AS (a agtype); - a ----------------------------------------------------------------------------------- - {"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex - {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex + a +------------------------------------------------------------------------------------ + {"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex + {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex (2 rows) SELECT * FROM cypher('cypher_match', $$ MATCH ()-[]-(a:v1)-[]-() RETURN a $$) AS (a agtype); - a ---------------------------------------------------------------------------------- - {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex - {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex + a +----------------------------------------------------------------------------------- + {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex + {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex (2 rows) SELECT * FROM cypher('cypher_match', $$ @@ -122,9 +122,9 @@ $$) AS (a agtype); SELECT * FROM cypher('cypher_match', $$ MATCH (a:v1)-[]->(), ()-[]->(a) RETURN a $$) AS (a agtype); - a ---------------------------------------------------------------------------------- - {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex + a +----------------------------------------------------------------------------------- + {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex (1 row) SELECT * FROM cypher('cypher_match', $$ @@ -172,51 +172,51 @@ $$) AS (a agtype); SELECT * FROM cypher('cypher_match', $$ MATCH (a)-[]-()-[]-(:v1) RETURN a $$) AS (a agtype); - a ----------------------------------------------------------------------------------- - {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex - {"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex + a +------------------------------------------------------------------------------------ + {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex + {"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex (2 rows) -- Right Path Test SELECT * FROM cypher('cypher_match', $$ MATCH (a:v1)-[:e1]->(b:v1)-[:e1]->(c:v1) RETURN a, b, c $$) AS (a agtype, b agtype, c agtype); - a | b | c -----------------------------------------------------------------------------------+---------------------------------------------------------------------------------+------------------------------------------------------------------------------ - {"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex | {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex | {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex + a | b | c +------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+-------------------------------------------------------------------------------- + {"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex | {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex | {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH p=(a:v1)-[]-()-[]->() RETURN a $$) AS (a agtype); - a ----------------------------------------------------------------------------------- - {"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex + a +------------------------------------------------------------------------------------ + {"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH p=(a:v1)-[]->()-[]-() RETURN a $$) AS (a agtype); - a ----------------------------------------------------------------------------------- - {"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex + a +------------------------------------------------------------------------------------ + {"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH ()-[]-()-[]->(a:v1) RETURN a $$) AS (a agtype); - a ------------------------------------------------------------------------------- - {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex + a +-------------------------------------------------------------------------------- + {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH ()-[]-(a:v1)-[]->() RETURN a $$) AS (a agtype); - a ---------------------------------------------------------------------------------- - {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex + a +----------------------------------------------------------------------------------- + {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex (1 row) SELECT * FROM cypher('cypher_match', $$ @@ -258,41 +258,41 @@ $$) AS (a agtype); SELECT * FROM cypher('cypher_match', $$ MATCH (a:v1)<-[:e1]-(b:v1)<-[:e1]-(c:v1) RETURN a, b, c $$) AS (a agtype, b agtype, c agtype); - a | b | c -------------------------------------------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------------- - {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex | {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex | {"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex + a | b | c +--------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------ + {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex | {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex | {"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH p=(a:v1)<-[]-()-[]-() RETURN a $$) AS (a agtype); - a ------------------------------------------------------------------------------- - {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex + a +-------------------------------------------------------------------------------- + {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH p=(a:v1)-[]-()<-[]-() RETURN a $$) AS (a agtype); - a ------------------------------------------------------------------------------- - {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex + a +-------------------------------------------------------------------------------- + {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH ()<-[]-()-[]-(a:v1) RETURN a $$) AS (a agtype); - a ----------------------------------------------------------------------------------- - {"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex + a +------------------------------------------------------------------------------------ + {"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH ()<-[]-(a:v1)-[]-() RETURN a $$) AS (a agtype); - a ---------------------------------------------------------------------------------- - {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex + a +----------------------------------------------------------------------------------- + {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex (1 row) SELECT * FROM cypher('cypher_match', $$ @@ -334,24 +334,24 @@ SELECT * FROM cypher('cypher_match', $$ MATCH p=(n)-[]->() RETURN p $$) AS (i agtype); - i ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex]::path - [{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex]::path - [{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex]::path - [{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex]::path + i +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex]::path + [{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263939, "label": ["v2"], "properties": {"id": "end"}}::vertex]::path + [{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex]::path + [{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263939, "label": ["v2"], "properties": {"id": "end"}}::vertex]::path (4 rows) SELECT * FROM cypher('cypher_match', $$ MATCH ()-[]-(n:v2) RETURN n $$) AS (i agtype); - i ----------------------------------------------------------------------------------- - {"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex - {"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex - {"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex - {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex + i +------------------------------------------------------------------------------------ + {"id": 1688849860263939, "label": ["v2"], "properties": {"id": "end"}}::vertex + {"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex + {"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex + {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex (4 rows) SELECT * FROM cypher('cypher_match', $$ @@ -359,16 +359,16 @@ SELECT * FROM cypher('cypher_match', $$ MATCH p=()-[]->() RETURN p $$) AS (i agtype); - i ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex]::path - [{"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex]::path - [{"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex]::path - [{"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex]::path - [{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex]::path - [{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex]::path - [{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex]::path - [{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex]::path + i +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex]::path + [{"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex]::path + [{"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex]::path + [{"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex]::path + [{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex]::path + [{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex]::path + [{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263939, "label": ["v2"], "properties": {"id": "end"}}::vertex]::path + [{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263939, "label": ["v2"], "properties": {"id": "end"}}::vertex]::path (8 rows) SELECT * FROM cypher('cypher_match', $$ @@ -376,16 +376,16 @@ SELECT * FROM cypher('cypher_match', $$ MATCH p=()-[]->() RETURN p $$) AS (i agtype); - i ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex]::path - [{"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex]::path - [{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex]::path - [{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex]::path - [{"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex]::path - [{"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex]::path - [{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex]::path - [{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex]::path + i +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex]::path + [{"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex]::path + [{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex]::path + [{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263939, "label": ["v2"], "properties": {"id": "end"}}::vertex]::path + [{"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex]::path + [{"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex]::path + [{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex]::path + [{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263939, "label": ["v2"], "properties": {"id": "end"}}::vertex]::path (8 rows) --Convergent Path Tests @@ -448,9 +448,9 @@ SELECT * FROM cypher('cypher_match', $$ where a.id = 'initial' RETURN con_path $$) AS (con_path agtype); - con_path ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 2251799813685249, "label": "v3", "properties": {"id": "initial"}}::vertex, {"id": 2533274790395906, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685249, "properties": {}}::edge, {"id": 2251799813685250, "label": "v3", "properties": {"id": "middle"}}::vertex, {"id": 2533274790395905, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685251, "properties": {}}::edge, {"id": 2251799813685251, "label": "v3", "properties": {"id": "end"}}::vertex]::path + con_path +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 2251799813685249, "label": ["v3"], "properties": {"id": "initial"}}::vertex, {"id": 2533274790395906, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685249, "properties": {}}::edge, {"id": 2251799813685250, "label": ["v3"], "properties": {"id": "middle"}}::vertex, {"id": 2533274790395905, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685251, "properties": {}}::edge, {"id": 2251799813685251, "label": ["v3"], "properties": {"id": "end"}}::vertex]::path (1 row) SELECT * FROM cypher('cypher_match', $$ @@ -458,9 +458,9 @@ SELECT * FROM cypher('cypher_match', $$ where b.id = 'initial' RETURN div_path $$) AS (div_path agtype); - div_path ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex]::path + div_path +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263939, "label": ["v2"], "properties": {"id": "end"}}::vertex]::path (1 row) SELECT * FROM cypher('cypher_match', $$ @@ -468,9 +468,9 @@ SELECT * FROM cypher('cypher_match', $$ where a.id = 'initial' RETURN b $$) AS (con_path agtype); - con_path ------------------------------------------------------------------------------- - {"id": 2251799813685251, "label": "v3", "properties": {"id": "end"}}::vertex + con_path +-------------------------------------------------------------------------------- + {"id": 2251799813685251, "label": ["v3"], "properties": {"id": "end"}}::vertex (1 row) --Patterns @@ -479,9 +479,9 @@ SELECT * FROM cypher('cypher_match', $$ where a.id = 'initial' RETURN p $$) AS (p agtype); - p ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex]::path + p +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex]::path (1 row) SELECT * FROM cypher('cypher_match', $$ @@ -490,20 +490,20 @@ SELECT * FROM cypher('cypher_match', $$ and b.id = 'initial' RETURN con_path, div_path $$) AS (con_path agtype, div_path agtype); - con_path | div_path ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 2251799813685249, "label": "v3", "properties": {"id": "initial"}}::vertex, {"id": 2533274790395906, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685249, "properties": {}}::edge, {"id": 2251799813685250, "label": "v3", "properties": {"id": "middle"}}::vertex, {"id": 2533274790395905, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685251, "properties": {}}::edge, {"id": 2251799813685251, "label": "v3", "properties": {"id": "end"}}::vertex]::path | [{"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex]::path + con_path | div_path +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 2251799813685249, "label": ["v3"], "properties": {"id": "initial"}}::vertex, {"id": 2533274790395906, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685249, "properties": {}}::edge, {"id": 2251799813685250, "label": ["v3"], "properties": {"id": "middle"}}::vertex, {"id": 2533274790395905, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685251, "properties": {}}::edge, {"id": 2251799813685251, "label": ["v3"], "properties": {"id": "end"}}::vertex]::path | [{"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263939, "label": ["v2"], "properties": {"id": "end"}}::vertex]::path (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH (a:v), p=()-[]->()-[]->() RETURN a.i, p $$) AS (i agtype, p agtype); - i | p ----+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - | [{"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex]::path - 0 | [{"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex]::path - 1 | [{"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex]::path + i | p +---+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + | [{"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex]::path + 0 | [{"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex]::path + 1 | [{"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex]::path (3 rows) --Multiple Match Clauses @@ -513,9 +513,9 @@ SELECT * FROM cypher('cypher_match', $$ MATCH p=(a)-[]-()-[]-() RETURN p $$) AS (p agtype); - p ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex]::path + p +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex]::path (1 row) SELECT * FROM cypher('cypher_match', $$ @@ -523,11 +523,11 @@ SELECT * FROM cypher('cypher_match', $$ MATCH p=()-[]->()-[]->() RETURN a.i, p $$) AS (i agtype, p agtype); - i | p ----+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - | [{"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex]::path - 0 | [{"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex]::path - 1 | [{"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex]::path + i | p +---+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + | [{"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex]::path + 0 | [{"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex]::path + 1 | [{"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex]::path (3 rows) SELECT * FROM cypher('cypher_match', $$ @@ -609,7 +609,7 @@ SELECT * FROM cypher('cypher_match', $$ AS (p agtype); p ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"int_key": 1, "map_key": {"key": "value"}, "list_key": [1, 2, 3], "float_key": 3.14, "string_key": "test"}}::vertex + {"id": 281474976710657, "label": [], "properties": {"int_key": 1, "map_key": {"key": "value"}, "list_key": [1, 2, 3], "float_key": 3.14, "string_key": "test"}}::vertex (1 row) SELECT * FROM cypher('cypher_match', @@ -617,7 +617,7 @@ SELECT * FROM cypher('cypher_match', AS (p agtype); p ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"int_key": 1, "map_key": {"key": "value"}, "list_key": [1, 2, 3], "float_key": 3.14, "string_key": "test"}}::vertex + {"id": 281474976710657, "label": [], "properties": {"int_key": 1, "map_key": {"key": "value"}, "list_key": [1, 2, 3], "float_key": 3.14, "string_key": "test"}}::vertex (1 row) SELECT * FROM cypher('cypher_match', @@ -625,7 +625,7 @@ SELECT * FROM cypher('cypher_match', AS (p agtype); p ---------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710658, "label": "", "properties": {"lst": [1, null, 3.14, "string", {"key": "value"}, []]}}::vertex + {"id": 281474976710658, "label": [], "properties": {"lst": [1, null, 3.14, "string", {"key": "value"}, []]}}::vertex (1 row) SELECT * FROM cypher('cypher_match', @@ -645,7 +645,7 @@ EXECUTE property_ps(agtype_build_map('props', agtype_build_map('string_key', 'test'))); p ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"int_key": 1, "map_key": {"key": "value"}, "list_key": [1, 2, 3], "float_key": 3.14, "string_key": "test"}}::vertex + {"id": 281474976710657, "label": [], "properties": {"int_key": 1, "map_key": {"key": "value"}, "list_key": [1, 2, 3], "float_key": 3.14, "string_key": "test"}}::vertex (1 row) -- need a following RETURN clause (should fail) @@ -745,12 +745,12 @@ $$) AS (r0 agtype, r1 agtype); SELECT * FROM cypher('cypher_match', $$ MATCH p0=()-[:e1]->() MATCH p1=()-[:e2]->() RETURN p1 $$) AS (p1 agtype); - p1 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex]::path - [{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex]::path - [{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex]::path - [{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex]::path + p1 +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex]::path + [{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex]::path + [{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263939, "label": ["v2"], "properties": {"id": "end"}}::vertex]::path + [{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263939, "label": ["v2"], "properties": {"id": "end"}}::vertex]::path (4 rows) SELECT * FROM cypher('cypher_match', $$ @@ -804,20 +804,20 @@ SELECT * FROM cypher('cypher_match', $$ $$) AS (r1 agtype); r1 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"int_key": 1, "map_key": {"key": "value"}, "list_key": [1, 2, 3], "float_key": 3.14, "string_key": "test"}}::vertex - {"id": 281474976710658, "label": "", "properties": {"lst": [1, null, 3.14, "string", {"key": "value"}, []]}}::vertex - {"id": 844424930131969, "label": "v", "properties": {}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"i": 0}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": 1}}::vertex - {"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex - {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex - {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex - {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex - {"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex - {"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex - {"id": 2251799813685249, "label": "v3", "properties": {"id": "initial"}}::vertex - {"id": 2251799813685250, "label": "v3", "properties": {"id": "middle"}}::vertex - {"id": 2251799813685251, "label": "v3", "properties": {"id": "end"}}::vertex + {"id": 281474976710657, "label": [], "properties": {"int_key": 1, "map_key": {"key": "value"}, "list_key": [1, 2, 3], "float_key": 3.14, "string_key": "test"}}::vertex + {"id": 281474976710658, "label": [], "properties": {"lst": [1, null, 3.14, "string", {"key": "value"}, []]}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"i": 0}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": 1}}::vertex + {"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex + {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex + {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex + {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex + {"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex + {"id": 1688849860263939, "label": ["v2"], "properties": {"id": "end"}}::vertex + {"id": 2251799813685249, "label": ["v3"], "properties": {"id": "initial"}}::vertex + {"id": 2251799813685250, "label": ["v3"], "properties": {"id": "middle"}}::vertex + {"id": 2251799813685251, "label": ["v3"], "properties": {"id": "end"}}::vertex (14 rows) SELECT * FROM cypher('cypher_match', $$ @@ -1028,20 +1028,20 @@ SELECT * FROM cypher('cypher_match', $$ $$) AS (p agtype); p --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710657, "label": "", "properties": {"int_key": 1, "map_key": {"key": "value"}, "list_key": [1, 2, 3], "float_key": 3.14, "string_key": "test"}}::vertex]::path - [{"id": 281474976710658, "label": "", "properties": {"lst": [1, null, 3.14, "string", {"key": "value"}, []]}}::vertex]::path - [{"id": 844424930131969, "label": "v", "properties": {}}::vertex]::path - [{"id": 844424930131970, "label": "v", "properties": {"i": 0}}::vertex]::path - [{"id": 844424930131971, "label": "v", "properties": {"i": 1}}::vertex]::path - [{"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex]::path - [{"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex]::path - [{"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex]::path - [{"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex]::path - [{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex]::path - [{"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex]::path - [{"id": 2251799813685249, "label": "v3", "properties": {"id": "initial"}}::vertex]::path - [{"id": 2251799813685250, "label": "v3", "properties": {"id": "middle"}}::vertex]::path - [{"id": 2251799813685251, "label": "v3", "properties": {"id": "end"}}::vertex]::path + [{"id": 281474976710657, "label": [], "properties": {"int_key": 1, "map_key": {"key": "value"}, "list_key": [1, 2, 3], "float_key": 3.14, "string_key": "test"}}::vertex]::path + [{"id": 281474976710658, "label": [], "properties": {"lst": [1, null, 3.14, "string", {"key": "value"}, []]}}::vertex]::path + [{"id": 844424930131969, "label": ["v"], "properties": {}}::vertex]::path + [{"id": 844424930131970, "label": ["v"], "properties": {"i": 0}}::vertex]::path + [{"id": 844424930131971, "label": ["v"], "properties": {"i": 1}}::vertex]::path + [{"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex]::path + [{"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex]::path + [{"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex]::path + [{"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex]::path + [{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex]::path + [{"id": 1688849860263939, "label": ["v2"], "properties": {"id": "end"}}::vertex]::path + [{"id": 2251799813685249, "label": ["v3"], "properties": {"id": "initial"}}::vertex]::path + [{"id": 2251799813685250, "label": ["v3"], "properties": {"id": "middle"}}::vertex]::path + [{"id": 2251799813685251, "label": ["v3"], "properties": {"id": "end"}}::vertex]::path (14 rows) -- @@ -1049,38 +1049,38 @@ $$) AS (p agtype); -- SELECT * FROM cypher('cypher_match', $$MATCH (u)-[e]->(v) RETURN u, e, v $$) AS (u agtype, e agtype, v agtype); - u | e | v -----------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------- - {"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex | {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge | {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex - {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex | {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge | {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex - {"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex | {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge | {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex - {"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex | {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge | {"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex - {"id": 2251799813685249, "label": "v3", "properties": {"id": "initial"}}::vertex | {"id": 2533274790395906, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685249, "properties": {}}::edge | {"id": 2251799813685250, "label": "v3", "properties": {"id": "middle"}}::vertex - {"id": 2251799813685251, "label": "v3", "properties": {"id": "end"}}::vertex | {"id": 2533274790395905, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685251, "properties": {}}::edge | {"id": 2251799813685250, "label": "v3", "properties": {"id": "middle"}}::vertex + u | e | v +------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------ + {"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex | {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge | {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex + {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex | {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge | {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex + {"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex | {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge | {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex + {"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex | {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge | {"id": 1688849860263939, "label": ["v2"], "properties": {"id": "end"}}::vertex + {"id": 2251799813685249, "label": ["v3"], "properties": {"id": "initial"}}::vertex | {"id": 2533274790395906, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685249, "properties": {}}::edge | {"id": 2251799813685250, "label": ["v3"], "properties": {"id": "middle"}}::vertex + {"id": 2251799813685251, "label": ["v3"], "properties": {"id": "end"}}::vertex | {"id": 2533274790395905, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685251, "properties": {}}::edge | {"id": 2251799813685250, "label": ["v3"], "properties": {"id": "middle"}}::vertex (6 rows) SELECT * FROM cypher('cypher_match', $$MATCH (u)-[e]->(v) WHERE EXISTS((u)-[e]->(v)) RETURN u, e, v $$) AS (u agtype, e agtype, v agtype); - u | e | v -----------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------- - {"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex | {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge | {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex - {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex | {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge | {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex - {"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex | {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge | {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex - {"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex | {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge | {"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex - {"id": 2251799813685249, "label": "v3", "properties": {"id": "initial"}}::vertex | {"id": 2533274790395906, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685249, "properties": {}}::edge | {"id": 2251799813685250, "label": "v3", "properties": {"id": "middle"}}::vertex - {"id": 2251799813685251, "label": "v3", "properties": {"id": "end"}}::vertex | {"id": 2533274790395905, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685251, "properties": {}}::edge | {"id": 2251799813685250, "label": "v3", "properties": {"id": "middle"}}::vertex + u | e | v +------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------ + {"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex | {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge | {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex + {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex | {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge | {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex + {"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex | {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge | {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex + {"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex | {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge | {"id": 1688849860263939, "label": ["v2"], "properties": {"id": "end"}}::vertex + {"id": 2251799813685249, "label": ["v3"], "properties": {"id": "initial"}}::vertex | {"id": 2533274790395906, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685249, "properties": {}}::edge | {"id": 2251799813685250, "label": ["v3"], "properties": {"id": "middle"}}::vertex + {"id": 2251799813685251, "label": ["v3"], "properties": {"id": "end"}}::vertex | {"id": 2533274790395905, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685251, "properties": {}}::edge | {"id": 2251799813685250, "label": ["v3"], "properties": {"id": "middle"}}::vertex (6 rows) -- Property Constraint in EXISTS SELECT * FROM cypher('cypher_match', $$MATCH (u) WHERE EXISTS((u)-[]->({id: "middle"})) RETURN u $$) AS (u agtype); - u ----------------------------------------------------------------------------------- - {"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex - {"id": 2251799813685249, "label": "v3", "properties": {"id": "initial"}}::vertex - {"id": 2251799813685251, "label": "v3", "properties": {"id": "end"}}::vertex + u +------------------------------------------------------------------------------------ + {"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex + {"id": 2251799813685249, "label": ["v3"], "properties": {"id": "initial"}}::vertex + {"id": 2251799813685251, "label": ["v3"], "properties": {"id": "end"}}::vertex (3 rows) SELECT * FROM cypher('cypher_match', @@ -1117,56 +1117,56 @@ $$) AS (a agtype); SELECT * FROM cypher('cypher_match', $$MATCH (u)-[e]->(v) WHERE EXISTS((u)-[e]->(v)) RETURN u, e, v $$) AS (u agtype, e agtype, v agtype); - u | e | v -------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------ - {"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex | {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge | {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex - {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex | {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge | {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex - {"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex | {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge | {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex - {"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex | {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge | {"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex - {"id": 2251799813685249, "label": "v3", "properties": {"id": "initial"}}::vertex | {"id": 2533274790395906, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685249, "properties": {}}::edge | {"id": 2251799813685250, "label": "v3", "properties": {"id": "middle"}}::vertex - {"id": 2251799813685251, "label": "v3", "properties": {"id": "end"}}::vertex | {"id": 2533274790395905, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685251, "properties": {}}::edge | {"id": 2251799813685250, "label": "v3", "properties": {"id": "middle"}}::vertex - {"id": 2814749767106561, "label": "loop", "properties": {"id": "initial"}}::vertex | {"id": 3096224743817217, "label": "self", "end_id": 2814749767106561, "start_id": 2814749767106561, "properties": {}}::edge | {"id": 2814749767106561, "label": "loop", "properties": {"id": "initial"}}::vertex + u | e | v +--------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------- + {"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex | {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge | {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex + {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex | {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge | {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex + {"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex | {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge | {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex + {"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex | {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge | {"id": 1688849860263939, "label": ["v2"], "properties": {"id": "end"}}::vertex + {"id": 2251799813685249, "label": ["v3"], "properties": {"id": "initial"}}::vertex | {"id": 2533274790395906, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685249, "properties": {}}::edge | {"id": 2251799813685250, "label": ["v3"], "properties": {"id": "middle"}}::vertex + {"id": 2251799813685251, "label": ["v3"], "properties": {"id": "end"}}::vertex | {"id": 2533274790395905, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685251, "properties": {}}::edge | {"id": 2251799813685250, "label": ["v3"], "properties": {"id": "middle"}}::vertex + {"id": 2814749767106561, "label": ["loop"], "properties": {"id": "initial"}}::vertex | {"id": 3096224743817217, "label": "self", "end_id": 2814749767106561, "start_id": 2814749767106561, "properties": {}}::edge | {"id": 2814749767106561, "label": ["loop"], "properties": {"id": "initial"}}::vertex (7 rows) -- Exists checks for a loop. There should be one. SELECT * FROM cypher('cypher_match', $$MATCH (u)-[e]->(v) WHERE EXISTS((u)-[e]->(u)) RETURN u, e, v $$) AS (u agtype, e agtype, v agtype); - u | e | v -------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------ - {"id": 2814749767106561, "label": "loop", "properties": {"id": "initial"}}::vertex | {"id": 3096224743817217, "label": "self", "end_id": 2814749767106561, "start_id": 2814749767106561, "properties": {}}::edge | {"id": 2814749767106561, "label": "loop", "properties": {"id": "initial"}}::vertex + u | e | v +--------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------- + {"id": 2814749767106561, "label": ["loop"], "properties": {"id": "initial"}}::vertex | {"id": 3096224743817217, "label": "self", "end_id": 2814749767106561, "start_id": 2814749767106561, "properties": {}}::edge | {"id": 2814749767106561, "label": ["loop"], "properties": {"id": "initial"}}::vertex (1 row) -- Exists checks for a loop. There should be one. SELECT * FROM cypher('cypher_match', $$MATCH (u)-[e]->(v) WHERE EXISTS((v)-[e]->(v)) RETURN u, e, v $$) AS (u agtype, e agtype, v agtype); - u | e | v -------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------ - {"id": 2814749767106561, "label": "loop", "properties": {"id": "initial"}}::vertex | {"id": 3096224743817217, "label": "self", "end_id": 2814749767106561, "start_id": 2814749767106561, "properties": {}}::edge | {"id": 2814749767106561, "label": "loop", "properties": {"id": "initial"}}::vertex + u | e | v +--------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------- + {"id": 2814749767106561, "label": ["loop"], "properties": {"id": "initial"}}::vertex | {"id": 3096224743817217, "label": "self", "end_id": 2814749767106561, "start_id": 2814749767106561, "properties": {}}::edge | {"id": 2814749767106561, "label": ["loop"], "properties": {"id": "initial"}}::vertex (1 row) -- Multiple exists SELECT * FROM cypher('cypher_match', $$MATCH (u)-[e]->(v) WHERE EXISTS((u)) AND EXISTS((v)) RETURN u, e, v $$) AS (u agtype, e agtype, v agtype); - u | e | v -------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------ - {"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex | {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge | {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex - {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex | {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge | {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex - {"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex | {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge | {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex - {"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex | {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge | {"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex - {"id": 2251799813685249, "label": "v3", "properties": {"id": "initial"}}::vertex | {"id": 2533274790395906, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685249, "properties": {}}::edge | {"id": 2251799813685250, "label": "v3", "properties": {"id": "middle"}}::vertex - {"id": 2251799813685251, "label": "v3", "properties": {"id": "end"}}::vertex | {"id": 2533274790395905, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685251, "properties": {}}::edge | {"id": 2251799813685250, "label": "v3", "properties": {"id": "middle"}}::vertex - {"id": 2814749767106561, "label": "loop", "properties": {"id": "initial"}}::vertex | {"id": 3096224743817217, "label": "self", "end_id": 2814749767106561, "start_id": 2814749767106561, "properties": {}}::edge | {"id": 2814749767106561, "label": "loop", "properties": {"id": "initial"}}::vertex + u | e | v +--------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------- + {"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex | {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge | {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex + {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex | {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge | {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex + {"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex | {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge | {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex + {"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex | {"id": 1970324836974593, "label": "e2", "end_id": 1688849860263939, "start_id": 1688849860263938, "properties": {}}::edge | {"id": 1688849860263939, "label": ["v2"], "properties": {"id": "end"}}::vertex + {"id": 2251799813685249, "label": ["v3"], "properties": {"id": "initial"}}::vertex | {"id": 2533274790395906, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685249, "properties": {}}::edge | {"id": 2251799813685250, "label": ["v3"], "properties": {"id": "middle"}}::vertex + {"id": 2251799813685251, "label": ["v3"], "properties": {"id": "end"}}::vertex | {"id": 2533274790395905, "label": "e3", "end_id": 2251799813685250, "start_id": 2251799813685251, "properties": {}}::edge | {"id": 2251799813685250, "label": ["v3"], "properties": {"id": "middle"}}::vertex + {"id": 2814749767106561, "label": ["loop"], "properties": {"id": "initial"}}::vertex | {"id": 3096224743817217, "label": "self", "end_id": 2814749767106561, "start_id": 2814749767106561, "properties": {}}::edge | {"id": 2814749767106561, "label": ["loop"], "properties": {"id": "initial"}}::vertex (7 rows) SELECT * FROM cypher('cypher_match', $$MATCH (u)-[e]->(v) WHERE EXISTS((u)-[e]->(u)) AND EXISTS((v)-[e]->(v)) RETURN u, e, v $$) AS (u agtype, e agtype, v agtype); - u | e | v -------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------ - {"id": 2814749767106561, "label": "loop", "properties": {"id": "initial"}}::vertex | {"id": 3096224743817217, "label": "self", "end_id": 2814749767106561, "start_id": 2814749767106561, "properties": {}}::edge | {"id": 2814749767106561, "label": "loop", "properties": {"id": "initial"}}::vertex + u | e | v +--------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------- + {"id": 2814749767106561, "label": ["loop"], "properties": {"id": "initial"}}::vertex | {"id": 3096224743817217, "label": "self", "end_id": 2814749767106561, "start_id": 2814749767106561, "properties": {}}::edge | {"id": 2814749767106561, "label": ["loop"], "properties": {"id": "initial"}}::vertex (1 row) -- Return exists(pattern) @@ -1235,39 +1235,39 @@ LINE 2: $$MATCH p=(u)-[e]->(v) RETURN EXISTS((p)) $$) SELECT * FROM cypher('cypher_match', $$MATCH (u) RETURN u $$) AS (u agtype); u ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"int_key": 1, "map_key": {"key": "value"}, "list_key": [1, 2, 3], "float_key": 3.14, "string_key": "test"}}::vertex - {"id": 281474976710658, "label": "", "properties": {"lst": [1, null, 3.14, "string", {"key": "value"}, []]}}::vertex - {"id": 844424930131969, "label": "v", "properties": {}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"i": 0}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": 1}}::vertex - {"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex - {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex - {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex - {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex - {"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex - {"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex - {"id": 2251799813685249, "label": "v3", "properties": {"id": "initial"}}::vertex - {"id": 2251799813685250, "label": "v3", "properties": {"id": "middle"}}::vertex - {"id": 2251799813685251, "label": "v3", "properties": {"id": "end"}}::vertex - {"id": 2814749767106561, "label": "loop", "properties": {"id": "initial"}}::vertex + {"id": 281474976710657, "label": [], "properties": {"int_key": 1, "map_key": {"key": "value"}, "list_key": [1, 2, 3], "float_key": 3.14, "string_key": "test"}}::vertex + {"id": 281474976710658, "label": [], "properties": {"lst": [1, null, 3.14, "string", {"key": "value"}, []]}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"i": 0}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": 1}}::vertex + {"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex + {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex + {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex + {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex + {"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex + {"id": 1688849860263939, "label": ["v2"], "properties": {"id": "end"}}::vertex + {"id": 2251799813685249, "label": ["v3"], "properties": {"id": "initial"}}::vertex + {"id": 2251799813685250, "label": ["v3"], "properties": {"id": "middle"}}::vertex + {"id": 2251799813685251, "label": ["v3"], "properties": {"id": "end"}}::vertex + {"id": 2814749767106561, "label": ["loop"], "properties": {"id": "initial"}}::vertex (15 rows) -- select vertices with id as a property SELECT * FROM cypher('cypher_match', $$MATCH (u) WHERE EXISTS(u.id) RETURN u $$) AS (u agtype); - u ------------------------------------------------------------------------------------- - {"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex - {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex - {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex - {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex - {"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex - {"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex - {"id": 2251799813685249, "label": "v3", "properties": {"id": "initial"}}::vertex - {"id": 2251799813685250, "label": "v3", "properties": {"id": "middle"}}::vertex - {"id": 2251799813685251, "label": "v3", "properties": {"id": "end"}}::vertex - {"id": 2814749767106561, "label": "loop", "properties": {"id": "initial"}}::vertex + u +-------------------------------------------------------------------------------------- + {"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex + {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex + {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex + {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex + {"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex + {"id": 1688849860263939, "label": ["v2"], "properties": {"id": "end"}}::vertex + {"id": 2251799813685249, "label": ["v3"], "properties": {"id": "initial"}}::vertex + {"id": 2251799813685250, "label": ["v3"], "properties": {"id": "middle"}}::vertex + {"id": 2251799813685251, "label": ["v3"], "properties": {"id": "end"}}::vertex + {"id": 2814749767106561, "label": ["loop"], "properties": {"id": "initial"}}::vertex (10 rows) -- select vertices without id as a property @@ -1276,30 +1276,30 @@ SELECT * FROM cypher('cypher_match', AS (u agtype); u ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"int_key": 1, "map_key": {"key": "value"}, "list_key": [1, 2, 3], "float_key": 3.14, "string_key": "test"}}::vertex - {"id": 281474976710658, "label": "", "properties": {"lst": [1, null, 3.14, "string", {"key": "value"}, []]}}::vertex - {"id": 844424930131969, "label": "v", "properties": {}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"i": 0}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": 1}}::vertex + {"id": 281474976710657, "label": [], "properties": {"int_key": 1, "map_key": {"key": "value"}, "list_key": [1, 2, 3], "float_key": 3.14, "string_key": "test"}}::vertex + {"id": 281474976710658, "label": [], "properties": {"lst": [1, null, 3.14, "string", {"key": "value"}, []]}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"i": 0}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": 1}}::vertex (5 rows) -- select vertices without id as a property but with a property i SELECT * FROM cypher('cypher_match', $$MATCH (u) WHERE NOT EXISTS(u.id) AND EXISTS(u.i) RETURN u $$) AS (u agtype); - u ------------------------------------------------------------------------ - {"id": 844424930131970, "label": "v", "properties": {"i": 0}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": 1}}::vertex + u +------------------------------------------------------------------------- + {"id": 844424930131970, "label": ["v"], "properties": {"i": 0}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": 1}}::vertex (2 rows) -- select vertices with id as a property and have a self loop SELECT * FROM cypher('cypher_match', $$MATCH (u) WHERE EXISTS(u.id) AND EXISTS((u)-[]->(u)) RETURN u$$) AS (u agtype); - u ------------------------------------------------------------------------------------- - {"id": 2814749767106561, "label": "loop", "properties": {"id": "initial"}}::vertex + u +-------------------------------------------------------------------------------------- + {"id": 2814749767106561, "label": ["loop"], "properties": {"id": "initial"}}::vertex (1 row) -- Return exists(property) @@ -1548,19 +1548,19 @@ SELECT * FROM cypher('cypher_match', $$ MATCH (u:duplicate)-[]-(:other_v) RETURN DISTINCT u $$) AS (i agtype); - i --------------------------------------------------------------------------- - {"id": 3377699720527873, "label": "duplicate", "properties": {}}::vertex + i +---------------------------------------------------------------------------- + {"id": 3377699720527873, "label": ["duplicate"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH p=(:duplicate)-[]-(:other_v) RETURN DISTINCT p -$$) AS (i agtype) ORDER BY i; - i --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 3377699720527873, "label": "duplicate", "properties": {}}::vertex, {"id": 3659174697238529, "label": "dup_edge", "end_id": 3940649673949185, "start_id": 3377699720527873, "properties": {"id": 1}}::edge, {"id": 3940649673949185, "label": "other_v", "properties": {}}::vertex]::path - [{"id": 3377699720527873, "label": "duplicate", "properties": {}}::vertex, {"id": 3659174697238530, "label": "dup_edge", "end_id": 3940649673949186, "start_id": 3377699720527873, "properties": {"id": 2}}::edge, {"id": 3940649673949186, "label": "other_v", "properties": {}}::vertex]::path +$$) AS (i agtype); + i +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + [{"id": 3377699720527873, "label": ["duplicate"], "properties": {}}::vertex, {"id": 3659174697238529, "label": "dup_edge", "end_id": 3940649673949185, "start_id": 3377699720527873, "properties": {"id": 1}}::edge, {"id": 3940649673949185, "label": ["other_v"], "properties": {}}::vertex]::path + [{"id": 3377699720527873, "label": ["duplicate"], "properties": {}}::vertex, {"id": 3659174697238530, "label": "dup_edge", "end_id": 3940649673949186, "start_id": 3377699720527873, "properties": {"id": 2}}::edge, {"id": 3940649673949186, "label": ["other_v"], "properties": {}}::vertex]::path (2 rows) -- @@ -1572,24 +1572,24 @@ SELECT * FROM cypher('cypher_match', $$ $$) AS (i agtype); i ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"int_key": 1, "map_key": {"key": "value"}, "list_key": [1, 2, 3], "float_key": 3.14, "string_key": "test"}}::vertex - {"id": 281474976710658, "label": "", "properties": {"lst": [1, null, 3.14, "string", {"key": "value"}, []]}}::vertex - {"id": 844424930131969, "label": "v", "properties": {}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"i": 0}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": 1}}::vertex - {"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex - {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex - {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex - {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex - {"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex - {"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex - {"id": 2251799813685249, "label": "v3", "properties": {"id": "initial"}}::vertex - {"id": 2251799813685250, "label": "v3", "properties": {"id": "middle"}}::vertex - {"id": 2251799813685251, "label": "v3", "properties": {"id": "end"}}::vertex - {"id": 2814749767106561, "label": "loop", "properties": {"id": "initial"}}::vertex - {"id": 3377699720527873, "label": "duplicate", "properties": {}}::vertex - {"id": 3940649673949185, "label": "other_v", "properties": {}}::vertex - {"id": 3940649673949186, "label": "other_v", "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {"int_key": 1, "map_key": {"key": "value"}, "list_key": [1, 2, 3], "float_key": 3.14, "string_key": "test"}}::vertex + {"id": 281474976710658, "label": [], "properties": {"lst": [1, null, 3.14, "string", {"key": "value"}, []]}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"i": 0}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": 1}}::vertex + {"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex + {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex + {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex + {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex + {"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex + {"id": 1688849860263939, "label": ["v2"], "properties": {"id": "end"}}::vertex + {"id": 2251799813685249, "label": ["v3"], "properties": {"id": "initial"}}::vertex + {"id": 2251799813685250, "label": ["v3"], "properties": {"id": "middle"}}::vertex + {"id": 2251799813685251, "label": ["v3"], "properties": {"id": "end"}}::vertex + {"id": 2814749767106561, "label": ["loop"], "properties": {"id": "initial"}}::vertex + {"id": 3377699720527873, "label": ["duplicate"], "properties": {}}::vertex + {"id": 3940649673949185, "label": ["other_v"], "properties": {}}::vertex + {"id": 3940649673949186, "label": ["other_v"], "properties": {}}::vertex (18 rows) SELECT * FROM cypher('cypher_match', $$ @@ -1598,9 +1598,9 @@ SELECT * FROM cypher('cypher_match', $$ $$) AS (i agtype); i ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"int_key": 1, "map_key": {"key": "value"}, "list_key": [1, 2, 3], "float_key": 3.14, "string_key": "test"}}::vertex - {"id": 281474976710658, "label": "", "properties": {"lst": [1, null, 3.14, "string", {"key": "value"}, []]}}::vertex - {"id": 844424930131969, "label": "v", "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {"int_key": 1, "map_key": {"key": "value"}, "list_key": [1, 2, 3], "float_key": 3.14, "string_key": "test"}}::vertex + {"id": 281474976710658, "label": [], "properties": {"lst": [1, null, 3.14, "string", {"key": "value"}, []]}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {}}::vertex (3 rows) -- @@ -1610,30 +1610,30 @@ SELECT * FROM cypher('cypher_match', $$ MATCH (u) RETURN u SKIP 7 $$) AS (i agtype); - i ------------------------------------------------------------------------------------- - {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex - {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex - {"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex - {"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex - {"id": 2251799813685249, "label": "v3", "properties": {"id": "initial"}}::vertex - {"id": 2251799813685250, "label": "v3", "properties": {"id": "middle"}}::vertex - {"id": 2251799813685251, "label": "v3", "properties": {"id": "end"}}::vertex - {"id": 2814749767106561, "label": "loop", "properties": {"id": "initial"}}::vertex - {"id": 3377699720527873, "label": "duplicate", "properties": {}}::vertex - {"id": 3940649673949185, "label": "other_v", "properties": {}}::vertex - {"id": 3940649673949186, "label": "other_v", "properties": {}}::vertex + i +-------------------------------------------------------------------------------------- + {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex + {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex + {"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex + {"id": 1688849860263939, "label": ["v2"], "properties": {"id": "end"}}::vertex + {"id": 2251799813685249, "label": ["v3"], "properties": {"id": "initial"}}::vertex + {"id": 2251799813685250, "label": ["v3"], "properties": {"id": "middle"}}::vertex + {"id": 2251799813685251, "label": ["v3"], "properties": {"id": "end"}}::vertex + {"id": 2814749767106561, "label": ["loop"], "properties": {"id": "initial"}}::vertex + {"id": 3377699720527873, "label": ["duplicate"], "properties": {}}::vertex + {"id": 3940649673949185, "label": ["other_v"], "properties": {}}::vertex + {"id": 3940649673949186, "label": ["other_v"], "properties": {}}::vertex (11 rows) SELECT * FROM cypher('cypher_match', $$ MATCH (u) RETURN u SKIP 7 LIMIT 3 $$) AS (i agtype); - i ----------------------------------------------------------------------------------- - {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex - {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex - {"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex + i +------------------------------------------------------------------------------------ + {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex + {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex + {"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex (3 rows) -- @@ -1742,9 +1742,9 @@ SELECT * FROM cypher('test_retrieve_var', $$ WHERE EXISTS((c)<-[:incs]-()) RETURN a, c $$) AS (a agtype, c agtype); - a | c ------------------------------------------------------------------+------------------------------------------------------------------ - {"id": 844424930131969, "label": "A", "properties": {}}::vertex | {"id": 1407374883553281, "label": "C", "properties": {}}::vertex + a | c +-------------------------------------------------------------------+-------------------------------------------------------------------- + {"id": 844424930131969, "label": ["A"], "properties": {}}::vertex | {"id": 1407374883553281, "label": ["C"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('test_retrieve_var', $$ @@ -1753,9 +1753,9 @@ SELECT * FROM cypher('test_retrieve_var', $$ WHERE EXISTS((c)<-[:incs]-(a)) RETURN a, c $$) AS (a agtype, c agtype); - a | c ------------------------------------------------------------------+------------------------------------------------------------------ - {"id": 844424930131969, "label": "A", "properties": {}}::vertex | {"id": 1407374883553281, "label": "C", "properties": {}}::vertex + a | c +-------------------------------------------------------------------+-------------------------------------------------------------------- + {"id": 844424930131969, "label": ["A"], "properties": {}}::vertex | {"id": 1407374883553281, "label": ["C"], "properties": {}}::vertex (1 row) -- Tests with edge Var @@ -1768,9 +1768,9 @@ SELECT * FROM cypher('test_retrieve_var', $$ WHERE EXISTS(()<-[]-(c)) RETURN a, r $$) AS (a agtype, r agtype); - a | r ------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "A", "properties": {}}::vertex | {"id": 1125899906842625, "label": "incs", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {}}::edge + a | r +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["A"], "properties": {}}::vertex | {"id": 1125899906842625, "label": "incs", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {}}::edge (1 row) SELECT * FROM cypher('test_retrieve_var', $$ @@ -1779,9 +1779,9 @@ SELECT * FROM cypher('test_retrieve_var', $$ WHERE EXISTS((:A)<-[]-(c)) RETURN a, r $$) AS (a agtype, r agtype); - a | r ------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "A", "properties": {}}::vertex | {"id": 1125899906842625, "label": "incs", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {}}::edge + a | r +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["A"], "properties": {}}::vertex | {"id": 1125899906842625, "label": "incs", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {}}::edge (1 row) SELECT * FROM cypher('test_retrieve_var', $$ @@ -1790,9 +1790,9 @@ SELECT * FROM cypher('test_retrieve_var', $$ WHERE EXISTS((c)<-[]-(:A)) RETURN a, r $$) AS (a agtype, r agtype); - a | r ------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "A", "properties": {}}::vertex | {"id": 1125899906842625, "label": "incs", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {}}::edge + a | r +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["A"], "properties": {}}::vertex | {"id": 1125899906842625, "label": "incs", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {}}::edge (1 row) SELECT * FROM cypher('test_retrieve_var', $$ @@ -1801,9 +1801,9 @@ SELECT * FROM cypher('test_retrieve_var', $$ WHERE EXISTS((:C)<-[]-(:A)) RETURN a, r $$) AS (a agtype, r agtype); - a | r ------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "A", "properties": {}}::vertex | {"id": 1125899906842625, "label": "incs", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {}}::edge + a | r +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["A"], "properties": {}}::vertex | {"id": 1125899906842625, "label": "incs", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {}}::edge (1 row) SELECT * FROM cypher('test_retrieve_var', $$ @@ -1812,9 +1812,9 @@ SELECT * FROM cypher('test_retrieve_var', $$ WHERE EXISTS(()<-[r]-(c)) RETURN a, r $$) AS (a agtype, r agtype); - a | r ------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "A", "properties": {}}::vertex | {"id": 1125899906842625, "label": "incs", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {}}::edge + a | r +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["A"], "properties": {}}::vertex | {"id": 1125899906842625, "label": "incs", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {}}::edge (1 row) -- @@ -1836,7 +1836,7 @@ SELECT * FROM cypher('cypher_match', $$ $$) as (u1 agtype, u2 agtype, u3 agtype); u1 | u2 | u3 ---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------- - {"id": 281474976710660, "label": "", "properties": {"name": "F"}}::vertex | {"id": 1407374883553283, "label": "e1", "end_id": 281474976710661, "start_id": 281474976710660, "properties": {}}::edge | {"id": 281474976710661, "label": "", "properties": {"name": "T"}}::vertex + {"id": 281474976710660, "label": [], "properties": {"name": "F"}}::vertex | {"id": 1407374883553283, "label": "e1", "end_id": 281474976710661, "start_id": 281474976710660, "properties": {}}::edge | {"id": 281474976710661, "label": [], "properties": {"name": "T"}}::vertex (1 row) -- Querying NOT EXISTS syntax @@ -1922,7 +1922,7 @@ SELECT * FROM cypher('cypher_match', $$ $$) as (n agtype); n -------------------------------------------------------------------------------------- - {"id": 281474976710662, "label": "", "properties": {"i": 1, "j": 2, "k": 3}}::vertex + {"id": 281474976710662, "label": [], "properties": {"i": 1, "j": 2, "k": 3}}::vertex (1 row) -- @@ -1933,46 +1933,46 @@ SELECT * FROM cypher('cypher_match', $$ CREATE (a {age: 4}) RETURN a $$) as (a agtype); a ------------------------------------------------------------------------ - {"id": 281474976710665, "label": "", "properties": {"age": 4}}::vertex + {"id": 281474976710665, "label": [], "properties": {"age": 4}}::vertex (1 row) SELECT * FROM cypher('cypher_match', $$ CREATE (b {age: 6}) RETURN b $$) as (b agtype); b ------------------------------------------------------------------------ - {"id": 281474976710666, "label": "", "properties": {"age": 6}}::vertex + {"id": 281474976710666, "label": [], "properties": {"age": 6}}::vertex (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH (a) RETURN a $$) as (a agtype); a -------------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"name": "orphan"}}::vertex - {"id": 281474976710660, "label": "", "properties": {"name": "F"}}::vertex - {"id": 281474976710661, "label": "", "properties": {"name": "T"}}::vertex - {"id": 281474976710662, "label": "", "properties": {"i": 1, "j": 2, "k": 3}}::vertex - {"id": 281474976710663, "label": "", "properties": {"i": 1, "j": 3}}::vertex - {"id": 281474976710664, "label": "", "properties": {"i": 2, "k": 3}}::vertex - {"id": 281474976710665, "label": "", "properties": {"age": 4}}::vertex - {"id": 281474976710666, "label": "", "properties": {"age": 6}}::vertex + {"id": 281474976710659, "label": [], "properties": {"name": "orphan"}}::vertex + {"id": 281474976710660, "label": [], "properties": {"name": "F"}}::vertex + {"id": 281474976710661, "label": [], "properties": {"name": "T"}}::vertex + {"id": 281474976710662, "label": [], "properties": {"i": 1, "j": 2, "k": 3}}::vertex + {"id": 281474976710663, "label": [], "properties": {"i": 1, "j": 3}}::vertex + {"id": 281474976710664, "label": [], "properties": {"i": 2, "k": 3}}::vertex + {"id": 281474976710665, "label": [], "properties": {"age": 4}}::vertex + {"id": 281474976710666, "label": [], "properties": {"age": 6}}::vertex (8 rows) SELECT * FROM cypher('cypher_match', $$ MATCH (a) WHERE EXISTS(a.name) RETURN a $$) as (a agtype); a -------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"name": "orphan"}}::vertex - {"id": 281474976710660, "label": "", "properties": {"name": "F"}}::vertex - {"id": 281474976710661, "label": "", "properties": {"name": "T"}}::vertex + {"id": 281474976710659, "label": [], "properties": {"name": "orphan"}}::vertex + {"id": 281474976710660, "label": [], "properties": {"name": "F"}}::vertex + {"id": 281474976710661, "label": [], "properties": {"name": "T"}}::vertex (3 rows) SELECT * FROM cypher('cypher_match', $$ MATCH (a) WHERE EXISTS(a.name) SET a.age = 4 RETURN a $$) as (a agtype); a ------------------------------------------------------------------------------------------ - {"id": 281474976710659, "label": "", "properties": {"age": 4, "name": "orphan"}}::vertex - {"id": 281474976710660, "label": "", "properties": {"age": 4, "name": "F"}}::vertex - {"id": 281474976710661, "label": "", "properties": {"age": 4, "name": "T"}}::vertex + {"id": 281474976710659, "label": [], "properties": {"age": 4, "name": "orphan"}}::vertex + {"id": 281474976710660, "label": [], "properties": {"age": 4, "name": "F"}}::vertex + {"id": 281474976710661, "label": [], "properties": {"age": 4, "name": "T"}}::vertex (3 rows) SELECT * FROM cypher('cypher_match', $$ @@ -1980,7 +1980,7 @@ SELECT * FROM cypher('cypher_match', $$ RETURN a,b $$) as (a agtype, b agtype); a | b -------------------------------------------------------------------------------------+------------------------------------------------------------------------ - {"id": 281474976710661, "label": "", "properties": {"age": 4, "name": "T"}}::vertex | {"id": 281474976710666, "label": "", "properties": {"age": 6}}::vertex + {"id": 281474976710661, "label": [], "properties": {"age": 4, "name": "T"}}::vertex | {"id": 281474976710666, "label": [], "properties": {"age": 6}}::vertex (1 row) SELECT * FROM cypher('cypher_match', $$ @@ -2014,79 +2014,79 @@ SELECT * FROM cypher('cypher_match', $$ MATCH (a {age:4}) RETURN a $$) as (a agtype); a ------------------------------------------------------------------------------------------ - {"id": 281474976710665, "label": "", "properties": {"age": 4}}::vertex - {"id": 281474976710659, "label": "", "properties": {"age": 4, "name": "orphan"}}::vertex - {"id": 281474976710660, "label": "", "properties": {"age": 4, "name": "F"}}::vertex - {"id": 281474976710661, "label": "", "properties": {"age": 4, "name": "T"}}::vertex + {"id": 281474976710665, "label": [], "properties": {"age": 4}}::vertex + {"id": 281474976710659, "label": [], "properties": {"age": 4, "name": "orphan"}}::vertex + {"id": 281474976710660, "label": [], "properties": {"age": 4, "name": "F"}}::vertex + {"id": 281474976710661, "label": [], "properties": {"age": 4, "name": "T"}}::vertex (4 rows) SELECT * FROM cypher('cypher_match', $$ MATCH (a) MATCH (a {age:4}) RETURN a $$) as (a agtype); a ------------------------------------------------------------------------------------------ - {"id": 281474976710665, "label": "", "properties": {"age": 4}}::vertex - {"id": 281474976710659, "label": "", "properties": {"age": 4, "name": "orphan"}}::vertex - {"id": 281474976710660, "label": "", "properties": {"age": 4, "name": "F"}}::vertex - {"id": 281474976710661, "label": "", "properties": {"age": 4, "name": "T"}}::vertex + {"id": 281474976710665, "label": [], "properties": {"age": 4}}::vertex + {"id": 281474976710659, "label": [], "properties": {"age": 4, "name": "orphan"}}::vertex + {"id": 281474976710660, "label": [], "properties": {"age": 4, "name": "F"}}::vertex + {"id": 281474976710661, "label": [], "properties": {"age": 4, "name": "T"}}::vertex (4 rows) SELECT * FROM cypher('cypher_match', $$ MATCH (a {age:4, name: "orphan"}) RETURN a $$) as (a agtype); a ------------------------------------------------------------------------------------------ - {"id": 281474976710659, "label": "", "properties": {"age": 4, "name": "orphan"}}::vertex + {"id": 281474976710659, "label": [], "properties": {"age": 4, "name": "orphan"}}::vertex (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH (a) MATCH (a {age:4}) MATCH (a {name: "orphan"}) RETURN a $$) as (a agtype); a ------------------------------------------------------------------------------------------ - {"id": 281474976710659, "label": "", "properties": {"age": 4, "name": "orphan"}}::vertex + {"id": 281474976710659, "label": [], "properties": {"age": 4, "name": "orphan"}}::vertex (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH (a {age:4}) MATCH (a {name: "orphan"}) RETURN a $$) as (a agtype); a ------------------------------------------------------------------------------------------ - {"id": 281474976710659, "label": "", "properties": {"age": 4, "name": "orphan"}}::vertex + {"id": 281474976710659, "label": [], "properties": {"age": 4, "name": "orphan"}}::vertex (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH (a) MATCH (a {age:4}) MATCH (a {name: "orphan"}) SET a.age = 3 RETURN a $$) as (a agtype); a ------------------------------------------------------------------------------------------ - {"id": 281474976710659, "label": "", "properties": {"age": 3, "name": "orphan"}}::vertex + {"id": 281474976710659, "label": [], "properties": {"age": 3, "name": "orphan"}}::vertex (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH (a) MATCH (a {age:3}) MATCH (a {name: "orphan"}) RETURN a $$) as (a agtype); a ------------------------------------------------------------------------------------------ - {"id": 281474976710659, "label": "", "properties": {"age": 3, "name": "orphan"}}::vertex + {"id": 281474976710659, "label": [], "properties": {"age": 3, "name": "orphan"}}::vertex (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH (a {name: "orphan"}) MATCH (a {age:3}) RETURN a $$) as (a agtype); a ------------------------------------------------------------------------------------------ - {"id": 281474976710659, "label": "", "properties": {"age": 3, "name": "orphan"}}::vertex + {"id": 281474976710659, "label": [], "properties": {"age": 3, "name": "orphan"}}::vertex (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH (a) WHERE EXISTS(a.age) AND EXISTS(a.name) RETURN a $$) as (a agtype); a ------------------------------------------------------------------------------------------ - {"id": 281474976710660, "label": "", "properties": {"age": 4, "name": "F"}}::vertex - {"id": 281474976710661, "label": "", "properties": {"age": 4, "name": "T"}}::vertex - {"id": 281474976710659, "label": "", "properties": {"age": 3, "name": "orphan"}}::vertex + {"id": 281474976710660, "label": [], "properties": {"age": 4, "name": "F"}}::vertex + {"id": 281474976710661, "label": [], "properties": {"age": 4, "name": "T"}}::vertex + {"id": 281474976710659, "label": [], "properties": {"age": 3, "name": "orphan"}}::vertex (3 rows) SELECT * FROM cypher('cypher_match', $$ MATCH (a) WHERE EXISTS(a.age) AND NOT EXISTS(a.name) RETURN a $$) as (a agtype); a ------------------------------------------------------------------------ - {"id": 281474976710665, "label": "", "properties": {"age": 4}}::vertex - {"id": 281474976710666, "label": "", "properties": {"age": 6}}::vertex + {"id": 281474976710665, "label": [], "properties": {"age": 4}}::vertex + {"id": 281474976710666, "label": [], "properties": {"age": 6}}::vertex (2 rows) -- check reuse of 'r' clause-to-clause - edges @@ -2157,59 +2157,59 @@ SELECT * FROM cypher('cypher_match', $$ SELECT * FROM cypher('cypher_match', $$ CREATE (u {name: "Dave"})-[:knows]->({name: "John"})-[:knows]->(u) RETURN u $$) as (u agtype); u ------------------------------------------------------------------------------ - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH p=(u)-[]-()-[]-(u) RETURN p $$)as (p agtype); p ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710668, "label": "", "properties": {"name": "John"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex]::path - [{"id": 281474976710668, "label": "", "properties": {"name": "John"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710668, "label": "", "properties": {"name": "John"}}::vertex]::path - [{"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710668, "label": "", "properties": {"name": "John"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex]::path - [{"id": 281474976710668, "label": "", "properties": {"name": "John"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710668, "label": "", "properties": {"name": "John"}}::vertex]::path + [{"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710668, "label": [], "properties": {"name": "John"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex]::path + [{"id": 281474976710668, "label": [], "properties": {"name": "John"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710668, "label": [], "properties": {"name": "John"}}::vertex]::path + [{"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710668, "label": [], "properties": {"name": "John"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex]::path + [{"id": 281474976710668, "label": [], "properties": {"name": "John"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710668, "label": [], "properties": {"name": "John"}}::vertex]::path (4 rows) SELECT * FROM cypher('cypher_match', $$ MATCH p=(u)-[]->()-[]->(u) RETURN p $$)as (p agtype); p ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710668, "label": "", "properties": {"name": "John"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710668, "label": "", "properties": {"name": "John"}}::vertex]::path - [{"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710668, "label": "", "properties": {"name": "John"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex]::path + [{"id": 281474976710668, "label": [], "properties": {"name": "John"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710668, "label": [], "properties": {"name": "John"}}::vertex]::path + [{"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710668, "label": [], "properties": {"name": "John"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex]::path (2 rows) SELECT * FROM cypher('cypher_match', $$ MATCH p=(a)-[]->()-[]->(a {name: "Dave"}) RETURN p $$)as (p agtype); p ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710668, "label": "", "properties": {"name": "John"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex]::path + [{"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710668, "label": [], "properties": {"name": "John"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex]::path (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH p=(a)-[]->()-[]->(a {name: "John"}) RETURN p $$)as (p agtype); p ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710668, "label": "", "properties": {"name": "John"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710668, "label": "", "properties": {"name": "John"}}::vertex]::path + [{"id": 281474976710668, "label": [], "properties": {"name": "John"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710668, "label": [], "properties": {"name": "John"}}::vertex]::path (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH p=(a {name: "Dave"})-[]->()-[]->(a {name: "Dave"}) RETURN p $$)as (p agtype); p ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710668, "label": "", "properties": {"name": "John"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex]::path + [{"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710668, "label": [], "properties": {"name": "John"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex]::path (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH p=(a {name: "John"})-[]->()-[]->(a {name: "John"}) RETURN p $$)as (p agtype); p ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710668, "label": "", "properties": {"name": "John"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710668, "label": "", "properties": {"name": "John"}}::vertex]::path + [{"id": 281474976710668, "label": [], "properties": {"name": "John"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710668, "label": [], "properties": {"name": "John"}}::vertex]::path (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH p=(a {name: "Dave"})-[]->()-[]->(a) RETURN p $$)as (p agtype); p ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710668, "label": "", "properties": {"name": "John"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex]::path + [{"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710668, "label": [], "properties": {"name": "John"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex]::path (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH p=(a {name: "John"})-[]->()-[]->(a) RETURN p $$)as (p agtype); p ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710668, "label": "", "properties": {"name": "John"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710668, "label": "", "properties": {"name": "John"}}::vertex]::path + [{"id": 281474976710668, "label": [], "properties": {"name": "John"}}::vertex, {"id": 4785074604081155, "label": "knows", "end_id": 281474976710667, "start_id": 281474976710668, "properties": {}}::edge, {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex, {"id": 4785074604081156, "label": "knows", "end_id": 281474976710668, "start_id": 281474976710667, "properties": {}}::edge, {"id": 281474976710668, "label": [], "properties": {"name": "John"}}::vertex]::path (1 row) -- these are illegal and should fail @@ -2287,16 +2287,16 @@ LINE 1: ...er('cypher_match', $$ CREATE p=() WITH p MATCH ()-[p]->() RE... SELECT * FROM cypher('cypher_match', $$ MATCH (_) RETURN _ $$) as (a agtype); a ------------------------------------------------------------------------------------------ - {"id": 281474976710662, "label": "", "properties": {"i": 1, "j": 2, "k": 3}}::vertex - {"id": 281474976710663, "label": "", "properties": {"i": 1, "j": 3}}::vertex - {"id": 281474976710664, "label": "", "properties": {"i": 2, "k": 3}}::vertex - {"id": 281474976710665, "label": "", "properties": {"age": 4}}::vertex - {"id": 281474976710666, "label": "", "properties": {"age": 6}}::vertex - {"id": 281474976710660, "label": "", "properties": {"age": 4, "name": "F"}}::vertex - {"id": 281474976710661, "label": "", "properties": {"age": 4, "name": "T"}}::vertex - {"id": 281474976710659, "label": "", "properties": {"age": 3, "name": "orphan"}}::vertex - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex - {"id": 281474976710668, "label": "", "properties": {"name": "John"}}::vertex + {"id": 281474976710662, "label": [], "properties": {"i": 1, "j": 2, "k": 3}}::vertex + {"id": 281474976710663, "label": [], "properties": {"i": 1, "j": 3}}::vertex + {"id": 281474976710664, "label": [], "properties": {"i": 2, "k": 3}}::vertex + {"id": 281474976710665, "label": [], "properties": {"age": 4}}::vertex + {"id": 281474976710666, "label": [], "properties": {"age": 6}}::vertex + {"id": 281474976710660, "label": [], "properties": {"age": 4, "name": "F"}}::vertex + {"id": 281474976710661, "label": [], "properties": {"age": 4, "name": "T"}}::vertex + {"id": 281474976710659, "label": [], "properties": {"age": 3, "name": "orphan"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex + {"id": 281474976710668, "label": [], "properties": {"name": "John"}}::vertex (10 rows) SELECT * FROM cypher('cypher_match', $$ MATCH () MATCH (_{name: "Dave"}) RETURN 0 $$) as (a agtype); @@ -2317,37 +2317,37 @@ SELECT * FROM cypher('cypher_match', $$ MATCH () MATCH (_{name: "Dave"}) RETURN SELECT * FROM cypher('cypher_match', $$ MATCH () MATCH (_{name: "Dave"}) RETURN _ $$) as (a agtype); a ------------------------------------------------------------------------------ - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex (10 rows) SELECT * FROM cypher('cypher_match', $$ MATCH (my_age_default_{name: "Dave"}) RETURN my_age_default_$$) as (a agtype); a ------------------------------------------------------------------------------ - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex (1 row) SELECT * FROM cypher('cypher_match', $$ MATCH () MATCH (my_age_default_{name: "Dave"}) RETURN my_age_default_$$) as (a agtype); a ------------------------------------------------------------------------------ - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex (10 rows) -- these should fail as they are prefixed with _age_default_ which is only for internal use @@ -2381,48 +2381,48 @@ SELECT * FROM cypher('cypher_match', $$MATCH ({n0:0}) MATCH ()-[]->() MATCH ({n1 SELECT * FROM cypher('cypher_match', $$ MATCH (a {name:a.name}) RETURN a $$) as (a agtype); a ------------------------------------------------------------------------------------------ - {"id": 281474976710660, "label": "", "properties": {"age": 4, "name": "F"}}::vertex - {"id": 281474976710661, "label": "", "properties": {"age": 4, "name": "T"}}::vertex - {"id": 281474976710659, "label": "", "properties": {"age": 3, "name": "orphan"}}::vertex - {"id": 281474976710667, "label": "", "properties": {"name": "Dave"}}::vertex - {"id": 281474976710668, "label": "", "properties": {"name": "John"}}::vertex + {"id": 281474976710660, "label": [], "properties": {"age": 4, "name": "F"}}::vertex + {"id": 281474976710661, "label": [], "properties": {"age": 4, "name": "T"}}::vertex + {"id": 281474976710659, "label": [], "properties": {"age": 3, "name": "orphan"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex + {"id": 281474976710668, "label": [], "properties": {"name": "John"}}::vertex (5 rows) SELECT * FROM cypher('cypher_match', $$ MATCH (a {name:a.name, age:a.age}) RETURN a $$) as (a agtype); a ------------------------------------------------------------------------------------------ - {"id": 281474976710660, "label": "", "properties": {"age": 4, "name": "F"}}::vertex - {"id": 281474976710661, "label": "", "properties": {"age": 4, "name": "T"}}::vertex - {"id": 281474976710659, "label": "", "properties": {"age": 3, "name": "orphan"}}::vertex + {"id": 281474976710660, "label": [], "properties": {"age": 4, "name": "F"}}::vertex + {"id": 281474976710661, "label": [], "properties": {"age": 4, "name": "T"}}::vertex + {"id": 281474976710659, "label": [], "properties": {"age": 3, "name": "orphan"}}::vertex (3 rows) SELECT * FROM cypher('cypher_match', $$ MATCH (a {name:a.name}) MATCH (a {age:a.age}) RETURN a $$) as (a agtype); a ------------------------------------------------------------------------------------------ - {"id": 281474976710660, "label": "", "properties": {"age": 4, "name": "F"}}::vertex - {"id": 281474976710661, "label": "", "properties": {"age": 4, "name": "T"}}::vertex - {"id": 281474976710659, "label": "", "properties": {"age": 3, "name": "orphan"}}::vertex + {"id": 281474976710660, "label": [], "properties": {"age": 4, "name": "F"}}::vertex + {"id": 281474976710661, "label": [], "properties": {"age": 4, "name": "T"}}::vertex + {"id": 281474976710659, "label": [], "properties": {"age": 3, "name": "orphan"}}::vertex (3 rows) SELECT * FROM cypher('cypher_match', $$ MATCH p=(a)-[u {relationship: u.relationship}]->(b) RETURN p $$) as (a agtype); a ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710661, "label": "", "properties": {"age": 4, "name": "T"}}::vertex, {"id": 4785074604081153, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710661, "properties": {"years": 3, "relationship": "friends"}}::edge, {"id": 281474976710666, "label": "", "properties": {"age": 6}}::vertex]::path - [{"id": 281474976710659, "label": "", "properties": {"age": 3, "name": "orphan"}}::vertex, {"id": 4785074604081154, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710659, "properties": {"years": 4, "relationship": "enemies"}}::edge, {"id": 281474976710666, "label": "", "properties": {"age": 6}}::vertex]::path + [{"id": 281474976710661, "label": [], "properties": {"age": 4, "name": "T"}}::vertex, {"id": 4785074604081153, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710661, "properties": {"years": 3, "relationship": "friends"}}::edge, {"id": 281474976710666, "label": [], "properties": {"age": 6}}::vertex]::path + [{"id": 281474976710659, "label": [], "properties": {"age": 3, "name": "orphan"}}::vertex, {"id": 4785074604081154, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710659, "properties": {"years": 4, "relationship": "enemies"}}::edge, {"id": 281474976710666, "label": [], "properties": {"age": 6}}::vertex]::path (2 rows) SELECT * FROM cypher('cypher_match', $$ MATCH p=(a)-[u {relationship: u.relationship, years: u.years}]->(b) RETURN p $$) as (a agtype); a ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710661, "label": "", "properties": {"age": 4, "name": "T"}}::vertex, {"id": 4785074604081153, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710661, "properties": {"years": 3, "relationship": "friends"}}::edge, {"id": 281474976710666, "label": "", "properties": {"age": 6}}::vertex]::path - [{"id": 281474976710659, "label": "", "properties": {"age": 3, "name": "orphan"}}::vertex, {"id": 4785074604081154, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710659, "properties": {"years": 4, "relationship": "enemies"}}::edge, {"id": 281474976710666, "label": "", "properties": {"age": 6}}::vertex]::path + [{"id": 281474976710661, "label": [], "properties": {"age": 4, "name": "T"}}::vertex, {"id": 4785074604081153, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710661, "properties": {"years": 3, "relationship": "friends"}}::edge, {"id": 281474976710666, "label": [], "properties": {"age": 6}}::vertex]::path + [{"id": 281474976710659, "label": [], "properties": {"age": 3, "name": "orphan"}}::vertex, {"id": 4785074604081154, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710659, "properties": {"years": 4, "relationship": "enemies"}}::edge, {"id": 281474976710666, "label": [], "properties": {"age": 6}}::vertex]::path (2 rows) SELECT * FROM cypher('cypher_match', $$ MATCH p=(a {name:a.name})-[u {relationship: u.relationship}]->(b {age:b.age}) RETURN p $$) as (a agtype); a ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710661, "label": "", "properties": {"age": 4, "name": "T"}}::vertex, {"id": 4785074604081153, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710661, "properties": {"years": 3, "relationship": "friends"}}::edge, {"id": 281474976710666, "label": "", "properties": {"age": 6}}::vertex]::path - [{"id": 281474976710659, "label": "", "properties": {"age": 3, "name": "orphan"}}::vertex, {"id": 4785074604081154, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710659, "properties": {"years": 4, "relationship": "enemies"}}::edge, {"id": 281474976710666, "label": "", "properties": {"age": 6}}::vertex]::path + [{"id": 281474976710661, "label": [], "properties": {"age": 4, "name": "T"}}::vertex, {"id": 4785074604081153, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710661, "properties": {"years": 3, "relationship": "friends"}}::edge, {"id": 281474976710666, "label": [], "properties": {"age": 6}}::vertex]::path + [{"id": 281474976710659, "label": [], "properties": {"age": 3, "name": "orphan"}}::vertex, {"id": 4785074604081154, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710659, "properties": {"years": 4, "relationship": "enemies"}}::edge, {"id": 281474976710666, "label": [], "properties": {"age": 6}}::vertex]::path (2 rows) SELECT * FROM cypher('cypher_match', $$ CREATE () WITH * MATCH (x{n0:x.n1}) RETURN 0 $$) as (a agtype); @@ -2472,9 +2472,9 @@ $$ }) RETURN x $$) as (a agtype); - a ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "Customer", "properties": {"addr": [{"city": "Vancouver", "street": 30}, {"city": "Toronto", "street": 40}], "name": "Bob", "phone": [123456789, 987654321, 456987123], "school": {"name": "XYZ College", "program": {"major": "Psyc", "degree": "BSc"}}}}::vertex + a +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["Customer"], "properties": {"addr": [{"city": "Vancouver", "street": 30}, {"city": "Toronto", "street": 40}], "name": "Bob", "phone": [123456789, 987654321, 456987123], "school": {"name": "XYZ College", "program": {"major": "Psyc", "degree": "BSc"}}}}::vertex (1 row) -- With enable_containment on @@ -2627,12 +2627,12 @@ SELECT * FROM cypher('issue_945', $$ SELECT * FROM cypher('issue_945', $$ MATCH (a:Part) RETURN a $$) as (result agtype); - result -------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "Part", "properties": {"part_num": "123"}}::vertex - {"id": 844424930131970, "label": "Part", "properties": {"part_num": "345"}}::vertex - {"id": 844424930131971, "label": "Part", "properties": {"part_num": "456"}}::vertex - {"id": 844424930131972, "label": "Part", "properties": {"part_num": "789"}}::vertex + result +--------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["Part"], "properties": {"part_num": "123"}}::vertex + {"id": 844424930131970, "label": ["Part"], "properties": {"part_num": "345"}}::vertex + {"id": 844424930131971, "label": ["Part"], "properties": {"part_num": "456"}}::vertex + {"id": 844424930131972, "label": ["Part"], "properties": {"part_num": "789"}}::vertex (4 rows) -- each should return 4 @@ -2802,11 +2802,11 @@ SELECT * FROM cypher('cypher_match', $$ MATCH p=()-[*]->() WHERE length(p) > 1 R (3 rows) SELECT * FROM cypher('cypher_match', $$ MATCH p=()-[*]->() WHERE size(nodes(p)) = 3 RETURN nodes(p)[0] $$) as (nodes agtype); - nodes ------------------------------------------------------------------------------------------------------ - {"id": 281474976710660, "label": "_ag_label_vertex", "properties": {"age": 4, "name": "F"}}::vertex - {"id": 281474976710667, "label": "_ag_label_vertex", "properties": {"name": "Dave"}}::vertex - {"id": 281474976710668, "label": "_ag_label_vertex", "properties": {"name": "John"}}::vertex + nodes +------------------------------------------------------------------------------------- + {"id": 281474976710660, "label": [], "properties": {"age": 4, "name": "F"}}::vertex + {"id": 281474976710667, "label": [], "properties": {"name": "Dave"}}::vertex + {"id": 281474976710668, "label": [], "properties": {"name": "John"}}::vertex (3 rows) SELECT * FROM cypher('cypher_match', $$ MATCH (n {name:'Dave'}) MATCH p=()-[*]->() WHERE nodes(p)[0] = n RETURN length(p) $$) as (length agtype); @@ -2916,7 +2916,7 @@ SELECT * FROM cypher('issue_1399', $$ $$) as (c agtype); c ---------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {}}::vertex (1 row) -- these should each return 1 row as it is a directed edge and @@ -2928,7 +2928,7 @@ SELECT * FROM cypher('issue_1399', $$ $$) as (c agtype); c ---------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {}}::vertex (1 row) SELECT * FROM cypher('issue_1399', $$ @@ -2938,7 +2938,7 @@ SELECT * FROM cypher('issue_1399', $$ $$) as (c agtype); c ---------------------------------------------------------------- - {"id": 281474976710658, "label": "", "properties": {}}::vertex + {"id": 281474976710658, "label": [], "properties": {}}::vertex (1 row) SELECT * FROM cypher('issue_1399', $$ @@ -2948,7 +2948,7 @@ SELECT * FROM cypher('issue_1399', $$ $$) as (c agtype); c ---------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {}}::vertex (1 row) SELECT * FROM cypher('issue_1399', $$ @@ -2958,7 +2958,7 @@ SELECT * FROM cypher('issue_1399', $$ $$) as (c agtype); c ---------------------------------------------------------------- - {"id": 281474976710658, "label": "", "properties": {}}::vertex + {"id": 281474976710658, "label": [], "properties": {}}::vertex (1 row) -- this should return 0 rows as it can't exist - that path isn't in BAR2 @@ -2979,8 +2979,8 @@ SELECT * FROM cypher('issue_1399', $$ $$) as (c agtype); c ---------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex - {"id": 281474976710658, "label": "", "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {}}::vertex + {"id": 281474976710658, "label": [], "properties": {}}::vertex (2 rows) -- Issue 1393 EXISTS doesn't see previous clauses' variables diff --git a/regress/expected/cypher_merge.out b/regress/expected/cypher_merge.out index 238a4c472..cddf4bb11 100644 --- a/regress/expected/cypher_merge.out +++ b/regress/expected/cypher_merge.out @@ -41,7 +41,7 @@ SELECT * FROM cypher('cypher_merge', $$MERGE (n {i: "Hello Merge", j: (null IS N SELECT * FROM cypher('cypher_merge', $$MATCH (n) RETURN n$$) AS (n agtype); n --------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"i": "Hello Merge", "j": true, "k": false}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": "Hello Merge", "j": true, "k": false}}::vertex (1 row) --clean up @@ -74,7 +74,7 @@ SELECT * FROM cypher('cypher_merge', $$MERGE ({j: (null IS NULL)})$$) AS (a agty SELECT * FROM cypher('cypher_merge', $$MATCH (n) RETURN n$$) AS (n agtype); n --------------------------------------------------------------------------------------------- - {"id": 281474976710658, "label": "", "properties": {"i": "Hello Merge", "j": true}}::vertex + {"id": 281474976710658, "label": [], "properties": {"i": "Hello Merge", "j": true}}::vertex (1 row) --clean up @@ -122,7 +122,7 @@ SELECT * FROM cypher('cypher_merge', $$MATCH (n) MERGE ({i: n.i})$$) AS (a agtyp SELECT * FROM cypher('cypher_merge', $$MATCH (n) RETURN n$$) AS (n agtype); n ---------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"i": "Hello Merge"}}::vertex + {"id": 281474976710659, "label": [], "properties": {"i": "Hello Merge"}}::vertex (1 row) --clean up @@ -150,8 +150,8 @@ SELECT * FROM cypher('cypher_merge', $$MATCH (n) MERGE ({j: n.i})$$) AS (a agtyp SELECT * FROM cypher('cypher_merge', $$MATCH (n) RETURN n$$) AS (n agtype); n ---------------------------------------------------------------------------------- - {"id": 281474976710660, "label": "", "properties": {"i": "Hello Merge"}}::vertex - {"id": 281474976710661, "label": "", "properties": {"j": "Hello Merge"}}::vertex + {"id": 281474976710660, "label": [], "properties": {"i": "Hello Merge"}}::vertex + {"id": 281474976710661, "label": [], "properties": {"j": "Hello Merge"}}::vertex (2 rows) --clean up @@ -173,15 +173,15 @@ SELECT * FROM cypher('cypher_merge', $$CREATE ({i: 2}) $$) AS (a agtype); SELECT * FROM cypher('cypher_merge', $$MERGE (n {i: 1}) RETURN n$$) AS (a agtype); a ---------------------------------------------------------------------- - {"id": 281474976710663, "label": "", "properties": {"i": 1}}::vertex + {"id": 281474976710663, "label": [], "properties": {"i": 1}}::vertex (1 row) --validate SELECT * FROM cypher('cypher_merge', $$MATCH (n) RETURN n$$) AS (n agtype); n ---------------------------------------------------------------------- - {"id": 281474976710662, "label": "", "properties": {"i": 2}}::vertex - {"id": 281474976710663, "label": "", "properties": {"i": 1}}::vertex + {"id": 281474976710662, "label": [], "properties": {"i": 2}}::vertex + {"id": 281474976710663, "label": [], "properties": {"i": 1}}::vertex (2 rows) --clean up @@ -218,18 +218,18 @@ SELECT * FROM cypher('cypher_merge', $$CREATE () $$) AS (a agtype); SELECT * FROM cypher('cypher_merge', $$MERGE (n {i: 1}) RETURN n$$) AS (a agtype); a ---------------------------------------------------------------------- - {"id": 281474976710664, "label": "", "properties": {"i": 1}}::vertex - {"id": 281474976710665, "label": "", "properties": {"i": 1}}::vertex + {"id": 281474976710664, "label": [], "properties": {"i": 1}}::vertex + {"id": 281474976710665, "label": [], "properties": {"i": 1}}::vertex (2 rows) --validate SELECT * FROM cypher('cypher_merge', $$MATCH (n) RETURN n$$) AS (n agtype); n ---------------------------------------------------------------------- - {"id": 281474976710664, "label": "", "properties": {"i": 1}}::vertex - {"id": 281474976710665, "label": "", "properties": {"i": 1}}::vertex - {"id": 281474976710666, "label": "", "properties": {"i": 2}}::vertex - {"id": 281474976710667, "label": "", "properties": {}}::vertex + {"id": 281474976710664, "label": [], "properties": {"i": 1}}::vertex + {"id": 281474976710665, "label": [], "properties": {"i": 1}}::vertex + {"id": 281474976710666, "label": [], "properties": {"i": 2}}::vertex + {"id": 281474976710667, "label": [], "properties": {}}::vertex (4 rows) --clean up @@ -258,9 +258,9 @@ SELECT * FROM cypher('cypher_merge', $$MATCH (n) MERGE (n)-[:e]->(:v)$$) AS (a a --validate SELECT * FROM cypher('cypher_merge', $$MATCH (n)-[e:e]->(m:v) RETURN n, e, m$$) AS (n agtype, e agtype, m agtype); - n | e | m -----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------ - {"id": 281474976710668, "label": "", "properties": {}}::vertex | {"id": 844424930131969, "label": "e", "end_id": 1125899906842625, "start_id": 281474976710668, "properties": {}}::edge | {"id": 1125899906842625, "label": "v", "properties": {}}::vertex + n | e | m +----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------- + {"id": 281474976710668, "label": [], "properties": {}}::vertex | {"id": 844424930131969, "label": "e", "end_id": 1125899906842625, "start_id": 281474976710668, "properties": {}}::edge | {"id": 1125899906842625, "label": ["v"], "properties": {}}::vertex (1 row) --clean up @@ -286,9 +286,9 @@ SELECT * FROM cypher('cypher_merge', $$MERGE (n)-[:e]->(:v)$$) AS (a agtype); --validate SELECT * FROM cypher('cypher_merge', $$MATCH (n)-[e:e]->(m:v) RETURN n, e, m$$) AS (n agtype, e agtype, m agtype); - n | e | m -----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------ - {"id": 281474976710671, "label": "", "properties": {}}::vertex | {"id": 844424930131971, "label": "e", "end_id": 1125899906842626, "start_id": 281474976710671, "properties": {}}::edge | {"id": 1125899906842626, "label": "v", "properties": {}}::vertex + n | e | m +----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------- + {"id": 281474976710671, "label": [], "properties": {}}::vertex | {"id": 844424930131971, "label": "e", "end_id": 1125899906842626, "start_id": 281474976710671, "properties": {}}::edge | {"id": 1125899906842626, "label": ["v"], "properties": {}}::vertex (1 row) --clean up @@ -314,9 +314,9 @@ SELECT * FROM cypher('cypher_merge', $$MATCH (n) MERGE (n)-[:e]->(:v)$$) AS (a a --validate created correctly SELECT * FROM cypher('cypher_merge', $$MATCH (n)-[e:e]->(m:v) RETURN n, e, m$$) AS (n agtype, e agtype, m agtype); - n | e | m -----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------ - {"id": 281474976710672, "label": "", "properties": {}}::vertex | {"id": 844424930131972, "label": "e", "end_id": 1125899906842627, "start_id": 281474976710672, "properties": {}}::edge | {"id": 1125899906842627, "label": "v", "properties": {}}::vertex + n | e | m +----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------- + {"id": 281474976710672, "label": [], "properties": {}}::vertex | {"id": 844424930131972, "label": "e", "end_id": 1125899906842627, "start_id": 281474976710672, "properties": {}}::edge | {"id": 1125899906842627, "label": ["v"], "properties": {}}::vertex (1 row) --clean up @@ -342,10 +342,10 @@ SELECT * FROM cypher('cypher_merge', $$MATCH (n) MERGE (n)-[:e]->(:v)$$) AS (a a --validate created correctly SELECT * FROM cypher('cypher_merge', $$MATCH (n)-[e:e]->(m:v) RETURN n, e, m$$) AS (n agtype, e agtype, m agtype); - n | e | m -----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------ - {"id": 281474976710673, "label": "", "properties": {}}::vertex | {"id": 844424930131974, "label": "e", "end_id": 1125899906842628, "start_id": 281474976710673, "properties": {}}::edge | {"id": 1125899906842628, "label": "v", "properties": {}}::vertex - {"id": 281474976710674, "label": "", "properties": {}}::vertex | {"id": 844424930131975, "label": "e", "end_id": 1125899906842629, "start_id": 281474976710674, "properties": {}}::edge | {"id": 1125899906842629, "label": "v", "properties": {}}::vertex + n | e | m +----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------- + {"id": 281474976710673, "label": [], "properties": {}}::vertex | {"id": 844424930131974, "label": "e", "end_id": 1125899906842628, "start_id": 281474976710673, "properties": {}}::edge | {"id": 1125899906842628, "label": ["v"], "properties": {}}::vertex + {"id": 281474976710674, "label": [], "properties": {}}::vertex | {"id": 844424930131975, "label": "e", "end_id": 1125899906842629, "start_id": 281474976710674, "properties": {}}::edge | {"id": 1125899906842629, "label": ["v"], "properties": {}}::vertex (2 rows) --clean up @@ -414,10 +414,10 @@ SELECT * FROM cypher('cypher_merge', $$MATCH (n) MERGE (n)-[:e_new]->(:v)$$) AS --validate created correctly SELECT * FROM cypher('cypher_merge', $$MATCH (n)-[e]->(m:v) RETURN n, e, m$$) AS (n agtype, e agtype, m agtype); - n | e | m -----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------ - {"id": 281474976710680, "label": "", "properties": {}}::vertex | {"id": 1407374883553281, "label": "e_new", "end_id": 1125899906842630, "start_id": 281474976710680, "properties": {}}::edge | {"id": 1125899906842630, "label": "v", "properties": {}}::vertex - {"id": 281474976710681, "label": "", "properties": {}}::vertex | {"id": 1407374883553282, "label": "e_new", "end_id": 1125899906842631, "start_id": 281474976710681, "properties": {}}::edge | {"id": 1125899906842631, "label": "v", "properties": {}}::vertex + n | e | m +----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------- + {"id": 281474976710680, "label": [], "properties": {}}::vertex | {"id": 1407374883553281, "label": "e_new", "end_id": 1125899906842630, "start_id": 281474976710680, "properties": {}}::edge | {"id": 1125899906842630, "label": ["v"], "properties": {}}::vertex + {"id": 281474976710681, "label": [], "properties": {}}::vertex | {"id": 1407374883553282, "label": "e_new", "end_id": 1125899906842631, "start_id": 281474976710681, "properties": {}}::edge | {"id": 1125899906842631, "label": ["v"], "properties": {}}::vertex (2 rows) --clean up @@ -443,9 +443,9 @@ SELECT * FROM cypher('cypher_merge', $$MERGE (n)-[:e_new]->(:v)$$) AS (a agtype) --validate created correctly SELECT * FROM cypher('cypher_merge', $$MATCH (n)-[e]->(m:v) RETURN n, e, m$$) AS (n agtype, e agtype, m agtype); - n | e | m -----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------ - {"id": 281474976710684, "label": "", "properties": {}}::vertex | {"id": 1407374883553283, "label": "e_new", "end_id": 1125899906842632, "start_id": 281474976710684, "properties": {}}::edge | {"id": 1125899906842632, "label": "v", "properties": {}}::vertex + n | e | m +----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------- + {"id": 281474976710684, "label": [], "properties": {}}::vertex | {"id": 1407374883553283, "label": "e_new", "end_id": 1125899906842632, "start_id": 281474976710684, "properties": {}}::edge | {"id": 1125899906842632, "label": ["v"], "properties": {}}::vertex (1 row) --clean up @@ -470,7 +470,7 @@ SELECT * FROM cypher('cypher_merge', $$CREATE () MERGE (n)$$) AS (a agtype); SELECT * FROM cypher('cypher_merge', $$MATCH (n) RETURN n$$) AS (n agtype); n ---------------------------------------------------------------- - {"id": 281474976710685, "label": "", "properties": {}}::vertex + {"id": 281474976710685, "label": [], "properties": {}}::vertex (1 row) --clean up @@ -492,7 +492,7 @@ SELECT * FROM cypher('cypher_merge', $$CREATE (n) WITH n as a MERGE (a)-[:e]->() SELECT * FROM cypher('cypher_merge', $$MATCH p=()-[:e]->() RETURN p$$) AS (p agtype); p --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710687, "label": "", "properties": {}}::vertex, {"id": 844424930131981, "label": "e", "end_id": 281474976710688, "start_id": 281474976710687, "properties": {}}::edge, {"id": 281474976710688, "label": "", "properties": {}}::vertex]::path + [{"id": 281474976710687, "label": [], "properties": {}}::vertex, {"id": 844424930131981, "label": "e", "end_id": 281474976710688, "start_id": 281474976710687, "properties": {}}::edge, {"id": 281474976710688, "label": [], "properties": {}}::vertex]::path (1 row) --clean up @@ -514,7 +514,7 @@ SELECT * FROM cypher('cypher_merge', $$CREATE (n) MERGE (n)-[:e]->() $$) AS (a a SELECT * FROM cypher('cypher_merge', $$MATCH p=()-[:e]->() RETURN p$$) AS (p agtype); p --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710689, "label": "", "properties": {}}::vertex, {"id": 844424930131982, "label": "e", "end_id": 281474976710690, "start_id": 281474976710689, "properties": {}}::edge, {"id": 281474976710690, "label": "", "properties": {}}::vertex]::path + [{"id": 281474976710689, "label": [], "properties": {}}::vertex, {"id": 844424930131982, "label": "e", "end_id": 281474976710690, "start_id": 281474976710689, "properties": {}}::edge, {"id": 281474976710690, "label": [], "properties": {}}::vertex]::path (1 row) --clean up @@ -536,7 +536,7 @@ SELECT * FROM cypher('cypher_merge', $$CREATE (n {i : 1}) SET n.i = 2 MERGE ({i: SELECT * FROM cypher('cypher_merge', $$MATCH (a) RETURN a$$) AS (a agtype); a ---------------------------------------------------------------------- - {"id": 281474976710691, "label": "", "properties": {"i": 2}}::vertex + {"id": 281474976710691, "label": [], "properties": {"i": 2}}::vertex (1 row) --clean up @@ -558,7 +558,7 @@ SELECT * FROM cypher('cypher_merge', $$CREATE (n {i : 1}) SET n.i = 2 WITH n as SELECT * FROM cypher('cypher_merge', $$MATCH (a) RETURN a$$) AS (a agtype); a ---------------------------------------------------------------------- - {"id": 281474976710692, "label": "", "properties": {"i": 2}}::vertex + {"id": 281474976710692, "label": [], "properties": {"i": 2}}::vertex (1 row) --clean up @@ -586,7 +586,7 @@ SELECT * FROM cypher('cypher_merge', $$MATCH (n {i : 1}) SET n.i = 2 WITH n as a SELECT * FROM cypher('cypher_merge', $$MATCH (a) RETURN a$$) AS (a agtype); a ---------------------------------------------------------------------- - {"id": 281474976710693, "label": "", "properties": {"i": 2}}::vertex + {"id": 281474976710693, "label": [], "properties": {"i": 2}}::vertex (1 row) --clean up @@ -611,7 +611,7 @@ ERROR: vertex assigned to variable n was deleted SELECT * FROM cypher('cypher_merge', $$MATCH (a) RETURN a$$) AS (a agtype); a ---------------------------------------------------------------------- - {"id": 281474976710694, "label": "", "properties": {"i": 1}}::vertex + {"id": 281474976710694, "label": [], "properties": {"i": 1}}::vertex (1 row) --clean up @@ -652,23 +652,23 @@ SELECT * FROM cypher('cypher_merge', $$ MERGE (person)-[r:BORN_IN]->(city) RETURN person.name, person.bornIn, city $$) AS (name agtype, bornIn agtype, city agtype); - name | bornin | city --------------------+--------------+----------------------------------------------------------------------------------------- - "Rob Reiner" | "New York" | {"id": 1970324836974593, "label": "City", "properties": {"name": "New York"}}::vertex - "Martin Sheen" | "Ohio" | {"id": 1970324836974595, "label": "City", "properties": {"name": "Ohio"}}::vertex - "Michael Douglas" | "New Jersey" | {"id": 1970324836974594, "label": "City", "properties": {"name": "New Jersey"}}::vertex + name | bornin | city +-------------------+--------------+------------------------------------------------------------------------------------------- + "Rob Reiner" | "New York" | {"id": 1970324836974593, "label": ["City"], "properties": {"name": "New York"}}::vertex + "Martin Sheen" | "Ohio" | {"id": 1970324836974595, "label": ["City"], "properties": {"name": "Ohio"}}::vertex + "Michael Douglas" | "New Jersey" | {"id": 1970324836974594, "label": ["City"], "properties": {"name": "New Jersey"}}::vertex (3 rows) --validate SELECT * FROM cypher('cypher_merge', $$MATCH (a) RETURN a$$) AS (a agtype); - a ------------------------------------------------------------------------------------------------------------------------- - {"id": 1688849860263937, "label": "Person", "properties": {"name": "Rob Reiner", "bornIn": "New York"}}::vertex - {"id": 1688849860263938, "label": "Person", "properties": {"name": "Michael Douglas", "bornIn": "New Jersey"}}::vertex - {"id": 1688849860263939, "label": "Person", "properties": {"name": "Martin Sheen", "bornIn": "Ohio"}}::vertex - {"id": 1970324836974593, "label": "City", "properties": {"name": "New York"}}::vertex - {"id": 1970324836974594, "label": "City", "properties": {"name": "New Jersey"}}::vertex - {"id": 1970324836974595, "label": "City", "properties": {"name": "Ohio"}}::vertex + a +-------------------------------------------------------------------------------------------------------------------------- + {"id": 1688849860263937, "label": ["Person"], "properties": {"name": "Rob Reiner", "bornIn": "New York"}}::vertex + {"id": 1688849860263938, "label": ["Person"], "properties": {"name": "Michael Douglas", "bornIn": "New Jersey"}}::vertex + {"id": 1688849860263939, "label": ["Person"], "properties": {"name": "Martin Sheen", "bornIn": "Ohio"}}::vertex + {"id": 1970324836974593, "label": ["City"], "properties": {"name": "New York"}}::vertex + {"id": 1970324836974594, "label": ["City"], "properties": {"name": "New Jersey"}}::vertex + {"id": 1970324836974595, "label": ["City"], "properties": {"name": "Ohio"}}::vertex (6 rows) --clean up @@ -689,7 +689,7 @@ SELECT * FROM cypher('cypher_merge', $$MERGE ()-[:e]-()$$) AS (a agtype); SELECT * FROM cypher('cypher_merge', $$MATCH p=()-[]->() RETURN p$$) AS (a agtype); a --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710695, "label": "", "properties": {}}::vertex, {"id": 844424930131983, "label": "e", "end_id": 281474976710696, "start_id": 281474976710695, "properties": {}}::edge, {"id": 281474976710696, "label": "", "properties": {}}::vertex]::path + [{"id": 281474976710695, "label": [], "properties": {}}::vertex, {"id": 844424930131983, "label": "e", "end_id": 281474976710696, "start_id": 281474976710695, "properties": {}}::edge, {"id": 281474976710696, "label": [], "properties": {}}::vertex]::path (1 row) --clean up @@ -704,14 +704,14 @@ SELECT * FROM cypher('cypher_merge', $$MATCH (n) DETACH DELETE n $$) AS (a agtyp SELECT * FROM cypher('cypher_merge', $$MERGE (a) RETURN a$$) AS (a agtype); a ---------------------------------------------------------------- - {"id": 281474976710697, "label": "", "properties": {}}::vertex + {"id": 281474976710697, "label": [], "properties": {}}::vertex (1 row) --validate SELECT * FROM cypher('cypher_merge', $$MATCH (a) RETURN a$$) AS (a agtype); a ---------------------------------------------------------------- - {"id": 281474976710697, "label": "", "properties": {}}::vertex + {"id": 281474976710697, "label": [], "properties": {}}::vertex (1 row) --clean up @@ -726,14 +726,14 @@ SELECT * FROM cypher('cypher_merge', $$MATCH (n) DETACH DELETE n $$) AS (a agtyp SELECT * FROM cypher('cypher_merge', $$MERGE p=()-[:e]-() RETURN p$$) AS (a agtype); a --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710698, "label": "", "properties": {}}::vertex, {"id": 844424930131984, "label": "e", "end_id": 281474976710699, "start_id": 281474976710698, "properties": {}}::edge, {"id": 281474976710699, "label": "", "properties": {}}::vertex]::path + [{"id": 281474976710698, "label": [], "properties": {}}::vertex, {"id": 844424930131984, "label": "e", "end_id": 281474976710699, "start_id": 281474976710698, "properties": {}}::edge, {"id": 281474976710699, "label": [], "properties": {}}::vertex]::path (1 row) --validate SELECT * FROM cypher('cypher_merge', $$MATCH p=()-[]->() RETURN p$$) AS (a agtype); a --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710698, "label": "", "properties": {}}::vertex, {"id": 844424930131984, "label": "e", "end_id": 281474976710699, "start_id": 281474976710698, "properties": {}}::edge, {"id": 281474976710699, "label": "", "properties": {}}::vertex]::path + [{"id": 281474976710698, "label": [], "properties": {}}::vertex, {"id": 844424930131984, "label": "e", "end_id": 281474976710699, "start_id": 281474976710698, "properties": {}}::edge, {"id": 281474976710699, "label": [], "properties": {}}::vertex]::path (1 row) --clean up @@ -748,14 +748,14 @@ SELECT * FROM cypher('cypher_merge', $$MATCH (n) DETACH DELETE n $$) AS (a agtyp SELECT * FROM cypher('cypher_merge', $$MERGE (a)-[:e]-(b) RETURN a$$) AS (a agtype); a ---------------------------------------------------------------- - {"id": 281474976710700, "label": "", "properties": {}}::vertex + {"id": 281474976710700, "label": [], "properties": {}}::vertex (1 row) --validate SELECT * FROM cypher('cypher_merge', $$MATCH p=()-[]->() RETURN p$$) AS (a agtype); a --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710700, "label": "", "properties": {}}::vertex, {"id": 844424930131985, "label": "e", "end_id": 281474976710701, "start_id": 281474976710700, "properties": {}}::edge, {"id": 281474976710701, "label": "", "properties": {}}::vertex]::path + [{"id": 281474976710700, "label": [], "properties": {}}::vertex, {"id": 844424930131985, "label": "e", "end_id": 281474976710701, "start_id": 281474976710700, "properties": {}}::edge, {"id": 281474976710701, "label": [], "properties": {}}::vertex]::path (1 row) --clean up @@ -770,14 +770,14 @@ SELECT * FROM cypher('cypher_merge', $$MATCH (n) DETACH DELETE n $$) AS (a agtyp SELECT * FROM cypher('cypher_merge', $$CREATE p=()-[:e]->() RETURN p$$) AS (a agtype); a --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710702, "label": "", "properties": {}}::vertex, {"id": 844424930131986, "label": "e", "end_id": 281474976710703, "start_id": 281474976710702, "properties": {}}::edge, {"id": 281474976710703, "label": "", "properties": {}}::vertex]::path + [{"id": 281474976710702, "label": [], "properties": {}}::vertex, {"id": 844424930131986, "label": "e", "end_id": 281474976710703, "start_id": 281474976710702, "properties": {}}::edge, {"id": 281474976710703, "label": [], "properties": {}}::vertex]::path (1 row) SELECT * FROM cypher('cypher_merge', $$MERGE p=()-[:e]-() RETURN p$$) AS (a agtype); a --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710702, "label": "", "properties": {}}::vertex, {"id": 844424930131986, "label": "e", "end_id": 281474976710703, "start_id": 281474976710702, "properties": {}}::edge, {"id": 281474976710703, "label": "", "properties": {}}::vertex]::path - [{"id": 281474976710703, "label": "", "properties": {}}::vertex, {"id": 844424930131986, "label": "e", "end_id": 281474976710703, "start_id": 281474976710702, "properties": {}}::edge, {"id": 281474976710702, "label": "", "properties": {}}::vertex]::path + [{"id": 281474976710702, "label": [], "properties": {}}::vertex, {"id": 844424930131986, "label": "e", "end_id": 281474976710703, "start_id": 281474976710702, "properties": {}}::edge, {"id": 281474976710703, "label": [], "properties": {}}::vertex]::path + [{"id": 281474976710703, "label": [], "properties": {}}::vertex, {"id": 844424930131986, "label": "e", "end_id": 281474976710703, "start_id": 281474976710702, "properties": {}}::edge, {"id": 281474976710702, "label": [], "properties": {}}::vertex]::path (2 rows) --clean up @@ -824,34 +824,34 @@ LINE 1: ..., $$MATCH (n) OPTIONAL MATCH (n)-[:e]->(m) MERGE (m)$$) AS (... SELECT * FROM cypher('cypher_merge', $$MATCH (n) RETURN n$$) AS (a agtype); a ---------------------------------------------------------------- - {"id": 281474976710704, "label": "", "properties": {}}::vertex + {"id": 281474976710704, "label": [], "properties": {}}::vertex (1 row) -- -- MERGE/SET test -- Node does exist, then set (github issue #235) SELECT * FROM cypher('cypher_merge', $$ CREATE (n:node {name: 'Jason'}) RETURN n $$) AS (n agtype); - n ------------------------------------------------------------------------------------- - {"id": 2533274790395905, "label": "node", "properties": {"name": "Jason"}}::vertex + n +-------------------------------------------------------------------------------------- + {"id": 2533274790395905, "label": ["node"], "properties": {"name": "Jason"}}::vertex (1 row) SELECT * FROM cypher('cypher_merge', $$ MATCH (n:node) RETURN n $$) AS (n agtype); - n ------------------------------------------------------------------------------------- - {"id": 2533274790395905, "label": "node", "properties": {"name": "Jason"}}::vertex + n +-------------------------------------------------------------------------------------- + {"id": 2533274790395905, "label": ["node"], "properties": {"name": "Jason"}}::vertex (1 row) SELECT * FROM cypher('cypher_merge', $$ MERGE (n:node {name: 'Jason'}) SET n.name = 'Lisa' RETURN n $$) AS (n agtype); - n ------------------------------------------------------------------------------------ - {"id": 2533274790395905, "label": "node", "properties": {"name": "Lisa"}}::vertex + n +------------------------------------------------------------------------------------- + {"id": 2533274790395905, "label": ["node"], "properties": {"name": "Lisa"}}::vertex (1 row) SELECT * FROM cypher('cypher_merge', $$ MATCH (n:node) RETURN n $$) AS (n agtype); - n ------------------------------------------------------------------------------------ - {"id": 2533274790395905, "label": "node", "properties": {"name": "Lisa"}}::vertex + n +------------------------------------------------------------------------------------- + {"id": 2533274790395905, "label": ["node"], "properties": {"name": "Lisa"}}::vertex (1 row) -- Node doesn't exist, is created, then set @@ -866,41 +866,41 @@ SELECT * FROM cypher('cypher_merge', $$ MATCH (n:node) RETURN n $$) AS (n agtype (0 rows) SELECT * FROM cypher('cypher_merge', $$ MERGE (n:node {name: 'Jason'}) SET n.name = 'Lisa' RETURN n $$) AS (n agtype); - n ------------------------------------------------------------------------------------ - {"id": 2533274790395906, "label": "node", "properties": {"name": "Lisa"}}::vertex + n +------------------------------------------------------------------------------------- + {"id": 2533274790395906, "label": ["node"], "properties": {"name": "Lisa"}}::vertex (1 row) SELECT * FROM cypher('cypher_merge', $$ MATCH (n:node) RETURN n $$) AS (n agtype); - n ------------------------------------------------------------------------------------ - {"id": 2533274790395906, "label": "node", "properties": {"name": "Lisa"}}::vertex + n +------------------------------------------------------------------------------------- + {"id": 2533274790395906, "label": ["node"], "properties": {"name": "Lisa"}}::vertex (1 row) -- Multiple SETs SELECT * FROM cypher('cypher_merge', $$ MERGE (n:node {name: 'Lisa'}) SET n.age = 23, n.gender = "Female" RETURN n $$) AS (n agtype); - n ------------------------------------------------------------------------------------------------------------------- - {"id": 2533274790395906, "label": "node", "properties": {"age": 23, "name": "Lisa", "gender": "Female"}}::vertex + n +-------------------------------------------------------------------------------------------------------------------- + {"id": 2533274790395906, "label": ["node"], "properties": {"age": 23, "name": "Lisa", "gender": "Female"}}::vertex (1 row) SELECT * FROM cypher('cypher_merge', $$ MATCH (n:node) RETURN n $$) AS (n agtype); - n ------------------------------------------------------------------------------------------------------------------- - {"id": 2533274790395906, "label": "node", "properties": {"age": 23, "name": "Lisa", "gender": "Female"}}::vertex + n +-------------------------------------------------------------------------------------------------------------------- + {"id": 2533274790395906, "label": ["node"], "properties": {"age": 23, "name": "Lisa", "gender": "Female"}}::vertex (1 row) SELECT * FROM cypher('cypher_merge', $$ MERGE (n:node {name: 'Jason'}) SET n.name = 'Lisa', n.age = 23, n.gender = 'Female' RETURN n $$) AS (n agtype); - n ------------------------------------------------------------------------------------------------------------------- - {"id": 2533274790395907, "label": "node", "properties": {"age": 23, "name": "Lisa", "gender": "Female"}}::vertex + n +-------------------------------------------------------------------------------------------------------------------- + {"id": 2533274790395907, "label": ["node"], "properties": {"age": 23, "name": "Lisa", "gender": "Female"}}::vertex (1 row) SELECT * FROM cypher('cypher_merge', $$ MATCH (n:node) RETURN n $$) AS (n agtype); - n ------------------------------------------------------------------------------------------------------------------- - {"id": 2533274790395906, "label": "node", "properties": {"age": 23, "name": "Lisa", "gender": "Female"}}::vertex - {"id": 2533274790395907, "label": "node", "properties": {"age": 23, "name": "Lisa", "gender": "Female"}}::vertex + n +-------------------------------------------------------------------------------------------------------------------- + {"id": 2533274790395906, "label": ["node"], "properties": {"age": 23, "name": "Lisa", "gender": "Female"}}::vertex + {"id": 2533274790395907, "label": ["node"], "properties": {"age": 23, "name": "Lisa", "gender": "Female"}}::vertex (2 rows) -- @@ -913,9 +913,9 @@ SELECT * FROM cypher('cypher_merge', $$ MERGE ()-[:B]->(x:C)-[:E]->(x:C)<-[f:F]- (0 rows) SELECT * FROM cypher('cypher_merge', $$ MERGE ()-[:B]->(x:C)-[:E]->(x:C)<-[f:F]-(y:I) RETURN x $$) AS (x agtype); - x ------------------------------------------------------------------- - {"id": 3096224743817217, "label": "C", "properties": {}}::vertex + x +-------------------------------------------------------------------- + {"id": 3096224743817217, "label": ["C"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_merge', $$ MERGE p=()-[:B]->(x:C)-[:E]->(x:C)<-[f:F]-(y:I) $$) AS (p agtype); @@ -924,22 +924,22 @@ SELECT * FROM cypher('cypher_merge', $$ MERGE p=()-[:B]->(x:C)-[:E]->(x:C)<-[f:F (0 rows) SELECT * FROM cypher('cypher_merge', $$ MERGE p=()-[:B]->(x:C)-[:E]->(x:C)<-[f:F]-(y:I) RETURN p $$) AS (p agtype); - p ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - [{"id": 281474976710705, "label": "", "properties": {}}::vertex, {"id": 2814749767106561, "label": "B", "end_id": 3096224743817217, "start_id": 281474976710705, "properties": {}}::edge, {"id": 3096224743817217, "label": "C", "properties": {}}::vertex, {"id": 3377699720527873, "label": "E", "end_id": 3096224743817217, "start_id": 3096224743817217, "properties": {}}::edge, {"id": 3096224743817217, "label": "C", "properties": {}}::vertex, {"id": 3659174697238529, "label": "F", "end_id": 3096224743817217, "start_id": 3940649673949185, "properties": {}}::edge, {"id": 3940649673949185, "label": "I", "properties": {}}::vertex]::path + p +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 281474976710705, "label": [], "properties": {}}::vertex, {"id": 2814749767106561, "label": "B", "end_id": 3096224743817217, "start_id": 281474976710705, "properties": {}}::edge, {"id": 3096224743817217, "label": ["C"], "properties": {}}::vertex, {"id": 3377699720527873, "label": "E", "end_id": 3096224743817217, "start_id": 3096224743817217, "properties": {}}::edge, {"id": 3096224743817217, "label": ["C"], "properties": {}}::vertex, {"id": 3659174697238529, "label": "F", "end_id": 3096224743817217, "start_id": 3940649673949185, "properties": {}}::edge, {"id": 3940649673949185, "label": ["I"], "properties": {}}::vertex]::path (1 row) SELECT * FROM cypher('cypher_merge', $$ MERGE p=()-[:B]->(x:C)-[:E]->(x:C)<-[f:F]-(y:I) RETURN p $$) AS (p agtype); - p ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - [{"id": 281474976710705, "label": "", "properties": {}}::vertex, {"id": 2814749767106561, "label": "B", "end_id": 3096224743817217, "start_id": 281474976710705, "properties": {}}::edge, {"id": 3096224743817217, "label": "C", "properties": {}}::vertex, {"id": 3377699720527873, "label": "E", "end_id": 3096224743817217, "start_id": 3096224743817217, "properties": {}}::edge, {"id": 3096224743817217, "label": "C", "properties": {}}::vertex, {"id": 3659174697238529, "label": "F", "end_id": 3096224743817217, "start_id": 3940649673949185, "properties": {}}::edge, {"id": 3940649673949185, "label": "I", "properties": {}}::vertex]::path + p +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 281474976710705, "label": [], "properties": {}}::vertex, {"id": 2814749767106561, "label": "B", "end_id": 3096224743817217, "start_id": 281474976710705, "properties": {}}::edge, {"id": 3096224743817217, "label": ["C"], "properties": {}}::vertex, {"id": 3377699720527873, "label": "E", "end_id": 3096224743817217, "start_id": 3096224743817217, "properties": {}}::edge, {"id": 3096224743817217, "label": ["C"], "properties": {}}::vertex, {"id": 3659174697238529, "label": "F", "end_id": 3096224743817217, "start_id": 3940649673949185, "properties": {}}::edge, {"id": 3940649673949185, "label": ["I"], "properties": {}}::vertex]::path (1 row) -- This should only return 1 row, as the path should already exist. SELECT * FROM cypher('cypher_merge', $$ MATCH p=()-[:B]->(:C)-[:E]->(:C)<-[:F]-(:I) RETURN p $$) AS (p agtype); - p ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - [{"id": 281474976710705, "label": "", "properties": {}}::vertex, {"id": 2814749767106561, "label": "B", "end_id": 3096224743817217, "start_id": 281474976710705, "properties": {}}::edge, {"id": 3096224743817217, "label": "C", "properties": {}}::vertex, {"id": 3377699720527873, "label": "E", "end_id": 3096224743817217, "start_id": 3096224743817217, "properties": {}}::edge, {"id": 3096224743817217, "label": "C", "properties": {}}::vertex, {"id": 3659174697238529, "label": "F", "end_id": 3096224743817217, "start_id": 3940649673949185, "properties": {}}::edge, {"id": 3940649673949185, "label": "I", "properties": {}}::vertex]::path + p +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 281474976710705, "label": [], "properties": {}}::vertex, {"id": 2814749767106561, "label": "B", "end_id": 3096224743817217, "start_id": 281474976710705, "properties": {}}::edge, {"id": 3096224743817217, "label": ["C"], "properties": {}}::vertex, {"id": 3377699720527873, "label": "E", "end_id": 3096224743817217, "start_id": 3096224743817217, "properties": {}}::edge, {"id": 3096224743817217, "label": ["C"], "properties": {}}::vertex, {"id": 3659174697238529, "label": "F", "end_id": 3096224743817217, "start_id": 3940649673949185, "properties": {}}::edge, {"id": 3940649673949185, "label": ["I"], "properties": {}}::vertex]::path (1 row) -- test variable reuse in MERGE - the first MERGE of each group should create, @@ -960,9 +960,9 @@ SELECT * FROM cypher('cypher_merge', $$ MERGE (x:P)-[:E]->(x) $$) AS (x agtype); (0 rows) SELECT * FROM cypher('cypher_merge', $$ MATCH p=(x:P)-[:E]->(x) RETURN p, x $$) AS (p agtype, x agtype); - p | x -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------ - [{"id": 4222124650659841, "label": "P", "properties": {}}::vertex, {"id": 3377699720527874, "label": "E", "end_id": 4222124650659841, "start_id": 4222124650659841, "properties": {}}::edge, {"id": 4222124650659841, "label": "P", "properties": {}}::vertex]::path | {"id": 4222124650659841, "label": "P", "properties": {}}::vertex + p | x +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------- + [{"id": 4222124650659841, "label": ["P"], "properties": {}}::vertex, {"id": 3377699720527874, "label": "E", "end_id": 4222124650659841, "start_id": 4222124650659841, "properties": {}}::edge, {"id": 4222124650659841, "label": ["P"], "properties": {}}::vertex]::path | {"id": 4222124650659841, "label": ["P"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_merge', $$ MATCH p=(x:Q)-[:E]->(x:Q) RETURN p, x $$) AS (p agtype, x agtype); @@ -981,9 +981,9 @@ SELECT * FROM cypher('cypher_merge', $$ MERGE (x:Q)-[:E]->(x:Q) $$) AS (x agtype (0 rows) SELECT * FROM cypher('cypher_merge', $$ MATCH p=(x:Q)-[:E]->(x) RETURN p, x $$) AS (p agtype, x agtype); - p | x -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------ - [{"id": 4503599627370497, "label": "Q", "properties": {}}::vertex, {"id": 3377699720527875, "label": "E", "end_id": 4503599627370497, "start_id": 4503599627370497, "properties": {}}::edge, {"id": 4503599627370497, "label": "Q", "properties": {}}::vertex]::path | {"id": 4503599627370497, "label": "Q", "properties": {}}::vertex + p | x +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------- + [{"id": 4503599627370497, "label": ["Q"], "properties": {}}::vertex, {"id": 3377699720527875, "label": "E", "end_id": 4503599627370497, "start_id": 4503599627370497, "properties": {}}::edge, {"id": 4503599627370497, "label": ["Q"], "properties": {}}::vertex]::path | {"id": 4503599627370497, "label": ["Q"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_merge', $$ MATCH p=(x:R)-[:E]->(x) RETURN p, x $$) AS (p agtype, x agtype); @@ -992,44 +992,44 @@ SELECT * FROM cypher('cypher_merge', $$ MATCH p=(x:R)-[:E]->(x) RETURN p, x $$) (0 rows) SELECT * FROM cypher('cypher_merge', $$ MERGE p=(x:R)-[:E]->(x) RETURN p, x $$) AS (p agtype, x agtype); - p | x -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------ - [{"id": 4785074604081153, "label": "R", "properties": {}}::vertex, {"id": 3377699720527876, "label": "E", "end_id": 4785074604081153, "start_id": 4785074604081153, "properties": {}}::edge, {"id": 4785074604081153, "label": "R", "properties": {}}::vertex]::path | {"id": 4785074604081153, "label": "R", "properties": {}}::vertex + p | x +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------- + [{"id": 4785074604081153, "label": ["R"], "properties": {}}::vertex, {"id": 3377699720527876, "label": "E", "end_id": 4785074604081153, "start_id": 4785074604081153, "properties": {}}::edge, {"id": 4785074604081153, "label": ["R"], "properties": {}}::vertex]::path | {"id": 4785074604081153, "label": ["R"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_merge', $$ MERGE p=(x:R)-[:E]->(x) RETURN p, x $$) AS (p agtype, x agtype); - p | x -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------ - [{"id": 4785074604081153, "label": "R", "properties": {}}::vertex, {"id": 3377699720527876, "label": "E", "end_id": 4785074604081153, "start_id": 4785074604081153, "properties": {}}::edge, {"id": 4785074604081153, "label": "R", "properties": {}}::vertex]::path | {"id": 4785074604081153, "label": "R", "properties": {}}::vertex + p | x +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------- + [{"id": 4785074604081153, "label": ["R"], "properties": {}}::vertex, {"id": 3377699720527876, "label": "E", "end_id": 4785074604081153, "start_id": 4785074604081153, "properties": {}}::edge, {"id": 4785074604081153, "label": ["R"], "properties": {}}::vertex]::path | {"id": 4785074604081153, "label": ["R"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_merge', $$ MATCH p=(x:R)-[:E]->(x) RETURN p, x $$) AS (p agtype, x agtype); - p | x -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------ - [{"id": 4785074604081153, "label": "R", "properties": {}}::vertex, {"id": 3377699720527876, "label": "E", "end_id": 4785074604081153, "start_id": 4785074604081153, "properties": {}}::edge, {"id": 4785074604081153, "label": "R", "properties": {}}::vertex]::path | {"id": 4785074604081153, "label": "R", "properties": {}}::vertex + p | x +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------- + [{"id": 4785074604081153, "label": ["R"], "properties": {}}::vertex, {"id": 3377699720527876, "label": "E", "end_id": 4785074604081153, "start_id": 4785074604081153, "properties": {}}::edge, {"id": 4785074604081153, "label": ["R"], "properties": {}}::vertex]::path | {"id": 4785074604081153, "label": ["R"], "properties": {}}::vertex (1 row) -- should return 4 rows SELECT * FROM cypher('cypher_merge', $$ MERGE p=(x)-[:E]->(x) RETURN p, x $$) AS (p agtype, x agtype); - p | x -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------ - [{"id": 3096224743817217, "label": "C", "properties": {}}::vertex, {"id": 3377699720527873, "label": "E", "end_id": 3096224743817217, "start_id": 3096224743817217, "properties": {}}::edge, {"id": 3096224743817217, "label": "C", "properties": {}}::vertex]::path | {"id": 3096224743817217, "label": "C", "properties": {}}::vertex - [{"id": 4222124650659841, "label": "P", "properties": {}}::vertex, {"id": 3377699720527874, "label": "E", "end_id": 4222124650659841, "start_id": 4222124650659841, "properties": {}}::edge, {"id": 4222124650659841, "label": "P", "properties": {}}::vertex]::path | {"id": 4222124650659841, "label": "P", "properties": {}}::vertex - [{"id": 4503599627370497, "label": "Q", "properties": {}}::vertex, {"id": 3377699720527875, "label": "E", "end_id": 4503599627370497, "start_id": 4503599627370497, "properties": {}}::edge, {"id": 4503599627370497, "label": "Q", "properties": {}}::vertex]::path | {"id": 4503599627370497, "label": "Q", "properties": {}}::vertex - [{"id": 4785074604081153, "label": "R", "properties": {}}::vertex, {"id": 3377699720527876, "label": "E", "end_id": 4785074604081153, "start_id": 4785074604081153, "properties": {}}::edge, {"id": 4785074604081153, "label": "R", "properties": {}}::vertex]::path | {"id": 4785074604081153, "label": "R", "properties": {}}::vertex + p | x +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------- + [{"id": 3096224743817217, "label": ["C"], "properties": {}}::vertex, {"id": 3377699720527873, "label": "E", "end_id": 3096224743817217, "start_id": 3096224743817217, "properties": {}}::edge, {"id": 3096224743817217, "label": ["C"], "properties": {}}::vertex]::path | {"id": 3096224743817217, "label": ["C"], "properties": {}}::vertex + [{"id": 4222124650659841, "label": ["P"], "properties": {}}::vertex, {"id": 3377699720527874, "label": "E", "end_id": 4222124650659841, "start_id": 4222124650659841, "properties": {}}::edge, {"id": 4222124650659841, "label": ["P"], "properties": {}}::vertex]::path | {"id": 4222124650659841, "label": ["P"], "properties": {}}::vertex + [{"id": 4503599627370497, "label": ["Q"], "properties": {}}::vertex, {"id": 3377699720527875, "label": "E", "end_id": 4503599627370497, "start_id": 4503599627370497, "properties": {}}::edge, {"id": 4503599627370497, "label": ["Q"], "properties": {}}::vertex]::path | {"id": 4503599627370497, "label": ["Q"], "properties": {}}::vertex + [{"id": 4785074604081153, "label": ["R"], "properties": {}}::vertex, {"id": 3377699720527876, "label": "E", "end_id": 4785074604081153, "start_id": 4785074604081153, "properties": {}}::edge, {"id": 4785074604081153, "label": ["R"], "properties": {}}::vertex]::path | {"id": 4785074604081153, "label": ["R"], "properties": {}}::vertex (4 rows) -- should create 1 row SELECT * FROM cypher('cypher_merge', $$ MERGE p=(x)-[:E1]->(x) RETURN p, x $$) AS (p agtype, x agtype); p | x -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------- - [{"id": 281474976710706, "label": "", "properties": {}}::vertex, {"id": 5066549580791809, "label": "E1", "end_id": 281474976710706, "start_id": 281474976710706, "properties": {}}::edge, {"id": 281474976710706, "label": "", "properties": {}}::vertex]::path | {"id": 281474976710706, "label": "", "properties": {}}::vertex + [{"id": 281474976710706, "label": [], "properties": {}}::vertex, {"id": 5066549580791809, "label": "E1", "end_id": 281474976710706, "start_id": 281474976710706, "properties": {}}::edge, {"id": 281474976710706, "label": [], "properties": {}}::vertex]::path | {"id": 281474976710706, "label": [], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_merge', $$ MATCH p=(x)-[:E1]->(x) RETURN p, x $$) AS (p agtype, x agtype); p | x -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------- - [{"id": 281474976710706, "label": "", "properties": {}}::vertex, {"id": 5066549580791809, "label": "E1", "end_id": 281474976710706, "start_id": 281474976710706, "properties": {}}::edge, {"id": 281474976710706, "label": "", "properties": {}}::vertex]::path | {"id": 281474976710706, "label": "", "properties": {}}::vertex + [{"id": 281474976710706, "label": [], "properties": {}}::vertex, {"id": 5066549580791809, "label": "E1", "end_id": 281474976710706, "start_id": 281474976710706, "properties": {}}::edge, {"id": 281474976710706, "label": [], "properties": {}}::vertex]::path | {"id": 281474976710706, "label": [], "properties": {}}::vertex (1 row) -- the following should fail due to multiple labels diff --git a/regress/expected/cypher_remove.out b/regress/expected/cypher_remove.out index ca2b94ae6..02efcf15c 100644 --- a/regress/expected/cypher_remove.out +++ b/regress/expected/cypher_remove.out @@ -47,11 +47,11 @@ SELECT * FROM cypher('cypher_remove', $$MATCH (n:test_1) REMOVE n.i $$) AS (a ag (0 rows) SELECT * FROM cypher('cypher_remove', $$MATCH (n:test_1) RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "test_1", "properties": {}}::vertex - {"id": 844424930131970, "label": "test_1", "properties": {"a": 0, "j": 5}}::vertex - {"id": 844424930131971, "label": "test_1", "properties": {}}::vertex + a +-------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["test_1"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["test_1"], "properties": {"a": 0, "j": 5}}::vertex + {"id": 844424930131971, "label": ["test_1"], "properties": {}}::vertex (3 rows) --test 2 @@ -71,19 +71,19 @@ SELECT * FROM cypher('cypher_remove', $$CREATE (:test_2 {i: 1})$$) AS (a agtype) (0 rows) SELECT * FROM cypher('cypher_remove', $$MATCH (n:test_2) REMOVE n.j RETURN n$$) AS (a agtype); - a -------------------------------------------------------------------------------------- - {"id": 1125899906842625, "label": "test_2", "properties": {}}::vertex - {"id": 1125899906842626, "label": "test_2", "properties": {"a": 0, "i": 0}}::vertex - {"id": 1125899906842627, "label": "test_2", "properties": {"i": 1}}::vertex + a +--------------------------------------------------------------------------------------- + {"id": 1125899906842625, "label": ["test_2"], "properties": {}}::vertex + {"id": 1125899906842626, "label": ["test_2"], "properties": {"a": 0, "i": 0}}::vertex + {"id": 1125899906842627, "label": ["test_2"], "properties": {"i": 1}}::vertex (3 rows) SELECT * FROM cypher('cypher_remove', $$MATCH (n:test_2) RETURN n$$) AS (a agtype); - a -------------------------------------------------------------------------------------- - {"id": 1125899906842625, "label": "test_2", "properties": {}}::vertex - {"id": 1125899906842626, "label": "test_2", "properties": {"a": 0, "i": 0}}::vertex - {"id": 1125899906842627, "label": "test_2", "properties": {"i": 1}}::vertex + a +--------------------------------------------------------------------------------------- + {"id": 1125899906842625, "label": ["test_2"], "properties": {}}::vertex + {"id": 1125899906842626, "label": ["test_2"], "properties": {"a": 0, "i": 0}}::vertex + {"id": 1125899906842627, "label": ["test_2"], "properties": {"i": 1}}::vertex (3 rows) --test 3 Validate Paths are updated @@ -93,9 +93,9 @@ SELECT * FROM cypher('cypher_remove', $$CREATE (:test_3 { i : 20 } )-[:test_3_ed (0 rows) SELECT * FROM cypher('cypher_remove', $$MATCH p=(n)-[:test_3_edge]->() REMOVE n.i RETURN p$$) AS (a agtype); - a --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 1407374883553281, "label": "test_3", "properties": {}}::vertex, {"id": 1688849860263937, "label": "test_3_edge", "end_id": 1407374883553282, "start_id": 1407374883553281, "properties": {"j": 20}}::edge, {"id": 1407374883553282, "label": "test_3", "properties": {"i": 10}}::vertex]::path + a +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + [{"id": 1407374883553281, "label": ["test_3"], "properties": {}}::vertex, {"id": 1688849860263937, "label": "test_3_edge", "end_id": 1407374883553282, "start_id": 1407374883553281, "properties": {"j": 20}}::edge, {"id": 1407374883553282, "label": ["test_3"], "properties": {"i": 10}}::vertex]::path (1 row) --test 4 Edges @@ -128,18 +128,18 @@ SELECT * FROM cypher('cypher_remove', $$ REMOVE n.j RETURN n $$) AS (a agtype); - a ------------------------------------------------------------------------------ - {"id": 2533274790395905, "label": "test_5", "properties": {"k": 3}}::vertex + a +------------------------------------------------------------------------------- + {"id": 2533274790395905, "label": ["test_5"], "properties": {"k": 3}}::vertex (1 row) SELECT * FROM cypher('cypher_remove', $$ MATCH (n:test_5) RETURN n $$) AS (a agtype); - a ------------------------------------------------------------------------------ - {"id": 2533274790395905, "label": "test_5", "properties": {"k": 3}}::vertex + a +------------------------------------------------------------------------------- + {"id": 2533274790395905, "label": ["test_5"], "properties": {"k": 3}}::vertex (1 row) --test 6 Create a loop and see that set can work after create @@ -154,16 +154,16 @@ SELECT * FROM cypher('cypher_remove', $$ REMOVE n.y RETURN n, p $$) AS (a agtype, b agtype); - a | b -------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 844424930131970, "label": "test_1", "properties": {"a": 0, "j": 5}}::vertex | [{"id": 844424930131970, "label": "test_1", "properties": {"a": 0, "j": 5}}::vertex, {"id": 3096224743817217, "label": "e", "end_id": 844424930131970, "start_id": 844424930131970, "properties": {"j": 34}}::edge, {"id": 844424930131970, "label": "test_1", "properties": {"a": 0, "j": 5}}::vertex]::path - {"id": 2814749767106561, "label": "test_6", "properties": {"j": 5}}::vertex | [{"id": 2814749767106561, "label": "test_6", "properties": {"j": 5}}::vertex, {"id": 3096224743817218, "label": "e", "end_id": 2814749767106561, "start_id": 2814749767106561, "properties": {"j": 34}}::edge, {"id": 2814749767106561, "label": "test_6", "properties": {"j": 5}}::vertex]::path + a | b +--------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131970, "label": ["test_1"], "properties": {"a": 0, "j": 5}}::vertex | [{"id": 844424930131970, "label": ["test_1"], "properties": {"a": 0, "j": 5}}::vertex, {"id": 3096224743817217, "label": "e", "end_id": 844424930131970, "start_id": 844424930131970, "properties": {"j": 34}}::edge, {"id": 844424930131970, "label": ["test_1"], "properties": {"a": 0, "j": 5}}::vertex]::path + {"id": 2814749767106561, "label": ["test_6"], "properties": {"j": 5}}::vertex | [{"id": 2814749767106561, "label": ["test_6"], "properties": {"j": 5}}::vertex, {"id": 3096224743817218, "label": "e", "end_id": 2814749767106561, "start_id": 2814749767106561, "properties": {"j": 34}}::edge, {"id": 2814749767106561, "label": ["test_6"], "properties": {"j": 5}}::vertex]::path (2 rows) SELECT * FROM cypher('cypher_remove', $$MATCH (n:test_6) RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------------------ - {"id": 2814749767106561, "label": "test_6", "properties": {"j": 5}}::vertex + a +------------------------------------------------------------------------------- + {"id": 2814749767106561, "label": ["test_6"], "properties": {"j": 5}}::vertex (1 row) --test 7 Create a loop and see that set can work after create @@ -178,9 +178,9 @@ $$) AS (a agtype); (1 row) SELECT * FROM cypher('cypher_remove', $$MATCH (n:test_7) RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------------ - {"id": 3377699720527873, "label": "test_7", "properties": {}}::vertex + a +------------------------------------------------------------------------- + {"id": 3377699720527873, "label": ["test_7"], "properties": {}}::vertex (1 row) --test 8 @@ -190,9 +190,9 @@ SELECT * FROM cypher('cypher_remove', $$ REMOVE n.y RETURN n $$) AS (a agtype); - a ------------------------------------------------------------------------ - {"id": 3377699720527873, "label": "test_7", "properties": {}}::vertex + a +------------------------------------------------------------------------- + {"id": 3377699720527873, "label": ["test_7"], "properties": {}}::vertex (1 row) --Handle Inheritance @@ -202,43 +202,43 @@ SELECT * FROM cypher('cypher_remove', $$CREATE ( {i : 1 })$$) AS (a agtype); (0 rows) SELECT * FROM cypher('cypher_remove', $$MATCH (n) REMOVE n.i RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex - {"id": 281474976710658, "label": "", "properties": {}}::vertex - {"id": 844424930131969, "label": "test_1", "properties": {}}::vertex - {"id": 844424930131971, "label": "test_1", "properties": {}}::vertex - {"id": 844424930131970, "label": "test_1", "properties": {"a": 0, "j": 5}}::vertex - {"id": 1125899906842625, "label": "test_2", "properties": {}}::vertex - {"id": 1125899906842626, "label": "test_2", "properties": {"a": 0}}::vertex - {"id": 1125899906842627, "label": "test_2", "properties": {}}::vertex - {"id": 1407374883553282, "label": "test_3", "properties": {}}::vertex - {"id": 1407374883553281, "label": "test_3", "properties": {}}::vertex - {"id": 1970324836974593, "label": "test_4", "properties": {}}::vertex - {"id": 1970324836974594, "label": "test_4", "properties": {}}::vertex - {"id": 2533274790395905, "label": "test_5", "properties": {"k": 3}}::vertex - {"id": 2814749767106561, "label": "test_6", "properties": {"j": 5}}::vertex - {"id": 3377699720527873, "label": "test_7", "properties": {}}::vertex + a +-------------------------------------------------------------------------------------- + {"id": 281474976710657, "label": [], "properties": {}}::vertex + {"id": 281474976710658, "label": [], "properties": {}}::vertex + {"id": 844424930131969, "label": ["test_1"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["test_1"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["test_1"], "properties": {"a": 0, "j": 5}}::vertex + {"id": 1125899906842625, "label": ["test_2"], "properties": {}}::vertex + {"id": 1125899906842626, "label": ["test_2"], "properties": {"a": 0}}::vertex + {"id": 1125899906842627, "label": ["test_2"], "properties": {}}::vertex + {"id": 1407374883553282, "label": ["test_3"], "properties": {}}::vertex + {"id": 1407374883553281, "label": ["test_3"], "properties": {}}::vertex + {"id": 1970324836974593, "label": ["test_4"], "properties": {}}::vertex + {"id": 1970324836974594, "label": ["test_4"], "properties": {}}::vertex + {"id": 2533274790395905, "label": ["test_5"], "properties": {"k": 3}}::vertex + {"id": 2814749767106561, "label": ["test_6"], "properties": {"j": 5}}::vertex + {"id": 3377699720527873, "label": ["test_7"], "properties": {}}::vertex (15 rows) SELECT * FROM cypher('cypher_remove', $$MATCH (n) RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex - {"id": 281474976710658, "label": "", "properties": {}}::vertex - {"id": 844424930131969, "label": "test_1", "properties": {}}::vertex - {"id": 844424930131971, "label": "test_1", "properties": {}}::vertex - {"id": 844424930131970, "label": "test_1", "properties": {"a": 0, "j": 5}}::vertex - {"id": 1125899906842625, "label": "test_2", "properties": {}}::vertex - {"id": 1125899906842626, "label": "test_2", "properties": {"a": 0}}::vertex - {"id": 1125899906842627, "label": "test_2", "properties": {}}::vertex - {"id": 1407374883553282, "label": "test_3", "properties": {}}::vertex - {"id": 1407374883553281, "label": "test_3", "properties": {}}::vertex - {"id": 1970324836974593, "label": "test_4", "properties": {}}::vertex - {"id": 1970324836974594, "label": "test_4", "properties": {}}::vertex - {"id": 2533274790395905, "label": "test_5", "properties": {"k": 3}}::vertex - {"id": 2814749767106561, "label": "test_6", "properties": {"j": 5}}::vertex - {"id": 3377699720527873, "label": "test_7", "properties": {}}::vertex + a +-------------------------------------------------------------------------------------- + {"id": 281474976710657, "label": [], "properties": {}}::vertex + {"id": 281474976710658, "label": [], "properties": {}}::vertex + {"id": 844424930131969, "label": ["test_1"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["test_1"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["test_1"], "properties": {"a": 0, "j": 5}}::vertex + {"id": 1125899906842625, "label": ["test_2"], "properties": {}}::vertex + {"id": 1125899906842626, "label": ["test_2"], "properties": {"a": 0}}::vertex + {"id": 1125899906842627, "label": ["test_2"], "properties": {}}::vertex + {"id": 1407374883553282, "label": ["test_3"], "properties": {}}::vertex + {"id": 1407374883553281, "label": ["test_3"], "properties": {}}::vertex + {"id": 1970324836974593, "label": ["test_4"], "properties": {}}::vertex + {"id": 1970324836974594, "label": ["test_4"], "properties": {}}::vertex + {"id": 2533274790395905, "label": ["test_5"], "properties": {"k": 3}}::vertex + {"id": 2814749767106561, "label": ["test_6"], "properties": {"j": 5}}::vertex + {"id": 3377699720527873, "label": ["test_7"], "properties": {}}::vertex (15 rows) -- prepared statements @@ -249,24 +249,24 @@ SELECT * FROM cypher('cypher_remove', $$CREATE ( {i : 1 })$$) AS (a agtype); PREPARE p_1 AS SELECT * FROM cypher('cypher_remove', $$MATCH (n) REMOVE n.i RETURN n $$) AS (a agtype); EXECUTE p_1; - a ------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex - {"id": 281474976710658, "label": "", "properties": {}}::vertex - {"id": 281474976710659, "label": "", "properties": {}}::vertex - {"id": 844424930131969, "label": "test_1", "properties": {}}::vertex - {"id": 844424930131971, "label": "test_1", "properties": {}}::vertex - {"id": 844424930131970, "label": "test_1", "properties": {"a": 0, "j": 5}}::vertex - {"id": 1125899906842625, "label": "test_2", "properties": {}}::vertex - {"id": 1125899906842626, "label": "test_2", "properties": {"a": 0}}::vertex - {"id": 1125899906842627, "label": "test_2", "properties": {}}::vertex - {"id": 1407374883553282, "label": "test_3", "properties": {}}::vertex - {"id": 1407374883553281, "label": "test_3", "properties": {}}::vertex - {"id": 1970324836974593, "label": "test_4", "properties": {}}::vertex - {"id": 1970324836974594, "label": "test_4", "properties": {}}::vertex - {"id": 2533274790395905, "label": "test_5", "properties": {"k": 3}}::vertex - {"id": 2814749767106561, "label": "test_6", "properties": {"j": 5}}::vertex - {"id": 3377699720527873, "label": "test_7", "properties": {}}::vertex + a +-------------------------------------------------------------------------------------- + {"id": 281474976710657, "label": [], "properties": {}}::vertex + {"id": 281474976710658, "label": [], "properties": {}}::vertex + {"id": 281474976710659, "label": [], "properties": {}}::vertex + {"id": 844424930131969, "label": ["test_1"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["test_1"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["test_1"], "properties": {"a": 0, "j": 5}}::vertex + {"id": 1125899906842625, "label": ["test_2"], "properties": {}}::vertex + {"id": 1125899906842626, "label": ["test_2"], "properties": {"a": 0}}::vertex + {"id": 1125899906842627, "label": ["test_2"], "properties": {}}::vertex + {"id": 1407374883553282, "label": ["test_3"], "properties": {}}::vertex + {"id": 1407374883553281, "label": ["test_3"], "properties": {}}::vertex + {"id": 1970324836974593, "label": ["test_4"], "properties": {}}::vertex + {"id": 1970324836974594, "label": ["test_4"], "properties": {}}::vertex + {"id": 2533274790395905, "label": ["test_5"], "properties": {"k": 3}}::vertex + {"id": 2814749767106561, "label": ["test_6"], "properties": {"j": 5}}::vertex + {"id": 3377699720527873, "label": ["test_7"], "properties": {}}::vertex (16 rows) SELECT * FROM cypher('cypher_remove', $$CREATE ( {i : 1 })$$) AS (a agtype); @@ -275,25 +275,25 @@ SELECT * FROM cypher('cypher_remove', $$CREATE ( {i : 1 })$$) AS (a agtype); (0 rows) EXECUTE p_1; - a ------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex - {"id": 281474976710658, "label": "", "properties": {}}::vertex - {"id": 281474976710659, "label": "", "properties": {}}::vertex - {"id": 281474976710660, "label": "", "properties": {}}::vertex - {"id": 844424930131969, "label": "test_1", "properties": {}}::vertex - {"id": 844424930131971, "label": "test_1", "properties": {}}::vertex - {"id": 844424930131970, "label": "test_1", "properties": {"a": 0, "j": 5}}::vertex - {"id": 1125899906842625, "label": "test_2", "properties": {}}::vertex - {"id": 1125899906842626, "label": "test_2", "properties": {"a": 0}}::vertex - {"id": 1125899906842627, "label": "test_2", "properties": {}}::vertex - {"id": 1407374883553282, "label": "test_3", "properties": {}}::vertex - {"id": 1407374883553281, "label": "test_3", "properties": {}}::vertex - {"id": 1970324836974593, "label": "test_4", "properties": {}}::vertex - {"id": 1970324836974594, "label": "test_4", "properties": {}}::vertex - {"id": 2533274790395905, "label": "test_5", "properties": {"k": 3}}::vertex - {"id": 2814749767106561, "label": "test_6", "properties": {"j": 5}}::vertex - {"id": 3377699720527873, "label": "test_7", "properties": {}}::vertex + a +-------------------------------------------------------------------------------------- + {"id": 281474976710657, "label": [], "properties": {}}::vertex + {"id": 281474976710658, "label": [], "properties": {}}::vertex + {"id": 281474976710659, "label": [], "properties": {}}::vertex + {"id": 281474976710660, "label": [], "properties": {}}::vertex + {"id": 844424930131969, "label": ["test_1"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["test_1"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["test_1"], "properties": {"a": 0, "j": 5}}::vertex + {"id": 1125899906842625, "label": ["test_2"], "properties": {}}::vertex + {"id": 1125899906842626, "label": ["test_2"], "properties": {"a": 0}}::vertex + {"id": 1125899906842627, "label": ["test_2"], "properties": {}}::vertex + {"id": 1407374883553282, "label": ["test_3"], "properties": {}}::vertex + {"id": 1407374883553281, "label": ["test_3"], "properties": {}}::vertex + {"id": 1970324836974593, "label": ["test_4"], "properties": {}}::vertex + {"id": 1970324836974594, "label": ["test_4"], "properties": {}}::vertex + {"id": 2533274790395905, "label": ["test_5"], "properties": {"k": 3}}::vertex + {"id": 2814749767106561, "label": ["test_6"], "properties": {"j": 5}}::vertex + {"id": 3377699720527873, "label": ["test_7"], "properties": {}}::vertex (17 rows) -- pl/pgsql @@ -312,26 +312,26 @@ BEGIN END $BODY$; SELECT remove_test(); - remove_test ------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex - {"id": 281474976710658, "label": "", "properties": {}}::vertex - {"id": 281474976710659, "label": "", "properties": {}}::vertex - {"id": 281474976710660, "label": "", "properties": {}}::vertex - {"id": 281474976710661, "label": "", "properties": {}}::vertex - {"id": 844424930131969, "label": "test_1", "properties": {}}::vertex - {"id": 844424930131971, "label": "test_1", "properties": {}}::vertex - {"id": 844424930131970, "label": "test_1", "properties": {"a": 0, "j": 5}}::vertex - {"id": 1125899906842625, "label": "test_2", "properties": {}}::vertex - {"id": 1125899906842626, "label": "test_2", "properties": {"a": 0}}::vertex - {"id": 1125899906842627, "label": "test_2", "properties": {}}::vertex - {"id": 1407374883553282, "label": "test_3", "properties": {}}::vertex - {"id": 1407374883553281, "label": "test_3", "properties": {}}::vertex - {"id": 1970324836974593, "label": "test_4", "properties": {}}::vertex - {"id": 1970324836974594, "label": "test_4", "properties": {}}::vertex - {"id": 2533274790395905, "label": "test_5", "properties": {"k": 3}}::vertex - {"id": 2814749767106561, "label": "test_6", "properties": {"j": 5}}::vertex - {"id": 3377699720527873, "label": "test_7", "properties": {}}::vertex + remove_test +-------------------------------------------------------------------------------------- + {"id": 281474976710657, "label": [], "properties": {}}::vertex + {"id": 281474976710658, "label": [], "properties": {}}::vertex + {"id": 281474976710659, "label": [], "properties": {}}::vertex + {"id": 281474976710660, "label": [], "properties": {}}::vertex + {"id": 281474976710661, "label": [], "properties": {}}::vertex + {"id": 844424930131969, "label": ["test_1"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["test_1"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["test_1"], "properties": {"a": 0, "j": 5}}::vertex + {"id": 1125899906842625, "label": ["test_2"], "properties": {}}::vertex + {"id": 1125899906842626, "label": ["test_2"], "properties": {"a": 0}}::vertex + {"id": 1125899906842627, "label": ["test_2"], "properties": {}}::vertex + {"id": 1407374883553282, "label": ["test_3"], "properties": {}}::vertex + {"id": 1407374883553281, "label": ["test_3"], "properties": {}}::vertex + {"id": 1970324836974593, "label": ["test_4"], "properties": {}}::vertex + {"id": 1970324836974594, "label": ["test_4"], "properties": {}}::vertex + {"id": 2533274790395905, "label": ["test_5"], "properties": {"k": 3}}::vertex + {"id": 2814749767106561, "label": ["test_6"], "properties": {"j": 5}}::vertex + {"id": 3377699720527873, "label": ["test_7"], "properties": {}}::vertex (18 rows) SELECT * FROM cypher('cypher_remove', $$CREATE ( {i : 1 })$$) AS (a agtype); @@ -340,102 +340,102 @@ SELECT * FROM cypher('cypher_remove', $$CREATE ( {i : 1 })$$) AS (a agtype); (0 rows) SELECT remove_test(); - remove_test ------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex - {"id": 281474976710658, "label": "", "properties": {}}::vertex - {"id": 281474976710659, "label": "", "properties": {}}::vertex - {"id": 281474976710660, "label": "", "properties": {}}::vertex - {"id": 281474976710661, "label": "", "properties": {}}::vertex - {"id": 281474976710662, "label": "", "properties": {}}::vertex - {"id": 844424930131969, "label": "test_1", "properties": {}}::vertex - {"id": 844424930131971, "label": "test_1", "properties": {}}::vertex - {"id": 844424930131970, "label": "test_1", "properties": {"a": 0, "j": 5}}::vertex - {"id": 1125899906842625, "label": "test_2", "properties": {}}::vertex - {"id": 1125899906842626, "label": "test_2", "properties": {"a": 0}}::vertex - {"id": 1125899906842627, "label": "test_2", "properties": {}}::vertex - {"id": 1407374883553282, "label": "test_3", "properties": {}}::vertex - {"id": 1407374883553281, "label": "test_3", "properties": {}}::vertex - {"id": 1970324836974593, "label": "test_4", "properties": {}}::vertex - {"id": 1970324836974594, "label": "test_4", "properties": {}}::vertex - {"id": 2533274790395905, "label": "test_5", "properties": {"k": 3}}::vertex - {"id": 2814749767106561, "label": "test_6", "properties": {"j": 5}}::vertex - {"id": 3377699720527873, "label": "test_7", "properties": {}}::vertex + remove_test +-------------------------------------------------------------------------------------- + {"id": 281474976710657, "label": [], "properties": {}}::vertex + {"id": 281474976710658, "label": [], "properties": {}}::vertex + {"id": 281474976710659, "label": [], "properties": {}}::vertex + {"id": 281474976710660, "label": [], "properties": {}}::vertex + {"id": 281474976710661, "label": [], "properties": {}}::vertex + {"id": 281474976710662, "label": [], "properties": {}}::vertex + {"id": 844424930131969, "label": ["test_1"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["test_1"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["test_1"], "properties": {"a": 0, "j": 5}}::vertex + {"id": 1125899906842625, "label": ["test_2"], "properties": {}}::vertex + {"id": 1125899906842626, "label": ["test_2"], "properties": {"a": 0}}::vertex + {"id": 1125899906842627, "label": ["test_2"], "properties": {}}::vertex + {"id": 1407374883553282, "label": ["test_3"], "properties": {}}::vertex + {"id": 1407374883553281, "label": ["test_3"], "properties": {}}::vertex + {"id": 1970324836974593, "label": ["test_4"], "properties": {}}::vertex + {"id": 1970324836974594, "label": ["test_4"], "properties": {}}::vertex + {"id": 2533274790395905, "label": ["test_5"], "properties": {"k": 3}}::vertex + {"id": 2814749767106561, "label": ["test_6"], "properties": {"j": 5}}::vertex + {"id": 3377699720527873, "label": ["test_7"], "properties": {}}::vertex (19 rows) -- -- Updating Multiple Fields -- SELECT * FROM cypher('cypher_remove', $$MATCH (n) RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex - {"id": 281474976710658, "label": "", "properties": {}}::vertex - {"id": 281474976710659, "label": "", "properties": {}}::vertex - {"id": 281474976710660, "label": "", "properties": {}}::vertex - {"id": 281474976710661, "label": "", "properties": {}}::vertex - {"id": 281474976710662, "label": "", "properties": {}}::vertex - {"id": 844424930131969, "label": "test_1", "properties": {}}::vertex - {"id": 844424930131971, "label": "test_1", "properties": {}}::vertex - {"id": 844424930131970, "label": "test_1", "properties": {"a": 0, "j": 5}}::vertex - {"id": 1125899906842625, "label": "test_2", "properties": {}}::vertex - {"id": 1125899906842626, "label": "test_2", "properties": {"a": 0}}::vertex - {"id": 1125899906842627, "label": "test_2", "properties": {}}::vertex - {"id": 1407374883553282, "label": "test_3", "properties": {}}::vertex - {"id": 1407374883553281, "label": "test_3", "properties": {}}::vertex - {"id": 1970324836974593, "label": "test_4", "properties": {}}::vertex - {"id": 1970324836974594, "label": "test_4", "properties": {}}::vertex - {"id": 2533274790395905, "label": "test_5", "properties": {"k": 3}}::vertex - {"id": 2814749767106561, "label": "test_6", "properties": {"j": 5}}::vertex - {"id": 3377699720527873, "label": "test_7", "properties": {}}::vertex + a +-------------------------------------------------------------------------------------- + {"id": 281474976710657, "label": [], "properties": {}}::vertex + {"id": 281474976710658, "label": [], "properties": {}}::vertex + {"id": 281474976710659, "label": [], "properties": {}}::vertex + {"id": 281474976710660, "label": [], "properties": {}}::vertex + {"id": 281474976710661, "label": [], "properties": {}}::vertex + {"id": 281474976710662, "label": [], "properties": {}}::vertex + {"id": 844424930131969, "label": ["test_1"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["test_1"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["test_1"], "properties": {"a": 0, "j": 5}}::vertex + {"id": 1125899906842625, "label": ["test_2"], "properties": {}}::vertex + {"id": 1125899906842626, "label": ["test_2"], "properties": {"a": 0}}::vertex + {"id": 1125899906842627, "label": ["test_2"], "properties": {}}::vertex + {"id": 1407374883553282, "label": ["test_3"], "properties": {}}::vertex + {"id": 1407374883553281, "label": ["test_3"], "properties": {}}::vertex + {"id": 1970324836974593, "label": ["test_4"], "properties": {}}::vertex + {"id": 1970324836974594, "label": ["test_4"], "properties": {}}::vertex + {"id": 2533274790395905, "label": ["test_5"], "properties": {"k": 3}}::vertex + {"id": 2814749767106561, "label": ["test_6"], "properties": {"j": 5}}::vertex + {"id": 3377699720527873, "label": ["test_7"], "properties": {}}::vertex (19 rows) SELECT * FROM cypher('cypher_remove', $$MATCH (n) REMOVE n.i, n.j, n.k RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------------------ - {"id": 281474976710657, "label": "", "properties": {}}::vertex - {"id": 281474976710658, "label": "", "properties": {}}::vertex - {"id": 281474976710659, "label": "", "properties": {}}::vertex - {"id": 281474976710660, "label": "", "properties": {}}::vertex - {"id": 281474976710661, "label": "", "properties": {}}::vertex - {"id": 281474976710662, "label": "", "properties": {}}::vertex - {"id": 844424930131969, "label": "test_1", "properties": {}}::vertex - {"id": 844424930131971, "label": "test_1", "properties": {}}::vertex - {"id": 844424930131970, "label": "test_1", "properties": {"a": 0}}::vertex - {"id": 1125899906842625, "label": "test_2", "properties": {}}::vertex - {"id": 1125899906842626, "label": "test_2", "properties": {"a": 0}}::vertex - {"id": 1125899906842627, "label": "test_2", "properties": {}}::vertex - {"id": 1407374883553282, "label": "test_3", "properties": {}}::vertex - {"id": 1407374883553281, "label": "test_3", "properties": {}}::vertex - {"id": 1970324836974593, "label": "test_4", "properties": {}}::vertex - {"id": 1970324836974594, "label": "test_4", "properties": {}}::vertex - {"id": 2533274790395905, "label": "test_5", "properties": {}}::vertex - {"id": 2814749767106561, "label": "test_6", "properties": {}}::vertex - {"id": 3377699720527873, "label": "test_7", "properties": {}}::vertex + a +------------------------------------------------------------------------------- + {"id": 281474976710657, "label": [], "properties": {}}::vertex + {"id": 281474976710658, "label": [], "properties": {}}::vertex + {"id": 281474976710659, "label": [], "properties": {}}::vertex + {"id": 281474976710660, "label": [], "properties": {}}::vertex + {"id": 281474976710661, "label": [], "properties": {}}::vertex + {"id": 281474976710662, "label": [], "properties": {}}::vertex + {"id": 844424930131969, "label": ["test_1"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["test_1"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["test_1"], "properties": {"a": 0}}::vertex + {"id": 1125899906842625, "label": ["test_2"], "properties": {}}::vertex + {"id": 1125899906842626, "label": ["test_2"], "properties": {"a": 0}}::vertex + {"id": 1125899906842627, "label": ["test_2"], "properties": {}}::vertex + {"id": 1407374883553282, "label": ["test_3"], "properties": {}}::vertex + {"id": 1407374883553281, "label": ["test_3"], "properties": {}}::vertex + {"id": 1970324836974593, "label": ["test_4"], "properties": {}}::vertex + {"id": 1970324836974594, "label": ["test_4"], "properties": {}}::vertex + {"id": 2533274790395905, "label": ["test_5"], "properties": {}}::vertex + {"id": 2814749767106561, "label": ["test_6"], "properties": {}}::vertex + {"id": 3377699720527873, "label": ["test_7"], "properties": {}}::vertex (19 rows) SELECT * FROM cypher('cypher_remove', $$MATCH (n) RETURN n$$) AS (a agtype); - a ------------------------------------------------------------------------------ - {"id": 281474976710657, "label": "", "properties": {}}::vertex - {"id": 281474976710658, "label": "", "properties": {}}::vertex - {"id": 281474976710659, "label": "", "properties": {}}::vertex - {"id": 281474976710660, "label": "", "properties": {}}::vertex - {"id": 281474976710661, "label": "", "properties": {}}::vertex - {"id": 281474976710662, "label": "", "properties": {}}::vertex - {"id": 844424930131969, "label": "test_1", "properties": {}}::vertex - {"id": 844424930131971, "label": "test_1", "properties": {}}::vertex - {"id": 844424930131970, "label": "test_1", "properties": {"a": 0}}::vertex - {"id": 1125899906842625, "label": "test_2", "properties": {}}::vertex - {"id": 1125899906842626, "label": "test_2", "properties": {"a": 0}}::vertex - {"id": 1125899906842627, "label": "test_2", "properties": {}}::vertex - {"id": 1407374883553282, "label": "test_3", "properties": {}}::vertex - {"id": 1407374883553281, "label": "test_3", "properties": {}}::vertex - {"id": 1970324836974593, "label": "test_4", "properties": {}}::vertex - {"id": 1970324836974594, "label": "test_4", "properties": {}}::vertex - {"id": 2533274790395905, "label": "test_5", "properties": {}}::vertex - {"id": 2814749767106561, "label": "test_6", "properties": {}}::vertex - {"id": 3377699720527873, "label": "test_7", "properties": {}}::vertex + a +------------------------------------------------------------------------------- + {"id": 281474976710657, "label": [], "properties": {}}::vertex + {"id": 281474976710658, "label": [], "properties": {}}::vertex + {"id": 281474976710659, "label": [], "properties": {}}::vertex + {"id": 281474976710660, "label": [], "properties": {}}::vertex + {"id": 281474976710661, "label": [], "properties": {}}::vertex + {"id": 281474976710662, "label": [], "properties": {}}::vertex + {"id": 844424930131969, "label": ["test_1"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["test_1"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["test_1"], "properties": {"a": 0}}::vertex + {"id": 1125899906842625, "label": ["test_2"], "properties": {}}::vertex + {"id": 1125899906842626, "label": ["test_2"], "properties": {"a": 0}}::vertex + {"id": 1125899906842627, "label": ["test_2"], "properties": {}}::vertex + {"id": 1407374883553282, "label": ["test_3"], "properties": {}}::vertex + {"id": 1407374883553281, "label": ["test_3"], "properties": {}}::vertex + {"id": 1970324836974593, "label": ["test_4"], "properties": {}}::vertex + {"id": 1970324836974594, "label": ["test_4"], "properties": {}}::vertex + {"id": 2533274790395905, "label": ["test_5"], "properties": {}}::vertex + {"id": 2814749767106561, "label": ["test_6"], "properties": {}}::vertex + {"id": 3377699720527873, "label": ["test_7"], "properties": {}}::vertex (19 rows) SELECT * FROM cypher('cypher_remove', $$CREATE ()-[:edge_multi_property { i: 5, j: 20}]->()$$) AS (a agtype); diff --git a/regress/expected/cypher_set.out b/regress/expected/cypher_set.out index 1d24a7f9b..9586a9b1d 100644 --- a/regress/expected/cypher_set.out +++ b/regress/expected/cypher_set.out @@ -47,49 +47,49 @@ SELECT * FROM cypher('cypher_set', $$MATCH (n) SET n.i = 3$$) AS (a agtype); (0 rows) SELECT * FROM cypher('cypher_set', $$MATCH (n) WHERE n.j = 5 SET n.i = NULL RETURN n$$) AS (a agtype); - a -------------------------------------------------------------------------------- - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "j": 5}}::vertex + a +--------------------------------------------------------------------------------- + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "j": 5}}::vertex (1 row) SELECT * FROM cypher('cypher_set', $$MATCH (n) RETURN n$$) AS (a agtype); - a -------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "v", "properties": {"i": 3}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": 3}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "j": 5}}::vertex + a +--------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["v"], "properties": {"i": 3}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": 3}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "j": 5}}::vertex (3 rows) SELECT * FROM cypher('cypher_set', $$MATCH (n) SET n.i = NULL RETURN n$$) AS (a agtype); - a -------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "v", "properties": {}}::vertex - {"id": 844424930131971, "label": "v", "properties": {}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "j": 5}}::vertex + a +--------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["v"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "j": 5}}::vertex (3 rows) SELECT * FROM cypher('cypher_set', $$MATCH (n) RETURN n$$) AS (a agtype); - a -------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "v", "properties": {}}::vertex - {"id": 844424930131971, "label": "v", "properties": {}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "j": 5}}::vertex + a +--------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["v"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "j": 5}}::vertex (3 rows) SELECT * FROM cypher('cypher_set', $$MATCH (n) SET n.i = 3 RETURN n$$) AS (a agtype); - a ---------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "v", "properties": {"i": 3}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": 3}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 3, "j": 5}}::vertex + a +----------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["v"], "properties": {"i": 3}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": 3}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 3, "j": 5}}::vertex (3 rows) SELECT * FROM cypher('cypher_set', $$MATCH (n) RETURN n$$) AS (a agtype); - a ---------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "v", "properties": {"i": 3}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": 3}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 3, "j": 5}}::vertex + a +----------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["v"], "properties": {"i": 3}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": 3}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 3, "j": 5}}::vertex (3 rows) --Test assigning properties to rand() and pi() @@ -102,11 +102,11 @@ SELECT * FROM cypher('cypher_set', $$MATCH (n) SET n.i = rand() RETURN n.i < 1 A (3 rows) SELECT * FROM cypher('cypher_set', $$MATCH (n) SET n.i = pi() RETURN n$$) AS (a agtype); - a -------------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "v", "properties": {"i": 3.141592653589793}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": 3.141592653589793}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 3.141592653589793, "j": 5}}::vertex + a +--------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["v"], "properties": {"i": 3.141592653589793}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": 3.141592653589793}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 3.141592653589793, "j": 5}}::vertex (3 rows) --Handle Inheritance @@ -116,40 +116,40 @@ SELECT * FROM cypher('cypher_set', $$CREATE ()$$) AS (a agtype); (0 rows) SELECT * FROM cypher('cypher_set', $$MATCH (n) SET n.i = 3 RETURN n$$) AS (a agtype); - a ---------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"i": 3}}::vertex - {"id": 844424930131969, "label": "v", "properties": {"i": 3}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": 3}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 3, "j": 5}}::vertex + a +----------------------------------------------------------------------------------------- + {"id": 281474976710657, "label": [], "properties": {"i": 3}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {"i": 3}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": 3}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 3, "j": 5}}::vertex (4 rows) SELECT * FROM cypher('cypher_set', $$MATCH (n) RETURN n$$) AS (a agtype); - a ---------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"i": 3}}::vertex - {"id": 844424930131969, "label": "v", "properties": {"i": 3}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": 3}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 3, "j": 5}}::vertex + a +----------------------------------------------------------------------------------------- + {"id": 281474976710657, "label": [], "properties": {"i": 3}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {"i": 3}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": 3}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 3, "j": 5}}::vertex (4 rows) --Validate Paths are updated SELECT * FROM cypher('cypher_set', $$MATCH (n) CREATE (n)-[:e {j:20}]->(:other_v {k:10}) RETURN n$$) AS (a agtype); - a ---------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"i": 3}}::vertex - {"id": 844424930131969, "label": "v", "properties": {"i": 3}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": 3}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 3, "j": 5}}::vertex + a +----------------------------------------------------------------------------------------- + {"id": 281474976710657, "label": [], "properties": {"i": 3}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {"i": 3}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": 3}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 3, "j": 5}}::vertex (4 rows) SELECT * FROM cypher('cypher_set', $$MATCH p=(n)-[]->() SET n.i = 50 RETURN p$$) AS (a agtype); - a ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710657, "label": "", "properties": {"i": 50}}::vertex, {"id": 1125899906842625, "label": "e", "end_id": 1407374883553281, "start_id": 281474976710657, "properties": {"j": 20}}::edge, {"id": 1407374883553281, "label": "other_v", "properties": {"k": 10}}::vertex]::path - [{"id": 844424930131969, "label": "v", "properties": {"i": 50}}::vertex, {"id": 1125899906842626, "label": "e", "end_id": 1407374883553282, "start_id": 844424930131969, "properties": {"j": 20}}::edge, {"id": 1407374883553282, "label": "other_v", "properties": {"k": 10}}::vertex]::path - [{"id": 844424930131971, "label": "v", "properties": {"i": 50}}::vertex, {"id": 1125899906842627, "label": "e", "end_id": 1407374883553283, "start_id": 844424930131971, "properties": {"j": 20}}::edge, {"id": 1407374883553283, "label": "other_v", "properties": {"k": 10}}::vertex]::path - [{"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 50, "j": 5}}::vertex, {"id": 1125899906842628, "label": "e", "end_id": 1407374883553284, "start_id": 844424930131970, "properties": {"j": 20}}::edge, {"id": 1407374883553284, "label": "other_v", "properties": {"k": 10}}::vertex]::path + a +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 281474976710657, "label": [], "properties": {"i": 50}}::vertex, {"id": 1125899906842625, "label": "e", "end_id": 1407374883553281, "start_id": 281474976710657, "properties": {"j": 20}}::edge, {"id": 1407374883553281, "label": ["other_v"], "properties": {"k": 10}}::vertex]::path + [{"id": 844424930131969, "label": ["v"], "properties": {"i": 50}}::vertex, {"id": 1125899906842626, "label": "e", "end_id": 1407374883553282, "start_id": 844424930131969, "properties": {"j": 20}}::edge, {"id": 1407374883553282, "label": ["other_v"], "properties": {"k": 10}}::vertex]::path + [{"id": 844424930131971, "label": ["v"], "properties": {"i": 50}}::vertex, {"id": 1125899906842627, "label": "e", "end_id": 1407374883553283, "start_id": 844424930131971, "properties": {"j": 20}}::edge, {"id": 1407374883553283, "label": ["other_v"], "properties": {"k": 10}}::vertex]::path + [{"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 50, "j": 5}}::vertex, {"id": 1125899906842628, "label": "e", "end_id": 1407374883553284, "start_id": 844424930131970, "properties": {"j": 20}}::edge, {"id": 1407374883553284, "label": ["other_v"], "properties": {"k": 10}}::vertex]::path (4 rows) --Edges @@ -177,9 +177,9 @@ SELECT * FROM cypher('cypher_set', $$ SET n.z = 99 RETURN n $$) AS (a agtype); - a ----------------------------------------------------------------------------------------------------------- - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 50, "j": 5, "y": 50, "z": 99}}::vertex + a +------------------------------------------------------------------------------------------------------------ + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 50, "j": 5, "y": 50, "z": 99}}::vertex (1 row) SELECT * FROM cypher('cypher_set', $$ @@ -190,9 +190,9 @@ SELECT * FROM cypher('cypher_set', $$ SET n.arr = [n.y, n.z] RETURN n $$) AS (a agtype); - a ---------------------------------------------------------------------------------------------------------------------------- - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 50, "j": 5, "y": 50, "z": 99, "arr": [50, 99]}}::vertex + a +----------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 50, "j": 5, "y": 50, "z": 99, "arr": [50, 99]}}::vertex (1 row) SELECT * FROM cypher('cypher_set', $$ @@ -200,18 +200,18 @@ SELECT * FROM cypher('cypher_set', $$ REMOVE n.arr RETURN n $$) AS (a agtype); - a ----------------------------------------------------------------------------------------------------------- - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 50, "j": 5, "y": 50, "z": 99}}::vertex + a +------------------------------------------------------------------------------------------------------------ + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 50, "j": 5, "y": 50, "z": 99}}::vertex (1 row) SELECT * FROM cypher('cypher_set', $$ MATCH (n {j: 5}) RETURN n $$) AS (a agtype); - a ----------------------------------------------------------------------------------------------------------- - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 50, "j": 5, "y": 50, "z": 99}}::vertex + a +------------------------------------------------------------------------------------------------------------ + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 50, "j": 5, "y": 50, "z": 99}}::vertex (1 row) --Create a loop and see that set can work after create @@ -221,9 +221,9 @@ SELECT * FROM cypher('cypher_set', $$ SET n.y = 99 RETURN n, p $$) AS (a agtype, b agtype); - a | b -----------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 50, "j": 5, "y": 99, "z": 99}}::vertex | [{"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 50, "j": 5, "y": 99, "z": 99}}::vertex, {"id": 1125899906842629, "label": "e", "end_id": 844424930131970, "start_id": 844424930131970, "properties": {"j": 34}}::edge, {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 50, "j": 5, "y": 99, "z": 99}}::vertex]::path + a | b +------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 50, "j": 5, "y": 99, "z": 99}}::vertex | [{"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 50, "j": 5, "y": 99, "z": 99}}::vertex, {"id": 1125899906842629, "label": "e", "end_id": 844424930131970, "start_id": 844424930131970, "properties": {"j": 34}}::edge, {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 50, "j": 5, "y": 99, "z": 99}}::vertex]::path (1 row) --Create a loop and see that set can work after create @@ -243,10 +243,10 @@ SELECT * FROM cypher('cypher_set', $$ SET n.y = 1 RETURN n $$) AS (a agtype); - a ---------------------------------------------------------------------------------------------------------- - {"id": 281474976710658, "label": "", "properties": {"y": 1}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 50, "j": 5, "y": 1, "z": 99}}::vertex + a +----------------------------------------------------------------------------------------------------------- + {"id": 281474976710658, "label": [], "properties": {"y": 1}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 50, "j": 5, "y": 1, "z": 99}}::vertex (2 rows) SELECT * FROM cypher('cypher_set', $$ @@ -255,10 +255,10 @@ SELECT * FROM cypher('cypher_set', $$ SET n.y = 2 RETURN n $$) AS (a agtype); - a ---------------------------------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"y": 2}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 50, "j": 5, "y": 2, "z": 99}}::vertex + a +----------------------------------------------------------------------------------------------------------- + {"id": 281474976710659, "label": [], "properties": {"y": 2}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 50, "j": 5, "y": 2, "z": 99}}::vertex (2 rows) -- Test that SET works with nodes(path) and relationships(path) @@ -270,10 +270,10 @@ SELECT * FROM cypher('cypher_set', $$ SET n.k = 999 RETURN n $$) AS (a agtype); - a -------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710658, "label": "", "properties": {"k": 999, "y": 1}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 50, "j": 5, "k": 999, "y": 2, "z": 99}}::vertex + a +--------------------------------------------------------------------------------------------------------------------- + {"id": 281474976710658, "label": [], "properties": {"k": 999, "y": 1}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 50, "j": 5, "k": 999, "y": 2, "z": 99}}::vertex (2 rows) SELECT * FROM cypher('cypher_set', $$ @@ -295,90 +295,90 @@ SELECT * FROM cypher('cypher_set', $$ REMOVE n.k, e.l RETURN p $$) AS (a agtype); - a ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710658, "label": "", "properties": {"y": 1}}::vertex, {"id": 1125899906842630, "label": "e", "end_id": 281474976710659, "start_id": 281474976710658, "properties": {"j": 34, "y": 99}}::edge, {"id": 281474976710659, "label": "", "properties": {"y": 2}}::vertex]::path - [{"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 50, "j": 5, "y": 2, "z": 99}}::vertex, {"id": 1125899906842629, "label": "e", "end_id": 844424930131970, "start_id": 844424930131970, "properties": {"j": 34}}::edge, {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 50, "j": 5, "y": 2, "z": 99}}::vertex]::path + a +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 281474976710658, "label": [], "properties": {"y": 1}}::vertex, {"id": 1125899906842630, "label": "e", "end_id": 281474976710659, "start_id": 281474976710658, "properties": {"j": 34, "y": 99}}::edge, {"id": 281474976710659, "label": [], "properties": {"y": 2}}::vertex]::path + [{"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 50, "j": 5, "y": 2, "z": 99}}::vertex, {"id": 1125899906842629, "label": "e", "end_id": 844424930131970, "start_id": 844424930131970, "properties": {"j": 34}}::edge, {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 50, "j": 5, "y": 2, "z": 99}}::vertex]::path (2 rows) SELECT * FROM cypher('cypher_set', $$MATCH (n)-[]->(n) SET n.y = 99 RETURN n$$) AS (a agtype); - a ----------------------------------------------------------------------------------------------------------- - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 50, "j": 5, "y": 99, "z": 99}}::vertex + a +------------------------------------------------------------------------------------------------------------ + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 50, "j": 5, "y": 99, "z": 99}}::vertex (1 row) SELECT * FROM cypher('cypher_set', $$MATCH (n) MATCH (n)-[]->(m) SET n.t = 150 RETURN n$$) AS (a agtype); - a --------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710658, "label": "", "properties": {"t": 150, "y": 1}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 50, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex - {"id": 281474976710657, "label": "", "properties": {"i": 50, "t": 150}}::vertex - {"id": 844424930131969, "label": "v", "properties": {"i": 50, "t": 150}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": 50, "t": 150}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 50, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex + a +---------------------------------------------------------------------------------------------------------------------- + {"id": 281474976710658, "label": [], "properties": {"t": 150, "y": 1}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 50, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": 50, "t": 150}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {"i": 50, "t": 150}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": 50, "t": 150}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 50, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex (6 rows) -- prepared statements PREPARE p_1 AS SELECT * FROM cypher('cypher_set', $$MATCH (n) SET n.i = 3 RETURN n $$) AS (a agtype); EXECUTE p_1; - a -------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"i": 3, "y": 2}}::vertex - {"id": 281474976710658, "label": "", "properties": {"i": 3, "t": 150, "y": 1}}::vertex - {"id": 281474976710657, "label": "", "properties": {"i": 3, "t": 150}}::vertex - {"id": 844424930131969, "label": "v", "properties": {"i": 3, "t": 150}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": 3, "t": 150}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 3, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex - {"id": 1407374883553281, "label": "other_v", "properties": {"i": 3, "k": 10}}::vertex - {"id": 1407374883553282, "label": "other_v", "properties": {"i": 3, "k": 10}}::vertex - {"id": 1407374883553283, "label": "other_v", "properties": {"i": 3, "k": 10}}::vertex - {"id": 1407374883553284, "label": "other_v", "properties": {"i": 3, "k": 10}}::vertex + a +--------------------------------------------------------------------------------------------------------------------- + {"id": 281474976710659, "label": [], "properties": {"i": 3, "y": 2}}::vertex + {"id": 281474976710658, "label": [], "properties": {"i": 3, "t": 150, "y": 1}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": 3, "t": 150}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {"i": 3, "t": 150}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": 3, "t": 150}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 3, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex + {"id": 1407374883553281, "label": ["other_v"], "properties": {"i": 3, "k": 10}}::vertex + {"id": 1407374883553282, "label": ["other_v"], "properties": {"i": 3, "k": 10}}::vertex + {"id": 1407374883553283, "label": ["other_v"], "properties": {"i": 3, "k": 10}}::vertex + {"id": 1407374883553284, "label": ["other_v"], "properties": {"i": 3, "k": 10}}::vertex (10 rows) EXECUTE p_1; - a -------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"i": 3, "y": 2}}::vertex - {"id": 281474976710658, "label": "", "properties": {"i": 3, "t": 150, "y": 1}}::vertex - {"id": 281474976710657, "label": "", "properties": {"i": 3, "t": 150}}::vertex - {"id": 844424930131969, "label": "v", "properties": {"i": 3, "t": 150}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": 3, "t": 150}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 3, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex - {"id": 1407374883553281, "label": "other_v", "properties": {"i": 3, "k": 10}}::vertex - {"id": 1407374883553282, "label": "other_v", "properties": {"i": 3, "k": 10}}::vertex - {"id": 1407374883553283, "label": "other_v", "properties": {"i": 3, "k": 10}}::vertex - {"id": 1407374883553284, "label": "other_v", "properties": {"i": 3, "k": 10}}::vertex + a +--------------------------------------------------------------------------------------------------------------------- + {"id": 281474976710659, "label": [], "properties": {"i": 3, "y": 2}}::vertex + {"id": 281474976710658, "label": [], "properties": {"i": 3, "t": 150, "y": 1}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": 3, "t": 150}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {"i": 3, "t": 150}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": 3, "t": 150}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 3, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex + {"id": 1407374883553281, "label": ["other_v"], "properties": {"i": 3, "k": 10}}::vertex + {"id": 1407374883553282, "label": ["other_v"], "properties": {"i": 3, "k": 10}}::vertex + {"id": 1407374883553283, "label": ["other_v"], "properties": {"i": 3, "k": 10}}::vertex + {"id": 1407374883553284, "label": ["other_v"], "properties": {"i": 3, "k": 10}}::vertex (10 rows) PREPARE p_2 AS SELECT * FROM cypher('cypher_set', $$MATCH (n) SET n.i = $var_name RETURN n $$, $1) AS (a agtype); EXECUTE p_2('{"var_name": 4}'); - a -------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"i": 4, "y": 2}}::vertex - {"id": 281474976710658, "label": "", "properties": {"i": 4, "t": 150, "y": 1}}::vertex - {"id": 281474976710657, "label": "", "properties": {"i": 4, "t": 150}}::vertex - {"id": 844424930131969, "label": "v", "properties": {"i": 4, "t": 150}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": 4, "t": 150}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 4, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex - {"id": 1407374883553281, "label": "other_v", "properties": {"i": 4, "k": 10}}::vertex - {"id": 1407374883553282, "label": "other_v", "properties": {"i": 4, "k": 10}}::vertex - {"id": 1407374883553283, "label": "other_v", "properties": {"i": 4, "k": 10}}::vertex - {"id": 1407374883553284, "label": "other_v", "properties": {"i": 4, "k": 10}}::vertex + a +--------------------------------------------------------------------------------------------------------------------- + {"id": 281474976710659, "label": [], "properties": {"i": 4, "y": 2}}::vertex + {"id": 281474976710658, "label": [], "properties": {"i": 4, "t": 150, "y": 1}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": 4, "t": 150}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {"i": 4, "t": 150}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": 4, "t": 150}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 4, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex + {"id": 1407374883553281, "label": ["other_v"], "properties": {"i": 4, "k": 10}}::vertex + {"id": 1407374883553282, "label": ["other_v"], "properties": {"i": 4, "k": 10}}::vertex + {"id": 1407374883553283, "label": ["other_v"], "properties": {"i": 4, "k": 10}}::vertex + {"id": 1407374883553284, "label": ["other_v"], "properties": {"i": 4, "k": 10}}::vertex (10 rows) EXECUTE p_2('{"var_name": 6}'); - a -------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"i": 6, "y": 2}}::vertex - {"id": 281474976710658, "label": "", "properties": {"i": 6, "t": 150, "y": 1}}::vertex - {"id": 281474976710657, "label": "", "properties": {"i": 6, "t": 150}}::vertex - {"id": 844424930131969, "label": "v", "properties": {"i": 6, "t": 150}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": 6, "t": 150}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 6, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex - {"id": 1407374883553281, "label": "other_v", "properties": {"i": 6, "k": 10}}::vertex - {"id": 1407374883553282, "label": "other_v", "properties": {"i": 6, "k": 10}}::vertex - {"id": 1407374883553283, "label": "other_v", "properties": {"i": 6, "k": 10}}::vertex - {"id": 1407374883553284, "label": "other_v", "properties": {"i": 6, "k": 10}}::vertex + a +--------------------------------------------------------------------------------------------------------------------- + {"id": 281474976710659, "label": [], "properties": {"i": 6, "y": 2}}::vertex + {"id": 281474976710658, "label": [], "properties": {"i": 6, "t": 150, "y": 1}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": 6, "t": 150}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {"i": 6, "t": 150}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": 6, "t": 150}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 6, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex + {"id": 1407374883553281, "label": ["other_v"], "properties": {"i": 6, "k": 10}}::vertex + {"id": 1407374883553282, "label": ["other_v"], "properties": {"i": 6, "k": 10}}::vertex + {"id": 1407374883553283, "label": ["other_v"], "properties": {"i": 6, "k": 10}}::vertex + {"id": 1407374883553284, "label": ["other_v"], "properties": {"i": 6, "k": 10}}::vertex (10 rows) CREATE FUNCTION set_test() @@ -391,57 +391,57 @@ BEGIN END $BODY$; SELECT set_test(); - set_test -------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"i": 7, "y": 2}}::vertex - {"id": 281474976710658, "label": "", "properties": {"i": 7, "t": 150, "y": 1}}::vertex - {"id": 281474976710657, "label": "", "properties": {"i": 7, "t": 150}}::vertex - {"id": 844424930131969, "label": "v", "properties": {"i": 7, "t": 150}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": 7, "t": 150}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 7, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex - {"id": 1407374883553281, "label": "other_v", "properties": {"i": 7, "k": 10}}::vertex - {"id": 1407374883553282, "label": "other_v", "properties": {"i": 7, "k": 10}}::vertex - {"id": 1407374883553283, "label": "other_v", "properties": {"i": 7, "k": 10}}::vertex - {"id": 1407374883553284, "label": "other_v", "properties": {"i": 7, "k": 10}}::vertex + set_test +--------------------------------------------------------------------------------------------------------------------- + {"id": 281474976710659, "label": [], "properties": {"i": 7, "y": 2}}::vertex + {"id": 281474976710658, "label": [], "properties": {"i": 7, "t": 150, "y": 1}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": 7, "t": 150}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {"i": 7, "t": 150}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": 7, "t": 150}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 7, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex + {"id": 1407374883553281, "label": ["other_v"], "properties": {"i": 7, "k": 10}}::vertex + {"id": 1407374883553282, "label": ["other_v"], "properties": {"i": 7, "k": 10}}::vertex + {"id": 1407374883553283, "label": ["other_v"], "properties": {"i": 7, "k": 10}}::vertex + {"id": 1407374883553284, "label": ["other_v"], "properties": {"i": 7, "k": 10}}::vertex (10 rows) SELECT set_test(); - set_test -------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"i": 7, "y": 2}}::vertex - {"id": 281474976710658, "label": "", "properties": {"i": 7, "t": 150, "y": 1}}::vertex - {"id": 281474976710657, "label": "", "properties": {"i": 7, "t": 150}}::vertex - {"id": 844424930131969, "label": "v", "properties": {"i": 7, "t": 150}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": 7, "t": 150}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 7, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex - {"id": 1407374883553281, "label": "other_v", "properties": {"i": 7, "k": 10}}::vertex - {"id": 1407374883553282, "label": "other_v", "properties": {"i": 7, "k": 10}}::vertex - {"id": 1407374883553283, "label": "other_v", "properties": {"i": 7, "k": 10}}::vertex - {"id": 1407374883553284, "label": "other_v", "properties": {"i": 7, "k": 10}}::vertex + set_test +--------------------------------------------------------------------------------------------------------------------- + {"id": 281474976710659, "label": [], "properties": {"i": 7, "y": 2}}::vertex + {"id": 281474976710658, "label": [], "properties": {"i": 7, "t": 150, "y": 1}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": 7, "t": 150}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {"i": 7, "t": 150}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": 7, "t": 150}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 7, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex + {"id": 1407374883553281, "label": ["other_v"], "properties": {"i": 7, "k": 10}}::vertex + {"id": 1407374883553282, "label": ["other_v"], "properties": {"i": 7, "k": 10}}::vertex + {"id": 1407374883553283, "label": ["other_v"], "properties": {"i": 7, "k": 10}}::vertex + {"id": 1407374883553284, "label": ["other_v"], "properties": {"i": 7, "k": 10}}::vertex (10 rows) -- -- Updating multiple fields -- SELECT * FROM cypher('cypher_set', $$MATCH (n) SET n.i = 3, n.j = 5 RETURN n $$) AS (a agtype); - a -------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"i": 3, "j": 5, "y": 2}}::vertex - {"id": 281474976710658, "label": "", "properties": {"i": 3, "j": 5, "t": 150, "y": 1}}::vertex - {"id": 281474976710657, "label": "", "properties": {"i": 3, "j": 5, "t": 150}}::vertex - {"id": 844424930131969, "label": "v", "properties": {"i": 3, "j": 5, "t": 150}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": 3, "j": 5, "t": 150}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 3, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex - {"id": 1407374883553281, "label": "other_v", "properties": {"i": 3, "j": 5, "k": 10}}::vertex - {"id": 1407374883553282, "label": "other_v", "properties": {"i": 3, "j": 5, "k": 10}}::vertex - {"id": 1407374883553283, "label": "other_v", "properties": {"i": 3, "j": 5, "k": 10}}::vertex - {"id": 1407374883553284, "label": "other_v", "properties": {"i": 3, "j": 5, "k": 10}}::vertex + a +--------------------------------------------------------------------------------------------------------------------- + {"id": 281474976710659, "label": [], "properties": {"i": 3, "j": 5, "y": 2}}::vertex + {"id": 281474976710658, "label": [], "properties": {"i": 3, "j": 5, "t": 150, "y": 1}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": 3, "j": 5, "t": 150}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {"i": 3, "j": 5, "t": 150}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": 3, "j": 5, "t": 150}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 3, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex + {"id": 1407374883553281, "label": ["other_v"], "properties": {"i": 3, "j": 5, "k": 10}}::vertex + {"id": 1407374883553282, "label": ["other_v"], "properties": {"i": 3, "j": 5, "k": 10}}::vertex + {"id": 1407374883553283, "label": ["other_v"], "properties": {"i": 3, "j": 5, "k": 10}}::vertex + {"id": 1407374883553284, "label": ["other_v"], "properties": {"i": 3, "j": 5, "k": 10}}::vertex (10 rows) SELECT * FROM cypher('cypher_set', $$MATCH (n)-[m]->(n) SET m.y = n.y RETURN n, m$$) AS (a agtype, b agtype); - a | b --------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------- - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": 3, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex | {"id": 1125899906842629, "label": "e", "end_id": 844424930131970, "start_id": 844424930131970, "properties": {"j": 34, "y": 99}}::edge + a | b +---------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": 3, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex | {"id": 1125899906842629, "label": "e", "end_id": 844424930131970, "start_id": 844424930131970, "properties": {"j": 34, "y": 99}}::edge (1 row) --Errors @@ -473,278 +473,278 @@ SELECT * FROM cypher('cypher_set', $$CREATE (u:begin)-[:edge]->(v:end) $$) AS (r (0 rows) SELECT * FROM cypher('cypher_set', $$MATCH (u:vertices) return u $$) AS (result agtype); - result -------------------------------------------------------------------------- - {"id": 1688849860263937, "label": "vertices", "properties": {}}::vertex + result +--------------------------------------------------------------------------- + {"id": 1688849860263937, "label": ["vertices"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_set', $$MATCH (u:begin)-[:edge]->(v:end) return u, v $$) AS (u agtype, v agtype); - u | v -----------------------------------------------------------------------+-------------------------------------------------------------------- - {"id": 1970324836974593, "label": "begin", "properties": {}}::vertex | {"id": 2533274790395905, "label": "end", "properties": {}}::vertex + u | v +------------------------------------------------------------------------+---------------------------------------------------------------------- + {"id": 1970324836974593, "label": ["begin"], "properties": {}}::vertex | {"id": 2533274790395905, "label": ["end"], "properties": {}}::vertex (1 row) INSERT INTO tbl (SELECT * FROM cypher('cypher_set', $$MATCH (u:vertices) SET u.i = 7 return u $$) AS (result agtype)); INSERT INTO tbl (SELECT * FROM cypher('cypher_set', $$MATCH (u:vertices) SET u.i = 13 return u $$) AS (result agtype)); SELECT * FROM tbl; - result --------------------------------------------------------------------------------- - {"id": 1688849860263937, "label": "vertices", "properties": {"i": 7}}::vertex - {"id": 1688849860263937, "label": "vertices", "properties": {"i": 13}}::vertex + result +---------------------------------------------------------------------------------- + {"id": 1688849860263937, "label": ["vertices"], "properties": {"i": 7}}::vertex + {"id": 1688849860263937, "label": ["vertices"], "properties": {"i": 13}}::vertex (2 rows) SELECT * FROM cypher('cypher_set', $$MATCH (u:vertices) return u $$) AS (result agtype); - result --------------------------------------------------------------------------------- - {"id": 1688849860263937, "label": "vertices", "properties": {"i": 13}}::vertex + result +---------------------------------------------------------------------------------- + {"id": 1688849860263937, "label": ["vertices"], "properties": {"i": 13}}::vertex (1 row) BEGIN; SELECT * FROM cypher('cypher_set', $$MATCH (u:vertices) SET u.i = 1, u.j = 3, u.k = 5 return u $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------ - {"id": 1688849860263937, "label": "vertices", "properties": {"i": 1, "j": 3, "k": 5}}::vertex + result +------------------------------------------------------------------------------------------------- + {"id": 1688849860263937, "label": ["vertices"], "properties": {"i": 1, "j": 3, "k": 5}}::vertex (1 row) SELECT * FROM cypher('cypher_set', $$MATCH (u:vertices) return u $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------ - {"id": 1688849860263937, "label": "vertices", "properties": {"i": 1, "j": 3, "k": 5}}::vertex + result +------------------------------------------------------------------------------------------------- + {"id": 1688849860263937, "label": ["vertices"], "properties": {"i": 1, "j": 3, "k": 5}}::vertex (1 row) SELECT * FROM cypher('cypher_set', $$MATCH (u:vertices) SET u.i = 2, u.j = 4, u.k = 6 return u $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------ - {"id": 1688849860263937, "label": "vertices", "properties": {"i": 2, "j": 4, "k": 6}}::vertex + result +------------------------------------------------------------------------------------------------- + {"id": 1688849860263937, "label": ["vertices"], "properties": {"i": 2, "j": 4, "k": 6}}::vertex (1 row) SELECT * FROM cypher('cypher_set', $$MATCH (u:vertices) return u $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------ - {"id": 1688849860263937, "label": "vertices", "properties": {"i": 2, "j": 4, "k": 6}}::vertex + result +------------------------------------------------------------------------------------------------- + {"id": 1688849860263937, "label": ["vertices"], "properties": {"i": 2, "j": 4, "k": 6}}::vertex (1 row) SELECT * FROM cypher('cypher_set', $$MATCH (u:vertices) SET u.i = 3, u.j = 6, u.k = 9 return u $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------ - {"id": 1688849860263937, "label": "vertices", "properties": {"i": 3, "j": 6, "k": 9}}::vertex + result +------------------------------------------------------------------------------------------------- + {"id": 1688849860263937, "label": ["vertices"], "properties": {"i": 3, "j": 6, "k": 9}}::vertex (1 row) SELECT * FROM cypher('cypher_set', $$MATCH (u:vertices) return u $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------ - {"id": 1688849860263937, "label": "vertices", "properties": {"i": 3, "j": 6, "k": 9}}::vertex + result +------------------------------------------------------------------------------------------------- + {"id": 1688849860263937, "label": ["vertices"], "properties": {"i": 3, "j": 6, "k": 9}}::vertex (1 row) SELECT * FROM cypher('cypher_set', $$MATCH (u:begin)-[:edge]->(v:end) SET u.i = 1, v.i = 2, u.j = 3, v.j = 4 return u, v $$) AS (u agtype, v agtype); - u | v -------------------------------------------------------------------------------------+---------------------------------------------------------------------------------- - {"id": 1970324836974593, "label": "begin", "properties": {"i": 1, "j": 3}}::vertex | {"id": 2533274790395905, "label": "end", "properties": {"i": 2, "j": 4}}::vertex + u | v +--------------------------------------------------------------------------------------+------------------------------------------------------------------------------------ + {"id": 1970324836974593, "label": ["begin"], "properties": {"i": 1, "j": 3}}::vertex | {"id": 2533274790395905, "label": ["end"], "properties": {"i": 2, "j": 4}}::vertex (1 row) SELECT * FROM cypher('cypher_set', $$MATCH (u:begin)-[:edge]->(v:end) return u, v $$) AS (u agtype, v agtype); - u | v -------------------------------------------------------------------------------------+---------------------------------------------------------------------------------- - {"id": 1970324836974593, "label": "begin", "properties": {"i": 1, "j": 3}}::vertex | {"id": 2533274790395905, "label": "end", "properties": {"i": 2, "j": 4}}::vertex + u | v +--------------------------------------------------------------------------------------+------------------------------------------------------------------------------------ + {"id": 1970324836974593, "label": ["begin"], "properties": {"i": 1, "j": 3}}::vertex | {"id": 2533274790395905, "label": ["end"], "properties": {"i": 2, "j": 4}}::vertex (1 row) SELECT * FROM cypher('cypher_set', $$MATCH (u:begin)-[:edge]->(v:end) SET u.i = 2, v.i = 1, u.j = 4, v.j = 3 return u, v $$) AS (u agtype, v agtype); - u | v -------------------------------------------------------------------------------------+---------------------------------------------------------------------------------- - {"id": 1970324836974593, "label": "begin", "properties": {"i": 2, "j": 4}}::vertex | {"id": 2533274790395905, "label": "end", "properties": {"i": 1, "j": 3}}::vertex + u | v +--------------------------------------------------------------------------------------+------------------------------------------------------------------------------------ + {"id": 1970324836974593, "label": ["begin"], "properties": {"i": 2, "j": 4}}::vertex | {"id": 2533274790395905, "label": ["end"], "properties": {"i": 1, "j": 3}}::vertex (1 row) SELECT * FROM cypher('cypher_set', $$MATCH (u:begin)-[:edge]->(v:end) return u, v $$) AS (u agtype, v agtype); - u | v -------------------------------------------------------------------------------------+---------------------------------------------------------------------------------- - {"id": 1970324836974593, "label": "begin", "properties": {"i": 2, "j": 4}}::vertex | {"id": 2533274790395905, "label": "end", "properties": {"i": 1, "j": 3}}::vertex + u | v +--------------------------------------------------------------------------------------+------------------------------------------------------------------------------------ + {"id": 1970324836974593, "label": ["begin"], "properties": {"i": 2, "j": 4}}::vertex | {"id": 2533274790395905, "label": ["end"], "properties": {"i": 1, "j": 3}}::vertex (1 row) END; SELECT * FROM cypher('cypher_set', $$MATCH (u:vertices) return u $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------ - {"id": 1688849860263937, "label": "vertices", "properties": {"i": 3, "j": 6, "k": 9}}::vertex + result +------------------------------------------------------------------------------------------------- + {"id": 1688849860263937, "label": ["vertices"], "properties": {"i": 3, "j": 6, "k": 9}}::vertex (1 row) SELECT * FROM cypher('cypher_set', $$MATCH (u:begin)-[:edge]->(v:end) return u, v $$) AS (u agtype, v agtype); - u | v -------------------------------------------------------------------------------------+---------------------------------------------------------------------------------- - {"id": 1970324836974593, "label": "begin", "properties": {"i": 2, "j": 4}}::vertex | {"id": 2533274790395905, "label": "end", "properties": {"i": 1, "j": 3}}::vertex + u | v +--------------------------------------------------------------------------------------+------------------------------------------------------------------------------------ + {"id": 1970324836974593, "label": ["begin"], "properties": {"i": 2, "j": 4}}::vertex | {"id": 2533274790395905, "label": ["end"], "properties": {"i": 1, "j": 3}}::vertex (1 row) -- test lists SELECT * FROM cypher('cypher_set', $$MATCH (n) SET n.i = [3, 'test', [1, 2, 3], {id: 1}, 1.0, 1.0::numeric] RETURN n$$) AS (a agtype); - a --------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "y": 2}}::vertex - {"id": 281474976710658, "label": "", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "t": 150, "y": 1}}::vertex - {"id": 281474976710657, "label": "", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "t": 150}}::vertex - {"id": 844424930131969, "label": "v", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "t": 150}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "t": 150}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "t": 150, "y": 99, "z": 99}}::vertex - {"id": 1407374883553281, "label": "other_v", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "k": 10}}::vertex - {"id": 1407374883553282, "label": "other_v", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "k": 10}}::vertex - {"id": 1407374883553283, "label": "other_v", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "k": 10}}::vertex - {"id": 1407374883553284, "label": "other_v", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "k": 10}}::vertex - {"id": 1688849860263937, "label": "vertices", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 6, "k": 9}}::vertex - {"id": 1970324836974593, "label": "begin", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 4}}::vertex - {"id": 2533274790395905, "label": "end", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 3}}::vertex + a +---------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 281474976710659, "label": [], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "y": 2}}::vertex + {"id": 281474976710658, "label": [], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "t": 150, "y": 1}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "t": 150}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "t": 150}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "t": 150}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "t": 150, "y": 99, "z": 99}}::vertex + {"id": 1407374883553281, "label": ["other_v"], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "k": 10}}::vertex + {"id": 1407374883553282, "label": ["other_v"], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "k": 10}}::vertex + {"id": 1407374883553283, "label": ["other_v"], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "k": 10}}::vertex + {"id": 1407374883553284, "label": ["other_v"], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "k": 10}}::vertex + {"id": 1688849860263937, "label": ["vertices"], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 6, "k": 9}}::vertex + {"id": 1970324836974593, "label": ["begin"], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 4}}::vertex + {"id": 2533274790395905, "label": ["end"], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 3}}::vertex (13 rows) SELECT * FROM cypher('cypher_set', $$MATCH (n) RETURN n$$) AS (a agtype); - a --------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "y": 2}}::vertex - {"id": 281474976710658, "label": "", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "t": 150, "y": 1}}::vertex - {"id": 281474976710657, "label": "", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "t": 150}}::vertex - {"id": 844424930131969, "label": "v", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "t": 150}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "t": 150}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "t": 150, "y": 99, "z": 99}}::vertex - {"id": 1407374883553281, "label": "other_v", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "k": 10}}::vertex - {"id": 1407374883553282, "label": "other_v", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "k": 10}}::vertex - {"id": 1407374883553283, "label": "other_v", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "k": 10}}::vertex - {"id": 1407374883553284, "label": "other_v", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "k": 10}}::vertex - {"id": 1688849860263937, "label": "vertices", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 6, "k": 9}}::vertex - {"id": 1970324836974593, "label": "begin", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 4}}::vertex - {"id": 2533274790395905, "label": "end", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 3}}::vertex + a +---------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 281474976710659, "label": [], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "y": 2}}::vertex + {"id": 281474976710658, "label": [], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "t": 150, "y": 1}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "t": 150}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "t": 150}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "t": 150}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "t": 150, "y": 99, "z": 99}}::vertex + {"id": 1407374883553281, "label": ["other_v"], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "k": 10}}::vertex + {"id": 1407374883553282, "label": ["other_v"], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "k": 10}}::vertex + {"id": 1407374883553283, "label": ["other_v"], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "k": 10}}::vertex + {"id": 1407374883553284, "label": ["other_v"], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 5, "k": 10}}::vertex + {"id": 1688849860263937, "label": ["vertices"], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 6, "k": 9}}::vertex + {"id": 1970324836974593, "label": ["begin"], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 4}}::vertex + {"id": 2533274790395905, "label": ["end"], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 3}}::vertex (13 rows) -- test that lists get updated in paths SELECT * FROM cypher('cypher_set', $$MATCH p=(u:begin)-[:edge]->(v:end) SET u.i = [1, 2, 3] return u, p $$) AS (u agtype, p agtype); - u | p ---------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 1970324836974593, "label": "begin", "properties": {"i": [1, 2, 3], "j": 4}}::vertex | [{"id": 1970324836974593, "label": "begin", "properties": {"i": [1, 2, 3], "j": 4}}::vertex, {"id": 2251799813685249, "label": "edge", "end_id": 2533274790395905, "start_id": 1970324836974593, "properties": {}}::edge, {"id": 2533274790395905, "label": "end", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 3}}::vertex]::path + u | p +----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + {"id": 1970324836974593, "label": ["begin"], "properties": {"i": [1, 2, 3], "j": 4}}::vertex | [{"id": 1970324836974593, "label": ["begin"], "properties": {"i": [1, 2, 3], "j": 4}}::vertex, {"id": 2251799813685249, "label": "edge", "end_id": 2533274790395905, "start_id": 1970324836974593, "properties": {}}::edge, {"id": 2533274790395905, "label": ["end"], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 3}}::vertex]::path (1 row) SELECT * FROM cypher('cypher_set', $$MATCH p=(u:begin)-[:edge]->(v:end) return u, p $$) AS (u agtype, p agtype); - u | p ---------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 1970324836974593, "label": "begin", "properties": {"i": [1, 2, 3], "j": 4}}::vertex | [{"id": 1970324836974593, "label": "begin", "properties": {"i": [1, 2, 3], "j": 4}}::vertex, {"id": 2251799813685249, "label": "edge", "end_id": 2533274790395905, "start_id": 1970324836974593, "properties": {}}::edge, {"id": 2533274790395905, "label": "end", "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 3}}::vertex]::path + u | p +----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + {"id": 1970324836974593, "label": ["begin"], "properties": {"i": [1, 2, 3], "j": 4}}::vertex | [{"id": 1970324836974593, "label": ["begin"], "properties": {"i": [1, 2, 3], "j": 4}}::vertex, {"id": 2251799813685249, "label": "edge", "end_id": 2533274790395905, "start_id": 1970324836974593, "properties": {}}::edge, {"id": 2533274790395905, "label": ["end"], "properties": {"i": [3, "test", [1, 2, 3], {"id": 1}, 1.0, 1::numeric], "j": 3}}::vertex]::path (1 row) -- test empty lists SELECT * FROM cypher('cypher_set', $$MATCH (n) SET n.i = [] RETURN n$$) AS (a agtype); - a --------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"i": [], "j": 5, "y": 2}}::vertex - {"id": 281474976710658, "label": "", "properties": {"i": [], "j": 5, "t": 150, "y": 1}}::vertex - {"id": 281474976710657, "label": "", "properties": {"i": [], "j": 5, "t": 150}}::vertex - {"id": 844424930131969, "label": "v", "properties": {"i": [], "j": 5, "t": 150}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": [], "j": 5, "t": 150}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": [], "j": 5, "t": 150, "y": 99, "z": 99}}::vertex - {"id": 1407374883553281, "label": "other_v", "properties": {"i": [], "j": 5, "k": 10}}::vertex - {"id": 1407374883553282, "label": "other_v", "properties": {"i": [], "j": 5, "k": 10}}::vertex - {"id": 1407374883553283, "label": "other_v", "properties": {"i": [], "j": 5, "k": 10}}::vertex - {"id": 1407374883553284, "label": "other_v", "properties": {"i": [], "j": 5, "k": 10}}::vertex - {"id": 1688849860263937, "label": "vertices", "properties": {"i": [], "j": 6, "k": 9}}::vertex - {"id": 1970324836974593, "label": "begin", "properties": {"i": [], "j": 4}}::vertex - {"id": 2533274790395905, "label": "end", "properties": {"i": [], "j": 3}}::vertex + a +---------------------------------------------------------------------------------------------------------------------- + {"id": 281474976710659, "label": [], "properties": {"i": [], "j": 5, "y": 2}}::vertex + {"id": 281474976710658, "label": [], "properties": {"i": [], "j": 5, "t": 150, "y": 1}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": [], "j": 5, "t": 150}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {"i": [], "j": 5, "t": 150}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": [], "j": 5, "t": 150}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": [], "j": 5, "t": 150, "y": 99, "z": 99}}::vertex + {"id": 1407374883553281, "label": ["other_v"], "properties": {"i": [], "j": 5, "k": 10}}::vertex + {"id": 1407374883553282, "label": ["other_v"], "properties": {"i": [], "j": 5, "k": 10}}::vertex + {"id": 1407374883553283, "label": ["other_v"], "properties": {"i": [], "j": 5, "k": 10}}::vertex + {"id": 1407374883553284, "label": ["other_v"], "properties": {"i": [], "j": 5, "k": 10}}::vertex + {"id": 1688849860263937, "label": ["vertices"], "properties": {"i": [], "j": 6, "k": 9}}::vertex + {"id": 1970324836974593, "label": ["begin"], "properties": {"i": [], "j": 4}}::vertex + {"id": 2533274790395905, "label": ["end"], "properties": {"i": [], "j": 3}}::vertex (13 rows) SELECT * FROM cypher('cypher_set', $$MATCH (n) RETURN n$$) AS (a agtype); - a --------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"i": [], "j": 5, "y": 2}}::vertex - {"id": 281474976710658, "label": "", "properties": {"i": [], "j": 5, "t": 150, "y": 1}}::vertex - {"id": 281474976710657, "label": "", "properties": {"i": [], "j": 5, "t": 150}}::vertex - {"id": 844424930131969, "label": "v", "properties": {"i": [], "j": 5, "t": 150}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": [], "j": 5, "t": 150}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": [], "j": 5, "t": 150, "y": 99, "z": 99}}::vertex - {"id": 1407374883553281, "label": "other_v", "properties": {"i": [], "j": 5, "k": 10}}::vertex - {"id": 1407374883553282, "label": "other_v", "properties": {"i": [], "j": 5, "k": 10}}::vertex - {"id": 1407374883553283, "label": "other_v", "properties": {"i": [], "j": 5, "k": 10}}::vertex - {"id": 1407374883553284, "label": "other_v", "properties": {"i": [], "j": 5, "k": 10}}::vertex - {"id": 1688849860263937, "label": "vertices", "properties": {"i": [], "j": 6, "k": 9}}::vertex - {"id": 1970324836974593, "label": "begin", "properties": {"i": [], "j": 4}}::vertex - {"id": 2533274790395905, "label": "end", "properties": {"i": [], "j": 3}}::vertex + a +---------------------------------------------------------------------------------------------------------------------- + {"id": 281474976710659, "label": [], "properties": {"i": [], "j": 5, "y": 2}}::vertex + {"id": 281474976710658, "label": [], "properties": {"i": [], "j": 5, "t": 150, "y": 1}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": [], "j": 5, "t": 150}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {"i": [], "j": 5, "t": 150}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": [], "j": 5, "t": 150}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": [], "j": 5, "t": 150, "y": 99, "z": 99}}::vertex + {"id": 1407374883553281, "label": ["other_v"], "properties": {"i": [], "j": 5, "k": 10}}::vertex + {"id": 1407374883553282, "label": ["other_v"], "properties": {"i": [], "j": 5, "k": 10}}::vertex + {"id": 1407374883553283, "label": ["other_v"], "properties": {"i": [], "j": 5, "k": 10}}::vertex + {"id": 1407374883553284, "label": ["other_v"], "properties": {"i": [], "j": 5, "k": 10}}::vertex + {"id": 1688849860263937, "label": ["vertices"], "properties": {"i": [], "j": 6, "k": 9}}::vertex + {"id": 1970324836974593, "label": ["begin"], "properties": {"i": [], "j": 4}}::vertex + {"id": 2533274790395905, "label": ["end"], "properties": {"i": [], "j": 3}}::vertex (13 rows) -- test maps SELECT * FROM cypher('cypher_set', $$MATCH (n) SET n.i = {prop1: 3, prop2:'test', prop3: [1, 2, 3], prop4: {id: 1}, prop5: 1.0, prop6:1.0::numeric} RETURN n$$) AS (a agtype); - a --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "y": 2}}::vertex - {"id": 281474976710658, "label": "", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "t": 150, "y": 1}}::vertex - {"id": 281474976710657, "label": "", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "t": 150}}::vertex - {"id": 844424930131969, "label": "v", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "t": 150}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "t": 150}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex - {"id": 1407374883553281, "label": "other_v", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "k": 10}}::vertex - {"id": 1407374883553282, "label": "other_v", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "k": 10}}::vertex - {"id": 1407374883553283, "label": "other_v", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "k": 10}}::vertex - {"id": 1407374883553284, "label": "other_v", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "k": 10}}::vertex - {"id": 1688849860263937, "label": "vertices", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 6, "k": 9}}::vertex - {"id": 1970324836974593, "label": "begin", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 4}}::vertex - {"id": 2533274790395905, "label": "end", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 3}}::vertex + a +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 281474976710659, "label": [], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "y": 2}}::vertex + {"id": 281474976710658, "label": [], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "t": 150, "y": 1}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "t": 150}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "t": 150}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "t": 150}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex + {"id": 1407374883553281, "label": ["other_v"], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "k": 10}}::vertex + {"id": 1407374883553282, "label": ["other_v"], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "k": 10}}::vertex + {"id": 1407374883553283, "label": ["other_v"], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "k": 10}}::vertex + {"id": 1407374883553284, "label": ["other_v"], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "k": 10}}::vertex + {"id": 1688849860263937, "label": ["vertices"], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 6, "k": 9}}::vertex + {"id": 1970324836974593, "label": ["begin"], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 4}}::vertex + {"id": 2533274790395905, "label": ["end"], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 3}}::vertex (13 rows) SELECT * FROM cypher('cypher_set', $$MATCH (n) RETURN n$$) AS (a agtype); - a --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "y": 2}}::vertex - {"id": 281474976710658, "label": "", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "t": 150, "y": 1}}::vertex - {"id": 281474976710657, "label": "", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "t": 150}}::vertex - {"id": 844424930131969, "label": "v", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "t": 150}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "t": 150}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex - {"id": 1407374883553281, "label": "other_v", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "k": 10}}::vertex - {"id": 1407374883553282, "label": "other_v", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "k": 10}}::vertex - {"id": 1407374883553283, "label": "other_v", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "k": 10}}::vertex - {"id": 1407374883553284, "label": "other_v", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "k": 10}}::vertex - {"id": 1688849860263937, "label": "vertices", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 6, "k": 9}}::vertex - {"id": 1970324836974593, "label": "begin", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 4}}::vertex - {"id": 2533274790395905, "label": "end", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 3}}::vertex + a +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 281474976710659, "label": [], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "y": 2}}::vertex + {"id": 281474976710658, "label": [], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "t": 150, "y": 1}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "t": 150}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "t": 150}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "t": 150}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex + {"id": 1407374883553281, "label": ["other_v"], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "k": 10}}::vertex + {"id": 1407374883553282, "label": ["other_v"], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "k": 10}}::vertex + {"id": 1407374883553283, "label": ["other_v"], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "k": 10}}::vertex + {"id": 1407374883553284, "label": ["other_v"], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 5, "k": 10}}::vertex + {"id": 1688849860263937, "label": ["vertices"], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 6, "k": 9}}::vertex + {"id": 1970324836974593, "label": ["begin"], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 4}}::vertex + {"id": 2533274790395905, "label": ["end"], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 3}}::vertex (13 rows) -- test maps in paths SELECT * FROM cypher('cypher_set', $$MATCH p=(u:begin)-[:edge]->(v:end) SET u.i = {prop1: 1, prop2: 2, prop3: 3} return u, p $$) AS (u agtype, p agtype); - u | p ------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 1970324836974593, "label": "begin", "properties": {"i": {"prop1": 1, "prop2": 2, "prop3": 3}, "j": 4}}::vertex | [{"id": 1970324836974593, "label": "begin", "properties": {"i": {"prop1": 1, "prop2": 2, "prop3": 3}, "j": 4}}::vertex, {"id": 2251799813685249, "label": "edge", "end_id": 2533274790395905, "start_id": 1970324836974593, "properties": {}}::edge, {"id": 2533274790395905, "label": "end", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 3}}::vertex]::path + u | p +-------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 1970324836974593, "label": ["begin"], "properties": {"i": {"prop1": 1, "prop2": 2, "prop3": 3}, "j": 4}}::vertex | [{"id": 1970324836974593, "label": ["begin"], "properties": {"i": {"prop1": 1, "prop2": 2, "prop3": 3}, "j": 4}}::vertex, {"id": 2251799813685249, "label": "edge", "end_id": 2533274790395905, "start_id": 1970324836974593, "properties": {}}::edge, {"id": 2533274790395905, "label": ["end"], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 3}}::vertex]::path (1 row) SELECT * FROM cypher('cypher_set', $$MATCH p=(u:begin)-[:edge]->(v:end) return u, p $$) AS (u agtype, p agtype); - u | p ------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 1970324836974593, "label": "begin", "properties": {"i": {"prop1": 1, "prop2": 2, "prop3": 3}, "j": 4}}::vertex | [{"id": 1970324836974593, "label": "begin", "properties": {"i": {"prop1": 1, "prop2": 2, "prop3": 3}, "j": 4}}::vertex, {"id": 2251799813685249, "label": "edge", "end_id": 2533274790395905, "start_id": 1970324836974593, "properties": {}}::edge, {"id": 2533274790395905, "label": "end", "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 3}}::vertex]::path + u | p +-------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 1970324836974593, "label": ["begin"], "properties": {"i": {"prop1": 1, "prop2": 2, "prop3": 3}, "j": 4}}::vertex | [{"id": 1970324836974593, "label": ["begin"], "properties": {"i": {"prop1": 1, "prop2": 2, "prop3": 3}, "j": 4}}::vertex, {"id": 2251799813685249, "label": "edge", "end_id": 2533274790395905, "start_id": 1970324836974593, "properties": {}}::edge, {"id": 2533274790395905, "label": ["end"], "properties": {"i": {"prop1": 3, "prop2": "test", "prop3": [1, 2, 3], "prop4": {"id": 1}, "prop5": 1.0, "prop6": 1::numeric}, "j": 3}}::vertex]::path (1 row) -- test empty maps SELECT * FROM cypher('cypher_set', $$MATCH (n) SET n.i = {} RETURN n$$) AS (a agtype); - a --------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"i": {}, "j": 5, "y": 2}}::vertex - {"id": 281474976710658, "label": "", "properties": {"i": {}, "j": 5, "t": 150, "y": 1}}::vertex - {"id": 281474976710657, "label": "", "properties": {"i": {}, "j": 5, "t": 150}}::vertex - {"id": 844424930131969, "label": "v", "properties": {"i": {}, "j": 5, "t": 150}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": {}, "j": 5, "t": 150}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": {}, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex - {"id": 1407374883553281, "label": "other_v", "properties": {"i": {}, "j": 5, "k": 10}}::vertex - {"id": 1407374883553282, "label": "other_v", "properties": {"i": {}, "j": 5, "k": 10}}::vertex - {"id": 1407374883553283, "label": "other_v", "properties": {"i": {}, "j": 5, "k": 10}}::vertex - {"id": 1407374883553284, "label": "other_v", "properties": {"i": {}, "j": 5, "k": 10}}::vertex - {"id": 1688849860263937, "label": "vertices", "properties": {"i": {}, "j": 6, "k": 9}}::vertex - {"id": 1970324836974593, "label": "begin", "properties": {"i": {}, "j": 4}}::vertex - {"id": 2533274790395905, "label": "end", "properties": {"i": {}, "j": 3}}::vertex + a +---------------------------------------------------------------------------------------------------------------------- + {"id": 281474976710659, "label": [], "properties": {"i": {}, "j": 5, "y": 2}}::vertex + {"id": 281474976710658, "label": [], "properties": {"i": {}, "j": 5, "t": 150, "y": 1}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": {}, "j": 5, "t": 150}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {"i": {}, "j": 5, "t": 150}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": {}, "j": 5, "t": 150}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": {}, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex + {"id": 1407374883553281, "label": ["other_v"], "properties": {"i": {}, "j": 5, "k": 10}}::vertex + {"id": 1407374883553282, "label": ["other_v"], "properties": {"i": {}, "j": 5, "k": 10}}::vertex + {"id": 1407374883553283, "label": ["other_v"], "properties": {"i": {}, "j": 5, "k": 10}}::vertex + {"id": 1407374883553284, "label": ["other_v"], "properties": {"i": {}, "j": 5, "k": 10}}::vertex + {"id": 1688849860263937, "label": ["vertices"], "properties": {"i": {}, "j": 6, "k": 9}}::vertex + {"id": 1970324836974593, "label": ["begin"], "properties": {"i": {}, "j": 4}}::vertex + {"id": 2533274790395905, "label": ["end"], "properties": {"i": {}, "j": 3}}::vertex (13 rows) SELECT * FROM cypher('cypher_set', $$MATCH (n) RETURN n$$) AS (a agtype); - a --------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"i": {}, "j": 5, "y": 2}}::vertex - {"id": 281474976710658, "label": "", "properties": {"i": {}, "j": 5, "t": 150, "y": 1}}::vertex - {"id": 281474976710657, "label": "", "properties": {"i": {}, "j": 5, "t": 150}}::vertex - {"id": 844424930131969, "label": "v", "properties": {"i": {}, "j": 5, "t": 150}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": {}, "j": 5, "t": 150}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"a": 0, "i": {}, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex - {"id": 1407374883553281, "label": "other_v", "properties": {"i": {}, "j": 5, "k": 10}}::vertex - {"id": 1407374883553282, "label": "other_v", "properties": {"i": {}, "j": 5, "k": 10}}::vertex - {"id": 1407374883553283, "label": "other_v", "properties": {"i": {}, "j": 5, "k": 10}}::vertex - {"id": 1407374883553284, "label": "other_v", "properties": {"i": {}, "j": 5, "k": 10}}::vertex - {"id": 1688849860263937, "label": "vertices", "properties": {"i": {}, "j": 6, "k": 9}}::vertex - {"id": 1970324836974593, "label": "begin", "properties": {"i": {}, "j": 4}}::vertex - {"id": 2533274790395905, "label": "end", "properties": {"i": {}, "j": 3}}::vertex + a +---------------------------------------------------------------------------------------------------------------------- + {"id": 281474976710659, "label": [], "properties": {"i": {}, "j": 5, "y": 2}}::vertex + {"id": 281474976710658, "label": [], "properties": {"i": {}, "j": 5, "t": 150, "y": 1}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": {}, "j": 5, "t": 150}}::vertex + {"id": 844424930131969, "label": ["v"], "properties": {"i": {}, "j": 5, "t": 150}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": {}, "j": 5, "t": 150}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"a": 0, "i": {}, "j": 5, "t": 150, "y": 99, "z": 99}}::vertex + {"id": 1407374883553281, "label": ["other_v"], "properties": {"i": {}, "j": 5, "k": 10}}::vertex + {"id": 1407374883553282, "label": ["other_v"], "properties": {"i": {}, "j": 5, "k": 10}}::vertex + {"id": 1407374883553283, "label": ["other_v"], "properties": {"i": {}, "j": 5, "k": 10}}::vertex + {"id": 1407374883553284, "label": ["other_v"], "properties": {"i": {}, "j": 5, "k": 10}}::vertex + {"id": 1688849860263937, "label": ["vertices"], "properties": {"i": {}, "j": 6, "k": 9}}::vertex + {"id": 1970324836974593, "label": ["begin"], "properties": {"i": {}, "j": 4}}::vertex + {"id": 2533274790395905, "label": ["end"], "properties": {"i": {}, "j": 3}}::vertex (13 rows) -- @@ -798,9 +798,9 @@ SELECT * FROM cypher('cypher_set_1', $$ SET at = properties(pn) RETURN at, pn $$) AS (at agtype, pn agtype); - at | pn -----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "Andy", "properties": {"age": 34, "name": "Peter"}}::vertex | {"id": 1125899906842625, "label": "Peter", "properties": {"age": 34, "name": "Peter"}}::vertex + at | pn +------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["Andy"], "properties": {"age": 34, "name": "Peter"}}::vertex | {"id": 1125899906842625, "label": ["Peter"], "properties": {"age": 34, "name": "Peter"}}::vertex (1 row) SELECT * FROM cypher('cypher_set_1', $$ @@ -808,9 +808,9 @@ SELECT * FROM cypher('cypher_set_1', $$ SET at = pn RETURN at, pn $$) AS (at agtype, pn agtype); - at | pn --------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------ - {"id": 1407374883553281, "label": "Kevin", "properties": {"city": "Toronto", "name": "Matt"}}::vertex | {"id": 1688849860263937, "label": "Matt", "properties": {"city": "Toronto", "name": "Matt"}}::vertex + at | pn +---------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------- + {"id": 1407374883553281, "label": ["Kevin"], "properties": {"city": "Toronto", "name": "Matt"}}::vertex | {"id": 1688849860263937, "label": ["Matt"], "properties": {"city": "Toronto", "name": "Matt"}}::vertex (1 row) -- test replacing all properties using a map and = @@ -819,10 +819,10 @@ SELECT * FROM cypher('cypher_set_1', $$ SET m = {name: 'Peter Smith', position: 'Entrepreneur', city:NULL} RETURN m $$) AS (m agtype); - m ------------------------------------------------------------------------------------------------------------------------ - {"id": 1407374883553281, "label": "Kevin", "properties": {"name": "Peter Smith", "position": "Entrepreneur"}}::vertex - {"id": 1688849860263937, "label": "Matt", "properties": {"name": "Peter Smith", "position": "Entrepreneur"}}::vertex + m +------------------------------------------------------------------------------------------------------------------------- + {"id": 1407374883553281, "label": ["Kevin"], "properties": {"name": "Peter Smith", "position": "Entrepreneur"}}::vertex + {"id": 1688849860263937, "label": ["Matt"], "properties": {"name": "Peter Smith", "position": "Entrepreneur"}}::vertex (2 rows) -- test removing all properties using an empty map and = @@ -831,9 +831,9 @@ SELECT * FROM cypher('cypher_set_1', $$ SET p = {} RETURN p $$) AS (p agtype); - p ---------------------------------------------------------------------- - {"id": 1970324836974593, "label": "Juan", "properties": {}}::vertex + p +----------------------------------------------------------------------- + {"id": 1970324836974593, "label": ["Juan"], "properties": {}}::vertex (1 row) -- test assigning non-map to an entity @@ -858,9 +858,9 @@ SELECT * FROM cypher('cypher_set_1', $$ SET p += {name:'Rob', role:NULL, age:47} RETURN p $$) AS (p agtype); - p ------------------------------------------------------------------------------------------------------------------ - {"id": 2251799813685249, "label": "Robert", "properties": {"age": 47, "city": "London", "name": "Rob"}}::vertex + p +------------------------------------------------------------------------------------------------------------------- + {"id": 2251799813685249, "label": ["Robert"], "properties": {"age": 47, "city": "London", "name": "Rob"}}::vertex (1 row) -- expected: no change @@ -869,9 +869,9 @@ SELECT * FROM cypher('cypher_set_1', $$ SET p += {} RETURN p $$) AS (p agtype); - p ------------------------------------------------------------------------------------------------------------------ - {"id": 2251799813685249, "label": "Robert", "properties": {"age": 47, "city": "London", "name": "Rob"}}::vertex + p +------------------------------------------------------------------------------------------------------------------- + {"id": 2251799813685249, "label": ["Robert"], "properties": {"age": 47, "city": "London", "name": "Rob"}}::vertex (1 row) -- test plus-equal with original properties having non-scalar values @@ -880,9 +880,9 @@ SELECT * FROM cypher('cypher_set_1', $$ SET p += {json: {a: -1, b: ['a', -1, true], c: {d: 'string'}}} RETURN p $$) AS (p agtype); - p --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 2533274790395905, "label": "VertexA", "properties": {"map": {"a": 1, "b": {"c": 2, "d": []}, "c": [{"d": -100, "e": []}]}, "num": -1.9::numeric, "str": "string", "bool": true, "json": {"a": -1, "b": ["a", -1, true], "c": {"d": "string"}}, "list": [1, "string", [{"a": []}, [[1, 2]]]]}}::vertex + p +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 2533274790395905, "label": ["VertexA"], "properties": {"map": {"a": 1, "b": {"c": 2, "d": []}, "c": [{"d": -100, "e": []}]}, "num": -1.9::numeric, "str": "string", "bool": true, "json": {"a": -1, "b": ["a", -1, true], "c": {"d": "string"}}, "list": [1, "string", [{"a": []}, [[1, 2]]]]}}::vertex (1 row) SELECT * FROM cypher('cypher_set_1', $$ @@ -890,9 +890,9 @@ SELECT * FROM cypher('cypher_set_1', $$ SET p += {list_upd: [1, 2, 3, 4, 5]} RETURN p $$) AS (p agtype); - p -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 2533274790395905, "label": "VertexA", "properties": {"map": {"a": 1, "b": {"c": 2, "d": []}, "c": [{"d": -100, "e": []}]}, "num": -1.9::numeric, "str": "string", "bool": true, "json": {"a": -1, "b": ["a", -1, true], "c": {"d": "string"}}, "list": [1, "string", [{"a": []}, [[1, 2]]]], "list_upd": [1, 2, 3, 4, 5]}}::vertex + p +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 2533274790395905, "label": ["VertexA"], "properties": {"map": {"a": 1, "b": {"c": 2, "d": []}, "c": [{"d": -100, "e": []}]}, "num": -1.9::numeric, "str": "string", "bool": true, "json": {"a": -1, "b": ["a", -1, true], "c": {"d": "string"}}, "list": [1, "string", [{"a": []}, [[1, 2]]]], "list_upd": [1, 2, 3, 4, 5]}}::vertex (1 row) SELECT * FROM cypher('cypher_set_1', $$ @@ -900,9 +900,9 @@ SELECT * FROM cypher('cypher_set_1', $$ SET p += {vertex: {id: 281474976710659, label: "", properties: {a: 1, b: [1, 2, 3]}}::vertex} RETURN p $$) AS (p agtype); - p -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 2533274790395905, "label": "VertexA", "properties": {"map": {"a": 1, "b": {"c": 2, "d": []}, "c": [{"d": -100, "e": []}]}, "num": -1.9::numeric, "str": "string", "bool": true, "json": {"a": -1, "b": ["a", -1, true], "c": {"d": "string"}}, "list": [1, "string", [{"a": []}, [[1, 2]]]], "vertex": {"id": 281474976710659, "label": "", "properties": {"a": 1, "b": [1, 2, 3]}}::vertex, "list_upd": [1, 2, 3, 4, 5]}}::vertex + p +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 2533274790395905, "label": ["VertexA"], "properties": {"map": {"a": 1, "b": {"c": 2, "d": []}, "c": [{"d": -100, "e": []}]}, "num": -1.9::numeric, "str": "string", "bool": true, "json": {"a": -1, "b": ["a", -1, true], "c": {"d": "string"}}, "list": [1, "string", [{"a": []}, [[1, 2]]]], "vertex": {"id": 281474976710659, "label": [], "properties": {"a": 1, "b": [1, 2, 3]}}::vertex, "list_upd": [1, 2, 3, 4, 5]}}::vertex (1 row) SELECT * FROM cypher('cypher_set_1', $$ @@ -910,9 +910,9 @@ SELECT * FROM cypher('cypher_set_1', $$ SET p += {} RETURN p $$) AS (p agtype); - p -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 2533274790395905, "label": "VertexA", "properties": {"map": {"a": 1, "b": {"c": 2, "d": []}, "c": [{"d": -100, "e": []}]}, "num": -1.9::numeric, "str": "string", "bool": true, "json": {"a": -1, "b": ["a", -1, true], "c": {"d": "string"}}, "list": [1, "string", [{"a": []}, [[1, 2]]]], "vertex": {"id": 281474976710659, "label": "", "properties": {"a": 1, "b": [1, 2, 3]}}::vertex, "list_upd": [1, 2, 3, 4, 5]}}::vertex + p +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 2533274790395905, "label": ["VertexA"], "properties": {"map": {"a": 1, "b": {"c": 2, "d": []}, "c": [{"d": -100, "e": []}]}, "num": -1.9::numeric, "str": "string", "bool": true, "json": {"a": -1, "b": ["a", -1, true], "c": {"d": "string"}}, "list": [1, "string", [{"a": []}, [[1, 2]]]], "vertex": {"id": 281474976710659, "label": [], "properties": {"a": 1, "b": [1, 2, 3]}}::vertex, "list_upd": [1, 2, 3, 4, 5]}}::vertex (1 row) -- @@ -924,7 +924,7 @@ SELECT * FROM cypher('cypher_set_1', $$ $$) AS (p agtype); p -------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"n0": true}}::vertex + {"id": 281474976710657, "label": [], "properties": {"n0": true}}::vertex (1 row) SELECT * FROM cypher('cypher_set_1', $$ @@ -932,7 +932,7 @@ SELECT * FROM cypher('cypher_set_1', $$ $$) AS (p agtype); p --------------------------------------------------------------------------------------------------- - {"id": 281474976710658, "label": "", "properties": {"n0": true, "n1": false, "n2": true}}::vertex + {"id": 281474976710658, "label": [], "properties": {"n0": true, "n1": false, "n2": true}}::vertex (1 row) -- diff --git a/regress/expected/cypher_union.out b/regress/expected/cypher_union.out index 063354ddb..55f3dd6cf 100644 --- a/regress/expected/cypher_union.out +++ b/regress/expected/cypher_union.out @@ -33,27 +33,27 @@ SELECT * FROM cypher('cypher_union', $$CREATE ()$$) as (a agtype); SELECT * FROM cypher('cypher_union', $$MATCH (n) RETURN n UNION MATCH (n) RETURN n$$) as (a agtype); a ---------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_union', $$MATCH (n) RETURN n UNION ALL MATCH (n) RETURN n$$) as (a agtype); a ---------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex - {"id": 281474976710657, "label": "", "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {}}::vertex (2 rows) SELECT * FROM cypher('cypher_union', $$MATCH (n) RETURN n UNION RETURN 1$$) as (a agtype); a ---------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {}}::vertex 1 (2 rows) SELECT * FROM cypher('cypher_union', $$MATCH (n) RETURN n UNION RETURN NULL$$) as (a agtype); a ---------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {}}::vertex (2 rows) @@ -85,31 +85,31 @@ SELECT * FROM cypher('cypher_union', $$RETURN NULL UNION ALL RETURN NULL$$) AS ( SELECT * FROM cypher('cypher_union', $$MATCH (n) RETURN n UNION MATCH (n) RETURN n UNION MATCH (n) RETURN n$$) AS (result agtype); result ---------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {}}::vertex (1 row) /*should return triple*/ SELECT * FROM cypher('cypher_union', $$MATCH (n) RETURN n UNION ALL MATCH (n) RETURN n UNION ALL MATCH(n) RETURN n$$) AS (result agtype); result ---------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex - {"id": 281474976710657, "label": "", "properties": {}}::vertex - {"id": 281474976710657, "label": "", "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {}}::vertex (3 rows) /*should return single*/ SELECT * FROM cypher('cypher_union', $$MATCH (n) RETURN n UNION ALL MATCH (n) RETURN n UNION MATCH(n) RETURN n$$) AS (result agtype); result ---------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {}}::vertex (1 row) /*should return just a pair*/ SELECT * FROM cypher('cypher_union', $$MATCH (n) RETURN n UNION MATCH (n) RETURN n UNION ALL MATCH(n) RETURN n$$) AS (result agtype); result ---------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex - {"id": 281474976710657, "label": "", "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {}}::vertex (2 rows) /*should return 3 null rows*/ diff --git a/regress/expected/cypher_unwind.out b/regress/expected/cypher_unwind.out index fae1a26ff..6715a33ef 100644 --- a/regress/expected/cypher_unwind.out +++ b/regress/expected/cypher_unwind.out @@ -43,9 +43,9 @@ SELECT * FROM cypher('cypher_unwind', $$ $$) as (i agtype); i ----------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"a": [1, 2, 3], "name": "node1"}}::vertex - {"id": 281474976710658, "label": "", "properties": {"a": [4, 5, 6], "name": "node2"}}::vertex - {"id": 281474976710659, "label": "", "properties": {"a": [7, 8, 9], "name": "node3"}}::vertex + {"id": 281474976710657, "label": [], "properties": {"a": [1, 2, 3], "name": "node1"}}::vertex + {"id": 281474976710658, "label": [], "properties": {"a": [4, 5, 6], "name": "node2"}}::vertex + {"id": 281474976710659, "label": [], "properties": {"a": [7, 8, 9], "name": "node3"}}::vertex (3 rows) -- @@ -104,10 +104,10 @@ SELECT * FROM cypher('cypher_unwind', $$ $$) as (i agtype); i ----------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"a": [1, 2, 3], "name": "node1"}}::vertex - {"id": 281474976710658, "label": "", "properties": {"a": [4, 5, 6], "name": "node2"}}::vertex - {"id": 281474976710658, "label": "", "properties": {"a": [4, 5, 6], "name": "node2"}}::vertex - {"id": 281474976710659, "label": "", "properties": {"a": [7, 8, 9], "name": "node3"}}::vertex + {"id": 281474976710657, "label": [], "properties": {"a": [1, 2, 3], "name": "node1"}}::vertex + {"id": 281474976710658, "label": [], "properties": {"a": [4, 5, 6], "name": "node2"}}::vertex + {"id": 281474976710658, "label": [], "properties": {"a": [4, 5, 6], "name": "node2"}}::vertex + {"id": 281474976710659, "label": [], "properties": {"a": [7, 8, 9], "name": "node3"}}::vertex (4 rows) SELECT * FROM cypher('cypher_unwind', $$ @@ -152,9 +152,9 @@ SELECT * FROM cypher('cypher_unwind', $$ UNWIND [p] as path RETURN path $$) as (i agtype); - i ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - [{"id": 281474976710657, "label": "_ag_label_vertex", "properties": {"a": [1, 2, 3], "name": "node1"}}::vertex, {"id": 844424930131969, "label": "KNOWS", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge, {"id": 281474976710658, "label": "_ag_label_vertex", "properties": {"a": [4, 5, 6], "name": "node2"}}::vertex, {"id": 844424930131970, "label": "KNOWS", "end_id": 281474976710659, "start_id": 281474976710658, "properties": {}}::edge, {"id": 281474976710659, "label": "_ag_label_vertex", "properties": {"a": [7, 8, 9], "name": "node3"}}::vertex]::path + i +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 281474976710657, "label": [], "properties": {"a": [1, 2, 3], "name": "node1"}}::vertex, {"id": 844424930131969, "label": "KNOWS", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge, {"id": 281474976710658, "label": [], "properties": {"a": [4, 5, 6], "name": "node2"}}::vertex, {"id": 844424930131970, "label": "KNOWS", "end_id": 281474976710659, "start_id": 281474976710658, "properties": {}}::edge, {"id": 281474976710659, "label": [], "properties": {"a": [7, 8, 9], "name": "node3"}}::vertex]::path (1 row) SELECT * FROM cypher('cypher_unwind', $$ @@ -195,9 +195,9 @@ SELECT * FROM cypher('cypher_unwind', $$ $$) as (i agtype); i ----------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"a": [1, 2, 3], "name": "node1", "type": "vertex"}}::vertex - {"id": 281474976710658, "label": "", "properties": {"a": [4, 5, 6], "name": "node2", "type": "vertex"}}::vertex - {"id": 281474976710659, "label": "", "properties": {"a": [7, 8, 9], "name": "node3", "type": "vertex"}}::vertex + {"id": 281474976710657, "label": [], "properties": {"a": [1, 2, 3], "name": "node1", "type": "vertex"}}::vertex + {"id": 281474976710658, "label": [], "properties": {"a": [4, 5, 6], "name": "node2", "type": "vertex"}}::vertex + {"id": 281474976710659, "label": [], "properties": {"a": [7, 8, 9], "name": "node3", "type": "vertex"}}::vertex (3 rows) -- diff --git a/regress/expected/cypher_vle.out b/regress/expected/cypher_vle.out index b3cada60a..b58870ef5 100644 --- a/regress/expected/cypher_vle.out +++ b/regress/expected/cypher_vle.out @@ -31,18 +31,18 @@ NOTICE: graph "cypher_vle" has been created CREATE TABLE start_and_end_points (start_vertex agtype, end_vertex agtype); -- Create a graph to test SELECT * FROM cypher('cypher_vle', $$CREATE (b:begin)-[:edge {name: 'main edge', number: 1, dangerous: {type: "all", level: "all"}}]->(u1:middle)-[:edge {name: 'main edge', number: 2, dangerous: {type: "all", level: "all"}, packages: [2,4,6]}]->(u2:middle)-[:edge {name: 'main edge', number: 3, dangerous: {type: "all", level: "all"}}]->(u3:middle)-[:edge {name: 'main edge', number: 4, dangerous: {type: "all", level: "all"}}]->(e:end), (u1)-[:self_loop {name: 'self loop', number: 1, dangerous: {type: "all", level: "all"}}]->(u1), (e)-[:self_loop {name: 'self loop', number: 2, dangerous: {type: "all", level: "all"}}]->(e), (b)-[:alternate_edge {name: 'alternate edge', number: 1, packages: [2,4,6], dangerous: {type: "poisons", level: "all"}}]->(u1), (u2)-[:alternate_edge {name: 'alternate edge', number: 2, packages: [2,4,6], dangerous: {type: "poisons", level: "all"}}]->(u3), (u3)-[:alternate_edge {name: 'alternate edge', number: 3, packages: [2,4,6], dangerous: {type: "poisons", level: "all"}}]->(e), (u2)-[:bypass_edge {name: 'bypass edge', number: 1, packages: [1,3,5,7]}]->(e), (e)-[:alternate_edge {name: 'backup edge', number: 1, packages: [1,3,5,7]}]->(u3), (u3)-[:alternate_edge {name: 'backup edge', number: 2, packages: [1,3,5,7]}]->(u2), (u2)-[:bypass_edge {name: 'bypass edge', number: 2, packages: [1,3,5,7], dangerous: {type: "poisons", level: "all"}}]->(b) RETURN b, e $$) AS (b agtype, e agtype); - b | e ----------------------------------------------------------------------+-------------------------------------------------------------------- - {"id": 844424930131969, "label": "begin", "properties": {}}::vertex | {"id": 1688849860263937, "label": "end", "properties": {}}::vertex + b | e +-----------------------------------------------------------------------+---------------------------------------------------------------------- + {"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex | {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex (1 row) -- Insert start and end points for graph INSERT INTO start_and_end_points (SELECT * FROM cypher('cypher_vle', $$MATCH (b:begin)-[:edge]->()-[:edge]->()-[:edge]->()-[:edge]->(e:end) RETURN b, e $$) AS (b agtype, e agtype)); -- Display our points SELECT * FROM start_and_end_points; - start_vertex | end_vertex ----------------------------------------------------------------------+-------------------------------------------------------------------- - {"id": 844424930131969, "label": "begin", "properties": {}}::vertex | {"id": 1688849860263937, "label": "end", "properties": {}}::vertex + start_vertex | end_vertex +-----------------------------------------------------------------------+---------------------------------------------------------------------- + {"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex | {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex (1 row) -- Count the total paths from left (start) to right (end) -[]-> should be 400 @@ -290,13 +290,13 @@ SELECT * FROM cypher('cypher_vle', $$MATCH (u:begin)<-[e*]-(v:end) RETURN e $$) -- Should find 5 SELECT * FROM cypher('cypher_vle', $$MATCH p=(:begin)<-[*1..1]-()-[]-() RETURN p ORDER BY p $$) AS (e agtype); - e ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 1125899906842626, "label": "edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "main edge", "number": 3, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 1125899906842627, "label": "edge", "end_id": 1407374883553282, "start_id": 1407374883553281, "properties": {"name": "main edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553281, "label": "middle", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685250, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "alternate edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2533274790395905, "label": "bypass_edge", "end_id": 1688849860263937, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path + e +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 1125899906842626, "label": "edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "main edge", "number": 3, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 1125899906842627, "label": "edge", "end_id": 1407374883553282, "start_id": 1407374883553281, "properties": {"name": "main edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553281, "label": ["middle"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685250, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "alternate edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2533274790395905, "label": "bypass_edge", "end_id": 1688849860263937, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path (5 rows) -- Should find 2922 @@ -308,43 +308,43 @@ SELECT * FROM cypher('cypher_vle', $$MATCH p=()-[*]->(v) RETURN count(*) $$) AS -- Should find 2 SELECT * FROM cypher('cypher_vle', $$MATCH p=(u:begin)-[*3..3]->(v:end) RETURN p $$) AS (e agtype); - e -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2251799813685249, "label": "alternate_edge", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {"name": "alternate edge", "number": 1, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553281, "label": "middle", "properties": {}}::vertex, {"id": 1125899906842627, "label": "edge", "end_id": 1407374883553282, "start_id": 1407374883553281, "properties": {"name": "main edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2533274790395905, "label": "bypass_edge", "end_id": 1688849860263937, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 1125899906842628, "label": "edge", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {"name": "main edge", "number": 1, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553281, "label": "middle", "properties": {}}::vertex, {"id": 1125899906842627, "label": "edge", "end_id": 1407374883553282, "start_id": 1407374883553281, "properties": {"name": "main edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2533274790395905, "label": "bypass_edge", "end_id": 1688849860263937, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path + e +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2251799813685249, "label": "alternate_edge", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {"name": "alternate edge", "number": 1, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553281, "label": ["middle"], "properties": {}}::vertex, {"id": 1125899906842627, "label": "edge", "end_id": 1407374883553282, "start_id": 1407374883553281, "properties": {"name": "main edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2533274790395905, "label": "bypass_edge", "end_id": 1688849860263937, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 1125899906842628, "label": "edge", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {"name": "main edge", "number": 1, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553281, "label": ["middle"], "properties": {}}::vertex, {"id": 1125899906842627, "label": "edge", "end_id": 1407374883553282, "start_id": 1407374883553281, "properties": {"name": "main edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2533274790395905, "label": "bypass_edge", "end_id": 1688849860263937, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path (2 rows) -- Should find 12 SELECT * FROM cypher('cypher_vle', $$MATCH p=(u:begin)-[*3..3]-(v:end) RETURN p $$) AS (e agtype); - e ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685251, "label": "alternate_edge", "end_id": 1688849860263937, "start_id": 1407374883553283, "properties": {"name": "alternate edge", "number": 3, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex, {"id": 1125899906842625, "label": "edge", "end_id": 1688849860263937, "start_id": 1407374883553283, "properties": {"name": "main edge", "number": 4, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2533274790395905, "label": "bypass_edge", "end_id": 1688849860263937, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex, {"id": 1970324836974594, "label": "self_loop", "end_id": 1688849860263937, "start_id": 1688849860263937, "properties": {"name": "self loop", "number": 2, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685250, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "alternate edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685250, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "alternate edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685251, "label": "alternate_edge", "end_id": 1688849860263937, "start_id": 1407374883553283, "properties": {"name": "alternate edge", "number": 3, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685250, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "alternate edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex, {"id": 1125899906842625, "label": "edge", "end_id": 1688849860263937, "start_id": 1407374883553283, "properties": {"name": "main edge", "number": 4, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 1125899906842626, "label": "edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "main edge", "number": 3, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 1125899906842626, "label": "edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "main edge", "number": 3, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685251, "label": "alternate_edge", "end_id": 1688849860263937, "start_id": 1407374883553283, "properties": {"name": "alternate edge", "number": 3, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 1125899906842626, "label": "edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "main edge", "number": 3, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex, {"id": 1125899906842625, "label": "edge", "end_id": 1688849860263937, "start_id": 1407374883553283, "properties": {"name": "main edge", "number": 4, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2251799813685249, "label": "alternate_edge", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {"name": "alternate edge", "number": 1, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553281, "label": "middle", "properties": {}}::vertex, {"id": 1125899906842627, "label": "edge", "end_id": 1407374883553282, "start_id": 1407374883553281, "properties": {"name": "main edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2533274790395905, "label": "bypass_edge", "end_id": 1688849860263937, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 1125899906842628, "label": "edge", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {"name": "main edge", "number": 1, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553281, "label": "middle", "properties": {}}::vertex, {"id": 1125899906842627, "label": "edge", "end_id": 1407374883553282, "start_id": 1407374883553281, "properties": {"name": "main edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2533274790395905, "label": "bypass_edge", "end_id": 1688849860263937, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path + e +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685251, "label": "alternate_edge", "end_id": 1688849860263937, "start_id": 1407374883553283, "properties": {"name": "alternate edge", "number": 3, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex, {"id": 1125899906842625, "label": "edge", "end_id": 1688849860263937, "start_id": 1407374883553283, "properties": {"name": "main edge", "number": 4, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2533274790395905, "label": "bypass_edge", "end_id": 1688849860263937, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex, {"id": 1970324836974594, "label": "self_loop", "end_id": 1688849860263937, "start_id": 1688849860263937, "properties": {"name": "self loop", "number": 2, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685250, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "alternate edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685250, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "alternate edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685251, "label": "alternate_edge", "end_id": 1688849860263937, "start_id": 1407374883553283, "properties": {"name": "alternate edge", "number": 3, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685250, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "alternate edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex, {"id": 1125899906842625, "label": "edge", "end_id": 1688849860263937, "start_id": 1407374883553283, "properties": {"name": "main edge", "number": 4, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 1125899906842626, "label": "edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "main edge", "number": 3, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 1125899906842626, "label": "edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "main edge", "number": 3, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685251, "label": "alternate_edge", "end_id": 1688849860263937, "start_id": 1407374883553283, "properties": {"name": "alternate edge", "number": 3, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 1125899906842626, "label": "edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "main edge", "number": 3, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex, {"id": 1125899906842625, "label": "edge", "end_id": 1688849860263937, "start_id": 1407374883553283, "properties": {"name": "main edge", "number": 4, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2251799813685249, "label": "alternate_edge", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {"name": "alternate edge", "number": 1, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553281, "label": ["middle"], "properties": {}}::vertex, {"id": 1125899906842627, "label": "edge", "end_id": 1407374883553282, "start_id": 1407374883553281, "properties": {"name": "main edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2533274790395905, "label": "bypass_edge", "end_id": 1688849860263937, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 1125899906842628, "label": "edge", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {"name": "main edge", "number": 1, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553281, "label": ["middle"], "properties": {}}::vertex, {"id": 1125899906842627, "label": "edge", "end_id": 1407374883553282, "start_id": 1407374883553281, "properties": {"name": "main edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2533274790395905, "label": "bypass_edge", "end_id": 1688849860263937, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path (12 rows) -- Each should find 2 SELECT * FROM cypher('cypher_vle', $$MATCH p=(u:begin)<-[*]-(v:end) RETURN p $$) AS (e agtype); - e ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex, {"id": 1970324836974594, "label": "self_loop", "end_id": 1688849860263937, "start_id": 1688849860263937, "properties": {"name": "self loop", "number": 2, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path + e +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex, {"id": 1970324836974594, "label": "self_loop", "end_id": 1688849860263937, "start_id": 1688849860263937, "properties": {"name": "self loop", "number": 2, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path (2 rows) SELECT * FROM cypher('cypher_vle', $$MATCH p=(u:begin)<-[e*]-(v:end) RETURN p $$) AS (e agtype); - e ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex, {"id": 1970324836974594, "label": "self_loop", "end_id": 1688849860263937, "start_id": 1688849860263937, "properties": {"name": "self loop", "number": 2, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path + e +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex, {"id": 1970324836974594, "label": "self_loop", "end_id": 1688849860263937, "start_id": 1688849860263937, "properties": {"name": "self loop", "number": 2, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path (2 rows) SELECT * FROM cypher('cypher_vle', $$MATCH p=(u:begin)<-[e*]-(v:end) RETURN e $$) AS (e agtype); @@ -355,10 +355,10 @@ SELECT * FROM cypher('cypher_vle', $$MATCH p=(u:begin)<-[e*]-(v:end) RETURN e $$ (2 rows) SELECT * FROM cypher('cypher_vle', $$MATCH p=(:begin)<-[*]-()<-[]-(:end) RETURN p $$) AS (e agtype); - e ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex, {"id": 1970324836974594, "label": "self_loop", "end_id": 1688849860263937, "start_id": 1688849860263937, "properties": {"name": "self loop", "number": 2, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path + e +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex, {"id": 1970324836974594, "label": "self_loop", "end_id": 1688849860263937, "start_id": 1688849860263937, "properties": {"name": "self loop", "number": 2, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path (2 rows) -- Each should return 31 @@ -461,9 +461,9 @@ $$) AS (e1 agtype, e2 agtype); -- Should return 1 path SELECT * FROM cypher('cypher_vle', $$ MATCH p=()<-[e1*]-(:end)-[e2*]->(:begin) RETURN p $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 1688849860263937, "label": "end", "properties": {}}::vertex, {"id": 1970324836974594, "label": "self_loop", "end_id": 1688849860263937, "start_id": 1688849860263937, "properties": {"name": "self loop", "number": 2, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 844424930131969, "label": "begin", "properties": {}}::vertex]::path + result +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex, {"id": 1970324836974594, "label": "self_loop", "end_id": 1688849860263937, "start_id": 1688849860263937, "properties": {"name": "self loop", "number": 2, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex]::path (1 row) -- Each should return 3 @@ -476,11 +476,11 @@ SELECT * FROM cypher('cypher_vle', $$MATCH (u:begin)-[e*0..1]->(v) RETURN id(u), (3 rows) SELECT * FROM cypher('cypher_vle', $$MATCH p=(u:begin)-[e*0..1]->(v) RETURN p $$) AS (p agtype); - p --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2251799813685249, "label": "alternate_edge", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {"name": "alternate edge", "number": 1, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553281, "label": "middle", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 1125899906842628, "label": "edge", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {"name": "main edge", "number": 1, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553281, "label": "middle", "properties": {}}::vertex]::path + p +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2251799813685249, "label": "alternate_edge", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {"name": "alternate edge", "number": 1, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553281, "label": ["middle"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 1125899906842628, "label": "edge", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {"name": "main edge", "number": 1, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553281, "label": ["middle"], "properties": {}}::vertex]::path (3 rows) -- Each should return 5 @@ -495,50 +495,50 @@ SELECT * FROM cypher('cypher_vle', $$MATCH (u)-[e*0..0]->(v) RETURN id(u), e, id (5 rows) SELECT * FROM cypher('cypher_vle', $$MATCH p=(u)-[e*0..0]->(v) RETURN id(u), p, id(v) $$) AS (u agtype, p agtype, v agtype); - u | p | v -------------------+-------------------------------------------------------------------------------+------------------ - 844424930131969 | [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex]::path | 844424930131969 - 1407374883553281 | [{"id": 1407374883553281, "label": "middle", "properties": {}}::vertex]::path | 1407374883553281 - 1407374883553282 | [{"id": 1407374883553282, "label": "middle", "properties": {}}::vertex]::path | 1407374883553282 - 1407374883553283 | [{"id": 1407374883553283, "label": "middle", "properties": {}}::vertex]::path | 1407374883553283 - 1688849860263937 | [{"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path | 1688849860263937 + u | p | v +------------------+---------------------------------------------------------------------------------+------------------ + 844424930131969 | [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex]::path | 844424930131969 + 1407374883553281 | [{"id": 1407374883553281, "label": ["middle"], "properties": {}}::vertex]::path | 1407374883553281 + 1407374883553282 | [{"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex]::path | 1407374883553282 + 1407374883553283 | [{"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex]::path | 1407374883553283 + 1688849860263937 | [{"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path | 1688849860263937 (5 rows) -- Each should return 13 and will be the same SELECT * FROM cypher('cypher_vle', $$MATCH p=()-[*0..0]->()-[]->() RETURN p $$) AS (p agtype); - p ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2251799813685249, "label": "alternate_edge", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {"name": "alternate edge", "number": 1, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553281, "label": "middle", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 1125899906842628, "label": "edge", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {"name": "main edge", "number": 1, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553281, "label": "middle", "properties": {}}::vertex]::path - [{"id": 1407374883553281, "label": "middle", "properties": {}}::vertex, {"id": 1125899906842627, "label": "edge", "end_id": 1407374883553282, "start_id": 1407374883553281, "properties": {"name": "main edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex]::path - [{"id": 1407374883553281, "label": "middle", "properties": {}}::vertex, {"id": 1970324836974593, "label": "self_loop", "end_id": 1407374883553281, "start_id": 1407374883553281, "properties": {"name": "self loop", "number": 1, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553281, "label": "middle", "properties": {}}::vertex]::path - [{"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 1125899906842626, "label": "edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "main edge", "number": 3, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex]::path - [{"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685250, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "alternate edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex]::path - [{"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2533274790395905, "label": "bypass_edge", "end_id": 1688849860263937, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path - [{"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 844424930131969, "label": "begin", "properties": {}}::vertex]::path - [{"id": 1407374883553283, "label": "middle", "properties": {}}::vertex, {"id": 1125899906842625, "label": "edge", "end_id": 1688849860263937, "start_id": 1407374883553283, "properties": {"name": "main edge", "number": 4, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path - [{"id": 1407374883553283, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex]::path - [{"id": 1407374883553283, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685251, "label": "alternate_edge", "end_id": 1688849860263937, "start_id": 1407374883553283, "properties": {"name": "alternate edge", "number": 3, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path - [{"id": 1688849860263937, "label": "end", "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex]::path - [{"id": 1688849860263937, "label": "end", "properties": {}}::vertex, {"id": 1970324836974594, "label": "self_loop", "end_id": 1688849860263937, "start_id": 1688849860263937, "properties": {"name": "self loop", "number": 2, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path + p +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2251799813685249, "label": "alternate_edge", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {"name": "alternate edge", "number": 1, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553281, "label": ["middle"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 1125899906842628, "label": "edge", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {"name": "main edge", "number": 1, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553281, "label": ["middle"], "properties": {}}::vertex]::path + [{"id": 1407374883553281, "label": ["middle"], "properties": {}}::vertex, {"id": 1125899906842627, "label": "edge", "end_id": 1407374883553282, "start_id": 1407374883553281, "properties": {"name": "main edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex]::path + [{"id": 1407374883553281, "label": ["middle"], "properties": {}}::vertex, {"id": 1970324836974593, "label": "self_loop", "end_id": 1407374883553281, "start_id": 1407374883553281, "properties": {"name": "self loop", "number": 1, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553281, "label": ["middle"], "properties": {}}::vertex]::path + [{"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 1125899906842626, "label": "edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "main edge", "number": 3, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex]::path + [{"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685250, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "alternate edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex]::path + [{"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2533274790395905, "label": "bypass_edge", "end_id": 1688849860263937, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path + [{"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex]::path + [{"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex, {"id": 1125899906842625, "label": "edge", "end_id": 1688849860263937, "start_id": 1407374883553283, "properties": {"name": "main edge", "number": 4, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path + [{"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex]::path + [{"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685251, "label": "alternate_edge", "end_id": 1688849860263937, "start_id": 1407374883553283, "properties": {"name": "alternate edge", "number": 3, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path + [{"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex]::path + [{"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex, {"id": 1970324836974594, "label": "self_loop", "end_id": 1688849860263937, "start_id": 1688849860263937, "properties": {"name": "self loop", "number": 2, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path (13 rows) SELECT * FROM cypher('cypher_vle', $$MATCH p=()-[]->()-[*0..0]->() RETURN p $$) AS (p agtype); - p ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - [{"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 844424930131969, "label": "begin", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 2251799813685249, "label": "alternate_edge", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {"name": "alternate edge", "number": 1, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553281, "label": "middle", "properties": {}}::vertex]::path - [{"id": 844424930131969, "label": "begin", "properties": {}}::vertex, {"id": 1125899906842628, "label": "edge", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {"name": "main edge", "number": 1, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553281, "label": "middle", "properties": {}}::vertex]::path - [{"id": 1407374883553281, "label": "middle", "properties": {}}::vertex, {"id": 1970324836974593, "label": "self_loop", "end_id": 1407374883553281, "start_id": 1407374883553281, "properties": {"name": "self loop", "number": 1, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553281, "label": "middle", "properties": {}}::vertex]::path - [{"id": 1407374883553283, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex]::path - [{"id": 1407374883553281, "label": "middle", "properties": {}}::vertex, {"id": 1125899906842627, "label": "edge", "end_id": 1407374883553282, "start_id": 1407374883553281, "properties": {"name": "main edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553282, "label": "middle", "properties": {}}::vertex]::path - [{"id": 1688849860263937, "label": "end", "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex]::path - [{"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 1125899906842626, "label": "edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "main edge", "number": 3, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex]::path - [{"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685250, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "alternate edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553283, "label": "middle", "properties": {}}::vertex]::path - [{"id": 1407374883553282, "label": "middle", "properties": {}}::vertex, {"id": 2533274790395905, "label": "bypass_edge", "end_id": 1688849860263937, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path - [{"id": 1688849860263937, "label": "end", "properties": {}}::vertex, {"id": 1970324836974594, "label": "self_loop", "end_id": 1688849860263937, "start_id": 1688849860263937, "properties": {"name": "self loop", "number": 2, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path - [{"id": 1407374883553283, "label": "middle", "properties": {}}::vertex, {"id": 1125899906842625, "label": "edge", "end_id": 1688849860263937, "start_id": 1407374883553283, "properties": {"name": "main edge", "number": 4, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path - [{"id": 1407374883553283, "label": "middle", "properties": {}}::vertex, {"id": 2251799813685251, "label": "alternate_edge", "end_id": 1688849860263937, "start_id": 1407374883553283, "properties": {"name": "alternate edge", "number": 3, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1688849860263937, "label": "end", "properties": {}}::vertex]::path + p +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2533274790395906, "label": "bypass_edge", "end_id": 844424930131969, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 2, "packages": [1, 3, 5, 7], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 2251799813685249, "label": "alternate_edge", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {"name": "alternate edge", "number": 1, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553281, "label": ["middle"], "properties": {}}::vertex]::path + [{"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex, {"id": 1125899906842628, "label": "edge", "end_id": 1407374883553281, "start_id": 844424930131969, "properties": {"name": "main edge", "number": 1, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553281, "label": ["middle"], "properties": {}}::vertex]::path + [{"id": 1407374883553281, "label": ["middle"], "properties": {}}::vertex, {"id": 1970324836974593, "label": "self_loop", "end_id": 1407374883553281, "start_id": 1407374883553281, "properties": {"name": "self loop", "number": 1, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553281, "label": ["middle"], "properties": {}}::vertex]::path + [{"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685253, "label": "alternate_edge", "end_id": 1407374883553282, "start_id": 1407374883553283, "properties": {"name": "backup edge", "number": 2, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex]::path + [{"id": 1407374883553281, "label": ["middle"], "properties": {}}::vertex, {"id": 1125899906842627, "label": "edge", "end_id": 1407374883553282, "start_id": 1407374883553281, "properties": {"name": "main edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex]::path + [{"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex, {"id": 2251799813685252, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1688849860263937, "properties": {"name": "backup edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex]::path + [{"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 1125899906842626, "label": "edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "main edge", "number": 3, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex]::path + [{"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685250, "label": "alternate_edge", "end_id": 1407374883553283, "start_id": 1407374883553282, "properties": {"name": "alternate edge", "number": 2, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex]::path + [{"id": 1407374883553282, "label": ["middle"], "properties": {}}::vertex, {"id": 2533274790395905, "label": "bypass_edge", "end_id": 1688849860263937, "start_id": 1407374883553282, "properties": {"name": "bypass edge", "number": 1, "packages": [1, 3, 5, 7]}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path + [{"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex, {"id": 1970324836974594, "label": "self_loop", "end_id": 1688849860263937, "start_id": 1688849860263937, "properties": {"name": "self loop", "number": 2, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path + [{"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex, {"id": 1125899906842625, "label": "edge", "end_id": 1688849860263937, "start_id": 1407374883553283, "properties": {"name": "main edge", "number": 4, "dangerous": {"type": "all", "level": "all"}}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path + [{"id": 1407374883553283, "label": ["middle"], "properties": {}}::vertex, {"id": 2251799813685251, "label": "alternate_edge", "end_id": 1688849860263937, "start_id": 1407374883553283, "properties": {"name": "alternate edge", "number": 3, "packages": [2, 4, 6], "dangerous": {"type": "poisons", "level": "all"}}}::edge, {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex]::path (13 rows) -- @@ -565,9 +565,9 @@ SELECT * FROM cypher('mygraph', $$ MATCH p = ()-[:Edge*]->() RETURN p $$) AS (g2 agtype); - g2 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 844424930131969, "label": "Node", "properties": {"name": "a"}}::vertex, {"id": 1125899906842625, "label": "Edge", "end_id": 844424930131970, "start_id": 844424930131969, "properties": {}}::edge, {"id": 844424930131970, "label": "Node", "properties": {"name": "c"}}::vertex]::path + g2 +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 844424930131969, "label": ["Node"], "properties": {"name": "a"}}::vertex, {"id": 1125899906842625, "label": "Edge", "end_id": 844424930131970, "start_id": 844424930131969, "properties": {}}::edge, {"id": 844424930131970, "label": ["Node"], "properties": {"name": "c"}}::vertex]::path (1 row) /* should delete the original path and replace it with a path with 2 edges */ @@ -585,10 +585,10 @@ SELECT * FROM cypher('mygraph', $$ MATCH p = ()-[:Edge]->() RETURN p $$) AS (g4 agtype); - g4 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 844424930131971, "label": "Node", "properties": {"name": "b"}}::vertex, {"id": 1125899906842626, "label": "Edge", "end_id": 844424930131970, "start_id": 844424930131971, "properties": {}}::edge, {"id": 844424930131970, "label": "Node", "properties": {"name": "c"}}::vertex]::path - [{"id": 844424930131969, "label": "Node", "properties": {"name": "a"}}::vertex, {"id": 1125899906842627, "label": "Edge", "end_id": 844424930131971, "start_id": 844424930131969, "properties": {}}::edge, {"id": 844424930131971, "label": "Node", "properties": {"name": "b"}}::vertex]::path + g4 +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 844424930131971, "label": ["Node"], "properties": {"name": "b"}}::vertex, {"id": 1125899906842626, "label": "Edge", "end_id": 844424930131970, "start_id": 844424930131971, "properties": {}}::edge, {"id": 844424930131970, "label": ["Node"], "properties": {"name": "c"}}::vertex]::path + [{"id": 844424930131969, "label": ["Node"], "properties": {"name": "a"}}::vertex, {"id": 1125899906842627, "label": "Edge", "end_id": 844424930131971, "start_id": 844424930131969, "properties": {}}::edge, {"id": 844424930131971, "label": ["Node"], "properties": {"name": "b"}}::vertex]::path (2 rows) /* should return 3 paths, 2 with 1 edge, 1 with 2 edges */ @@ -596,11 +596,11 @@ SELECT * FROM cypher('mygraph', $$ MATCH p = ()-[:Edge*]->() RETURN p $$) AS (g5 agtype); - g5 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - [{"id": 844424930131969, "label": "Node", "properties": {"name": "a"}}::vertex, {"id": 1125899906842627, "label": "Edge", "end_id": 844424930131971, "start_id": 844424930131969, "properties": {}}::edge, {"id": 844424930131971, "label": "Node", "properties": {"name": "b"}}::vertex]::path - [{"id": 844424930131969, "label": "Node", "properties": {"name": "a"}}::vertex, {"id": 1125899906842627, "label": "Edge", "end_id": 844424930131971, "start_id": 844424930131969, "properties": {}}::edge, {"id": 844424930131971, "label": "Node", "properties": {"name": "b"}}::vertex, {"id": 1125899906842626, "label": "Edge", "end_id": 844424930131970, "start_id": 844424930131971, "properties": {}}::edge, {"id": 844424930131970, "label": "Node", "properties": {"name": "c"}}::vertex]::path - [{"id": 844424930131971, "label": "Node", "properties": {"name": "b"}}::vertex, {"id": 1125899906842626, "label": "Edge", "end_id": 844424930131970, "start_id": 844424930131971, "properties": {}}::edge, {"id": 844424930131970, "label": "Node", "properties": {"name": "c"}}::vertex]::path + g5 +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 844424930131969, "label": ["Node"], "properties": {"name": "a"}}::vertex, {"id": 1125899906842627, "label": "Edge", "end_id": 844424930131971, "start_id": 844424930131969, "properties": {}}::edge, {"id": 844424930131971, "label": ["Node"], "properties": {"name": "b"}}::vertex]::path + [{"id": 844424930131969, "label": ["Node"], "properties": {"name": "a"}}::vertex, {"id": 1125899906842627, "label": "Edge", "end_id": 844424930131971, "start_id": 844424930131969, "properties": {}}::edge, {"id": 844424930131971, "label": ["Node"], "properties": {"name": "b"}}::vertex, {"id": 1125899906842626, "label": "Edge", "end_id": 844424930131970, "start_id": 844424930131971, "properties": {}}::edge, {"id": 844424930131970, "label": ["Node"], "properties": {"name": "c"}}::vertex]::path + [{"id": 844424930131971, "label": ["Node"], "properties": {"name": "b"}}::vertex, {"id": 1125899906842626, "label": "Edge", "end_id": 844424930131970, "start_id": 844424930131971, "properties": {}}::edge, {"id": 844424930131970, "label": ["Node"], "properties": {"name": "c"}}::vertex]::path (3 rows) SELECT drop_graph('mygraph', true); @@ -710,9 +710,9 @@ SELECT prepend_node('list01', 'a'); (1 row) SELECT * FROM show_list_use_vle('list01'); - node ------------------------------------------------------------------------------------ - {"id": 1407374883553281, "label": "node", "properties": {"content": "a"}}::vertex + node +------------------------------------------------------------------------------------- + {"id": 1407374883553281, "label": ["node"], "properties": {"content": "a"}}::vertex (1 row) -- prepend a node 'b' @@ -724,10 +724,10 @@ SELECT prepend_node('list01', 'b'); (1 row) SELECT * FROM show_list_use_vle('list01'); - node ------------------------------------------------------------------------------------ - {"id": 1407374883553281, "label": "node", "properties": {"content": "a"}}::vertex - {"id": 1407374883553282, "label": "node", "properties": {"content": "b"}}::vertex + node +------------------------------------------------------------------------------------- + {"id": 1407374883553281, "label": ["node"], "properties": {"content": "a"}}::vertex + {"id": 1407374883553282, "label": ["node"], "properties": {"content": "b"}}::vertex (2 rows) -- prepend a node 'c' @@ -739,11 +739,11 @@ SELECT prepend_node('list01', 'c'); (1 row) SELECT * FROM show_list_use_vle('list01'); - node ------------------------------------------------------------------------------------ - {"id": 1407374883553281, "label": "node", "properties": {"content": "a"}}::vertex - {"id": 1407374883553282, "label": "node", "properties": {"content": "b"}}::vertex - {"id": 1407374883553283, "label": "node", "properties": {"content": "c"}}::vertex + node +------------------------------------------------------------------------------------- + {"id": 1407374883553281, "label": ["node"], "properties": {"content": "a"}}::vertex + {"id": 1407374883553282, "label": ["node"], "properties": {"content": "b"}}::vertex + {"id": 1407374883553283, "label": ["node"], "properties": {"content": "c"}}::vertex (3 rows) DROP FUNCTION show_list_use_vle; @@ -1016,7 +1016,7 @@ SELECT * FROM cypher('issue_1043', $$ CREATE (n)-[:KNOWS {n:'hello'}]->({n:'hell SELECT * FROM cypher('issue_1043', $$ MATCH (x)<-[y *]-(),({n:y[0].n}) RETURN x $$) as (a agtype); a ---------------------------------------------------------------------------- - {"id": 281474976710658, "label": "", "properties": {"n": "hello"}}::vertex + {"id": 281474976710658, "label": [], "properties": {"n": "hello"}}::vertex (1 row) SELECT * FROM cypher('issue_1043', $$ CREATE (n)-[:KNOWS {n:'hello'}]->({n:'hello'}) $$) as (a agtype); @@ -1027,10 +1027,10 @@ SELECT * FROM cypher('issue_1043', $$ CREATE (n)-[:KNOWS {n:'hello'}]->({n:'hell SELECT * FROM cypher('issue_1043', $$ MATCH (x)<-[y *]-(),({n:y[0].n}) RETURN x $$) as (a agtype); a ---------------------------------------------------------------------------- - {"id": 281474976710658, "label": "", "properties": {"n": "hello"}}::vertex - {"id": 281474976710658, "label": "", "properties": {"n": "hello"}}::vertex - {"id": 281474976710660, "label": "", "properties": {"n": "hello"}}::vertex - {"id": 281474976710660, "label": "", "properties": {"n": "hello"}}::vertex + {"id": 281474976710658, "label": [], "properties": {"n": "hello"}}::vertex + {"id": 281474976710658, "label": [], "properties": {"n": "hello"}}::vertex + {"id": 281474976710660, "label": [], "properties": {"n": "hello"}}::vertex + {"id": 281474976710660, "label": [], "properties": {"n": "hello"}}::vertex (4 rows) SELECT drop_graph('issue_1043', true); diff --git a/regress/expected/cypher_with.out b/regress/expected/cypher_with.out index e5f82aa21..6d55c08d0 100644 --- a/regress/expected/cypher_with.out +++ b/regress/expected/cypher_with.out @@ -55,12 +55,12 @@ SELECT * FROM cypher('cypher_with', $$ $$) AS (N1 agtype, edge agtype, N2 agtype); n1 | edge | n2 --------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"age": 36, "name": "Andres"}}::vertex | {"id": 844424930131969, "label": "BLOCKS", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge | {"id": 281474976710658, "label": "", "properties": {"age": 25, "name": "Caesar"}}::vertex - {"id": 281474976710659, "label": "", "properties": {"age": 55, "name": "Bossman"}}::vertex | {"id": 844424930131970, "label": "BLOCKS", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge | {"id": 281474976710660, "label": "", "properties": {"age": 35, "name": "David"}}::vertex - {"id": 281474976710657, "label": "", "properties": {"age": 36, "name": "Andres"}}::vertex | {"id": 1125899906842625, "label": "KNOWS", "end_id": 281474976710659, "start_id": 281474976710657, "properties": {}}::edge | {"id": 281474976710659, "label": "", "properties": {"age": 55, "name": "Bossman"}}::vertex - {"id": 281474976710658, "label": "", "properties": {"age": 25, "name": "Caesar"}}::vertex | {"id": 1125899906842626, "label": "KNOWS", "end_id": 281474976710661, "start_id": 281474976710658, "properties": {}}::edge | {"id": 281474976710661, "label": "", "properties": {"age": 37, "name": "George"}}::vertex - {"id": 281474976710659, "label": "", "properties": {"age": 55, "name": "Bossman"}}::vertex | {"id": 1125899906842627, "label": "KNOWS", "end_id": 281474976710661, "start_id": 281474976710659, "properties": {}}::edge | {"id": 281474976710661, "label": "", "properties": {"age": 37, "name": "George"}}::vertex - {"id": 281474976710660, "label": "", "properties": {"age": 35, "name": "David"}}::vertex | {"id": 1125899906842628, "label": "KNOWS", "end_id": 281474976710657, "start_id": 281474976710660, "properties": {}}::edge | {"id": 281474976710657, "label": "", "properties": {"age": 36, "name": "Andres"}}::vertex + {"id": 281474976710657, "label": [], "properties": {"age": 36, "name": "Andres"}}::vertex | {"id": 844424930131969, "label": "BLOCKS", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge | {"id": 281474976710658, "label": [], "properties": {"age": 25, "name": "Caesar"}}::vertex + {"id": 281474976710659, "label": [], "properties": {"age": 55, "name": "Bossman"}}::vertex | {"id": 844424930131970, "label": "BLOCKS", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge | {"id": 281474976710660, "label": [], "properties": {"age": 35, "name": "David"}}::vertex + {"id": 281474976710657, "label": [], "properties": {"age": 36, "name": "Andres"}}::vertex | {"id": 1125899906842625, "label": "KNOWS", "end_id": 281474976710659, "start_id": 281474976710657, "properties": {}}::edge | {"id": 281474976710659, "label": [], "properties": {"age": 55, "name": "Bossman"}}::vertex + {"id": 281474976710658, "label": [], "properties": {"age": 25, "name": "Caesar"}}::vertex | {"id": 1125899906842626, "label": "KNOWS", "end_id": 281474976710661, "start_id": 281474976710658, "properties": {}}::edge | {"id": 281474976710661, "label": [], "properties": {"age": 37, "name": "George"}}::vertex + {"id": 281474976710659, "label": [], "properties": {"age": 55, "name": "Bossman"}}::vertex | {"id": 1125899906842627, "label": "KNOWS", "end_id": 281474976710661, "start_id": 281474976710659, "properties": {}}::edge | {"id": 281474976710661, "label": [], "properties": {"age": 37, "name": "George"}}::vertex + {"id": 281474976710660, "label": [], "properties": {"age": 35, "name": "David"}}::vertex | {"id": 1125899906842628, "label": "KNOWS", "end_id": 281474976710657, "start_id": 281474976710660, "properties": {}}::edge | {"id": 281474976710657, "label": [], "properties": {"age": 36, "name": "Andres"}}::vertex (6 rows) -- WITH/AS @@ -132,14 +132,14 @@ SELECT * FROM cypher('cypher_with', $$ WHERE path_length > 1 RETURN p $$) AS (pattern agtype); - pattern --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710657, "label": "_ag_label_vertex", "properties": {"age": 36, "name": "Andres"}}::vertex, {"id": 1125899906842625, "label": "KNOWS", "end_id": 281474976710659, "start_id": 281474976710657, "properties": {}}::edge, {"id": 281474976710659, "label": "_ag_label_vertex", "properties": {"age": 55, "name": "Bossman"}}::vertex, {"id": 1125899906842627, "label": "KNOWS", "end_id": 281474976710661, "start_id": 281474976710659, "properties": {}}::edge, {"id": 281474976710661, "label": "_ag_label_vertex", "properties": {"age": 37, "name": "George"}}::vertex]::path - [{"id": 281474976710657, "label": "_ag_label_vertex", "properties": {"age": 36, "name": "Andres"}}::vertex, {"id": 1125899906842625, "label": "KNOWS", "end_id": 281474976710659, "start_id": 281474976710657, "properties": {}}::edge, {"id": 281474976710659, "label": "_ag_label_vertex", "properties": {"age": 55, "name": "Bossman"}}::vertex, {"id": 844424930131970, "label": "BLOCKS", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge, {"id": 281474976710660, "label": "_ag_label_vertex", "properties": {"age": 35, "name": "David"}}::vertex]::path - [{"id": 281474976710657, "label": "_ag_label_vertex", "properties": {"age": 36, "name": "Andres"}}::vertex, {"id": 844424930131969, "label": "BLOCKS", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge, {"id": 281474976710658, "label": "_ag_label_vertex", "properties": {"age": 25, "name": "Caesar"}}::vertex, {"id": 1125899906842626, "label": "KNOWS", "end_id": 281474976710661, "start_id": 281474976710658, "properties": {}}::edge, {"id": 281474976710661, "label": "_ag_label_vertex", "properties": {"age": 37, "name": "George"}}::vertex]::path - [{"id": 281474976710659, "label": "_ag_label_vertex", "properties": {"age": 55, "name": "Bossman"}}::vertex, {"id": 844424930131970, "label": "BLOCKS", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge, {"id": 281474976710660, "label": "_ag_label_vertex", "properties": {"age": 35, "name": "David"}}::vertex, {"id": 1125899906842628, "label": "KNOWS", "end_id": 281474976710657, "start_id": 281474976710660, "properties": {}}::edge, {"id": 281474976710657, "label": "_ag_label_vertex", "properties": {"age": 36, "name": "Andres"}}::vertex]::path - [{"id": 281474976710660, "label": "_ag_label_vertex", "properties": {"age": 35, "name": "David"}}::vertex, {"id": 1125899906842628, "label": "KNOWS", "end_id": 281474976710657, "start_id": 281474976710660, "properties": {}}::edge, {"id": 281474976710657, "label": "_ag_label_vertex", "properties": {"age": 36, "name": "Andres"}}::vertex, {"id": 1125899906842625, "label": "KNOWS", "end_id": 281474976710659, "start_id": 281474976710657, "properties": {}}::edge, {"id": 281474976710659, "label": "_ag_label_vertex", "properties": {"age": 55, "name": "Bossman"}}::vertex]::path - [{"id": 281474976710660, "label": "_ag_label_vertex", "properties": {"age": 35, "name": "David"}}::vertex, {"id": 1125899906842628, "label": "KNOWS", "end_id": 281474976710657, "start_id": 281474976710660, "properties": {}}::edge, {"id": 281474976710657, "label": "_ag_label_vertex", "properties": {"age": 36, "name": "Andres"}}::vertex, {"id": 844424930131969, "label": "BLOCKS", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge, {"id": 281474976710658, "label": "_ag_label_vertex", "properties": {"age": 25, "name": "Caesar"}}::vertex]::path + pattern +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 281474976710657, "label": [], "properties": {"age": 36, "name": "Andres"}}::vertex, {"id": 1125899906842625, "label": "KNOWS", "end_id": 281474976710659, "start_id": 281474976710657, "properties": {}}::edge, {"id": 281474976710659, "label": [], "properties": {"age": 55, "name": "Bossman"}}::vertex, {"id": 1125899906842627, "label": "KNOWS", "end_id": 281474976710661, "start_id": 281474976710659, "properties": {}}::edge, {"id": 281474976710661, "label": [], "properties": {"age": 37, "name": "George"}}::vertex]::path + [{"id": 281474976710657, "label": [], "properties": {"age": 36, "name": "Andres"}}::vertex, {"id": 1125899906842625, "label": "KNOWS", "end_id": 281474976710659, "start_id": 281474976710657, "properties": {}}::edge, {"id": 281474976710659, "label": [], "properties": {"age": 55, "name": "Bossman"}}::vertex, {"id": 844424930131970, "label": "BLOCKS", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge, {"id": 281474976710660, "label": [], "properties": {"age": 35, "name": "David"}}::vertex]::path + [{"id": 281474976710657, "label": [], "properties": {"age": 36, "name": "Andres"}}::vertex, {"id": 844424930131969, "label": "BLOCKS", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge, {"id": 281474976710658, "label": [], "properties": {"age": 25, "name": "Caesar"}}::vertex, {"id": 1125899906842626, "label": "KNOWS", "end_id": 281474976710661, "start_id": 281474976710658, "properties": {}}::edge, {"id": 281474976710661, "label": [], "properties": {"age": 37, "name": "George"}}::vertex]::path + [{"id": 281474976710659, "label": [], "properties": {"age": 55, "name": "Bossman"}}::vertex, {"id": 844424930131970, "label": "BLOCKS", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge, {"id": 281474976710660, "label": [], "properties": {"age": 35, "name": "David"}}::vertex, {"id": 1125899906842628, "label": "KNOWS", "end_id": 281474976710657, "start_id": 281474976710660, "properties": {}}::edge, {"id": 281474976710657, "label": [], "properties": {"age": 36, "name": "Andres"}}::vertex]::path + [{"id": 281474976710660, "label": [], "properties": {"age": 35, "name": "David"}}::vertex, {"id": 1125899906842628, "label": "KNOWS", "end_id": 281474976710657, "start_id": 281474976710660, "properties": {}}::edge, {"id": 281474976710657, "label": [], "properties": {"age": 36, "name": "Andres"}}::vertex, {"id": 1125899906842625, "label": "KNOWS", "end_id": 281474976710659, "start_id": 281474976710657, "properties": {}}::edge, {"id": 281474976710659, "label": [], "properties": {"age": 55, "name": "Bossman"}}::vertex]::path + [{"id": 281474976710660, "label": [], "properties": {"age": 35, "name": "David"}}::vertex, {"id": 1125899906842628, "label": "KNOWS", "end_id": 281474976710657, "start_id": 281474976710660, "properties": {}}::edge, {"id": 281474976710657, "label": [], "properties": {"age": 36, "name": "Andres"}}::vertex, {"id": 844424930131969, "label": "BLOCKS", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge, {"id": 281474976710658, "label": [], "properties": {"age": 25, "name": "Caesar"}}::vertex]::path (6 rows) -- MATCH/WHERE with WITH/WHERE @@ -164,11 +164,11 @@ SELECT * FROM cypher('cypher_with', $$ $$) as (name agtype); name -------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"age": 36, "name": "Andres"}}::vertex - {"id": 281474976710658, "label": "", "properties": {"age": 25, "name": "Caesar"}}::vertex - {"id": 281474976710659, "label": "", "properties": {"age": 55, "name": "Bossman"}}::vertex - {"id": 281474976710660, "label": "", "properties": {"age": 35, "name": "David"}}::vertex - {"id": 281474976710661, "label": "", "properties": {"age": 37, "name": "George"}}::vertex + {"id": 281474976710657, "label": [], "properties": {"age": 36, "name": "Andres"}}::vertex + {"id": 281474976710658, "label": [], "properties": {"age": 25, "name": "Caesar"}}::vertex + {"id": 281474976710659, "label": [], "properties": {"age": 55, "name": "Bossman"}}::vertex + {"id": 281474976710660, "label": [], "properties": {"age": 35, "name": "David"}}::vertex + {"id": 281474976710661, "label": [], "properties": {"age": 37, "name": "George"}}::vertex (5 rows) -- WITH/ORDER BY/DESC @@ -303,9 +303,9 @@ SELECT * FROM cypher('graph', $$ CREATE (a:A)-[:incs]->(:C), (a)-[:incs]->(:C) RETURN a $$) AS (n agtype); - n ------------------------------------------------------------------ - {"id": 844424930131969, "label": "A", "properties": {}}::vertex + n +------------------------------------------------------------------- + {"id": 844424930131969, "label": ["A"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('graph', $$ diff --git a/regress/expected/expr.out b/regress/expected/expr.out index 1922039a8..13e9a1d56 100644 --- a/regress/expected/expr.out +++ b/regress/expected/expr.out @@ -741,44 +741,44 @@ SELECT * FROM cypher('chained', $$ CREATE (:people {name: "David", age:15}) $$) -- should return 1 SELECT * FROM cypher('chained', $$ MATCH (u:people) WHERE 35 < u.age <= 49 RETURN u $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------ - {"id": 844424930131972, "label": "people", "properties": {"age": 40, "name": "Mark"}}::vertex + result +------------------------------------------------------------------------------------------------- + {"id": 844424930131972, "label": ["people"], "properties": {"age": 40, "name": "Mark"}}::vertex (1 row) SELECT * FROM cypher('chained', $$ MATCH (u:people) WHERE 25 <= u.age <= 25 RETURN u $$) AS (result agtype); - result ----------------------------------------------------------------------------------------------- - {"id": 844424930131970, "label": "people", "properties": {"age": 25, "name": "Amy"}}::vertex + result +------------------------------------------------------------------------------------------------ + {"id": 844424930131970, "label": ["people"], "properties": {"age": 25, "name": "Amy"}}::vertex (1 row) SELECT * FROM cypher('chained', $$ MATCH (u:people) WHERE 35 = u.age = 35 RETURN u $$) AS (result agtype); - result ---------------------------------------------------------------------------------------------------- - {"id": 844424930131971, "label": "people", "properties": {"age": 35, "name": "Samantha"}}::vertex + result +----------------------------------------------------------------------------------------------------- + {"id": 844424930131971, "label": ["people"], "properties": {"age": 35, "name": "Samantha"}}::vertex (1 row) SELECT * FROM cypher('chained', $$ MATCH (u:people) WHERE 50 > u.age > 35 RETURN u $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------ - {"id": 844424930131972, "label": "people", "properties": {"age": 40, "name": "Mark"}}::vertex + result +------------------------------------------------------------------------------------------------- + {"id": 844424930131972, "label": ["people"], "properties": {"age": 40, "name": "Mark"}}::vertex (1 row) -- should return 3 SELECT * FROM cypher('chained', $$ MATCH (u:people) WHERE 40 <> u.age <> 35 RETURN u $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "people", "properties": {"age": 50, "name": "Jason"}}::vertex - {"id": 844424930131970, "label": "people", "properties": {"age": 25, "name": "Amy"}}::vertex - {"id": 844424930131973, "label": "people", "properties": {"age": 15, "name": "David"}}::vertex + result +-------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["people"], "properties": {"age": 50, "name": "Jason"}}::vertex + {"id": 844424930131970, "label": ["people"], "properties": {"age": 25, "name": "Amy"}}::vertex + {"id": 844424930131973, "label": ["people"], "properties": {"age": 15, "name": "David"}}::vertex (3 rows) -- should return 2 SELECT * FROM cypher('chained', $$ MATCH (u:people) WHERE 30 <= u.age <= 49 > u.age RETURN u $$) AS (result agtype); - result ---------------------------------------------------------------------------------------------------- - {"id": 844424930131971, "label": "people", "properties": {"age": 35, "name": "Samantha"}}::vertex - {"id": 844424930131972, "label": "people", "properties": {"age": 40, "name": "Mark"}}::vertex + result +----------------------------------------------------------------------------------------------------- + {"id": 844424930131971, "label": ["people"], "properties": {"age": 35, "name": "Samantha"}}::vertex + {"id": 844424930131972, "label": ["people"], "properties": {"age": 40, "name": "Mark"}}::vertex (2 rows) -- should return 0 @@ -789,19 +789,19 @@ SELECT * FROM cypher('chained', $$ MATCH (u:people) WHERE 30 <= u.age <= 49 = u. -- should return 2 SELECT * FROM cypher('chained', $$ MATCH (u:people) WHERE 35 < u.age + 1 <= 50 RETURN u $$) AS (result agtype); - result ---------------------------------------------------------------------------------------------------- - {"id": 844424930131971, "label": "people", "properties": {"age": 35, "name": "Samantha"}}::vertex - {"id": 844424930131972, "label": "people", "properties": {"age": 40, "name": "Mark"}}::vertex + result +----------------------------------------------------------------------------------------------------- + {"id": 844424930131971, "label": ["people"], "properties": {"age": 35, "name": "Samantha"}}::vertex + {"id": 844424930131972, "label": ["people"], "properties": {"age": 40, "name": "Mark"}}::vertex (2 rows) -- should return 3 SELECT * FROM cypher('chained', $$ MATCH (u:people) WHERE NOT 35 < u.age + 1 <= 50 RETURN u $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "people", "properties": {"age": 50, "name": "Jason"}}::vertex - {"id": 844424930131970, "label": "people", "properties": {"age": 25, "name": "Amy"}}::vertex - {"id": 844424930131973, "label": "people", "properties": {"age": 15, "name": "David"}}::vertex + result +-------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["people"], "properties": {"age": 50, "name": "Jason"}}::vertex + {"id": 844424930131970, "label": ["people"], "properties": {"age": 25, "name": "Amy"}}::vertex + {"id": 844424930131973, "label": ["people"], "properties": {"age": 15, "name": "David"}}::vertex (3 rows) -- order of operations @@ -868,9 +868,9 @@ SELECT * FROM cypher('chained', $$ RETURN ((1 = (1 = 1)) = 1) = 1 $$) AS (result -- in clause SELECT * FROM cypher('chained', $$ MATCH (u:people) WHERE 35 = u.age = 35 RETURN u $$) AS (result agtype); - result ---------------------------------------------------------------------------------------------------- - {"id": 844424930131971, "label": "people", "properties": {"age": 35, "name": "Samantha"}}::vertex + result +----------------------------------------------------------------------------------------------------- + {"id": 844424930131971, "label": ["people"], "properties": {"age": 35, "name": "Samantha"}}::vertex (1 row) SELECT * FROM cypher('chained', $$ MATCH (u:people) WHERE (35 = u.age) = 35 RETURN u $$) AS (result agtype); @@ -884,13 +884,13 @@ SELECT * FROM cypher('chained', $$ MATCH (u:people) WHERE (35 = 35) = u.age RET (0 rows) SELECT * FROM cypher('chained', $$ MATCH (u:people) WHERE u.age = u.age = u.age RETURN u $$) AS (result agtype); - result ---------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "people", "properties": {"age": 50, "name": "Jason"}}::vertex - {"id": 844424930131970, "label": "people", "properties": {"age": 25, "name": "Amy"}}::vertex - {"id": 844424930131971, "label": "people", "properties": {"age": 35, "name": "Samantha"}}::vertex - {"id": 844424930131972, "label": "people", "properties": {"age": 40, "name": "Mark"}}::vertex - {"id": 844424930131973, "label": "people", "properties": {"age": 15, "name": "David"}}::vertex + result +----------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["people"], "properties": {"age": 50, "name": "Jason"}}::vertex + {"id": 844424930131970, "label": ["people"], "properties": {"age": 25, "name": "Amy"}}::vertex + {"id": 844424930131971, "label": ["people"], "properties": {"age": 35, "name": "Samantha"}}::vertex + {"id": 844424930131972, "label": ["people"], "properties": {"age": 40, "name": "Mark"}}::vertex + {"id": 844424930131973, "label": ["people"], "properties": {"age": 15, "name": "David"}}::vertex (5 rows) SELECT * FROM cypher('chained', $$ MATCH (u:people) WHERE (u.age = u.age) = u.age RETURN u $$) AS (result agtype); @@ -904,13 +904,13 @@ SELECT * FROM cypher('chained', $$ MATCH (u:people) WHERE u.age = (u.age = u.age (0 rows) SELECT * FROM cypher('chained', $$ MATCH (u:people) WHERE (u.age = u.age) = (u.age = u.age) RETURN u $$) AS (result agtype); - result ---------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "people", "properties": {"age": 50, "name": "Jason"}}::vertex - {"id": 844424930131970, "label": "people", "properties": {"age": 25, "name": "Amy"}}::vertex - {"id": 844424930131971, "label": "people", "properties": {"age": 35, "name": "Samantha"}}::vertex - {"id": 844424930131972, "label": "people", "properties": {"age": 40, "name": "Mark"}}::vertex - {"id": 844424930131973, "label": "people", "properties": {"age": 15, "name": "David"}}::vertex + result +----------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["people"], "properties": {"age": 50, "name": "Jason"}}::vertex + {"id": 844424930131970, "label": ["people"], "properties": {"age": 25, "name": "Amy"}}::vertex + {"id": 844424930131971, "label": ["people"], "properties": {"age": 35, "name": "Samantha"}}::vertex + {"id": 844424930131972, "label": ["people"], "properties": {"age": 40, "name": "Mark"}}::vertex + {"id": 844424930131973, "label": ["people"], "properties": {"age": 15, "name": "David"}}::vertex (5 rows) SELECT * FROM cypher('chained', $$ MATCH (u:people) WHERE u.age = (u.age = (u.age = u.age)) RETURN u $$) AS (result agtype); @@ -924,13 +924,13 @@ SELECT * FROM cypher('chained', $$ MATCH (u:people) WHERE u.age = 35 = ((u.age = (0 rows) SELECT * FROM cypher('chained', $$ MATCH (u:people) WHERE ((u.age = u.age) = (u.age = u.age)) = (u.age = u.age) RETURN u $$) AS (result agtype); - result ---------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "people", "properties": {"age": 50, "name": "Jason"}}::vertex - {"id": 844424930131970, "label": "people", "properties": {"age": 25, "name": "Amy"}}::vertex - {"id": 844424930131971, "label": "people", "properties": {"age": 35, "name": "Samantha"}}::vertex - {"id": 844424930131972, "label": "people", "properties": {"age": 40, "name": "Mark"}}::vertex - {"id": 844424930131973, "label": "people", "properties": {"age": 15, "name": "David"}}::vertex + result +----------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["people"], "properties": {"age": 50, "name": "Jason"}}::vertex + {"id": 844424930131970, "label": ["people"], "properties": {"age": 25, "name": "Amy"}}::vertex + {"id": 844424930131971, "label": ["people"], "properties": {"age": 35, "name": "Samantha"}}::vertex + {"id": 844424930131972, "label": ["people"], "properties": {"age": 40, "name": "Mark"}}::vertex + {"id": 844424930131973, "label": ["people"], "properties": {"age": 15, "name": "David"}}::vertex (5 rows) -- @@ -1324,25 +1324,25 @@ NOTICE: graph "regex" has been created SELECT * FROM cypher('regex', $$ CREATE (n:Person {name: 'John'}) RETURN n $$) AS r(result agtype); - result ------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "Person", "properties": {"name": "John"}}::vertex + result +-------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["Person"], "properties": {"name": "John"}}::vertex (1 row) SELECT * FROM cypher('regex', $$ CREATE (n:Person {name: 'Jeff'}) RETURN n $$) AS r(result agtype); - result ------------------------------------------------------------------------------------- - {"id": 844424930131970, "label": "Person", "properties": {"name": "Jeff"}}::vertex + result +-------------------------------------------------------------------------------------- + {"id": 844424930131970, "label": ["Person"], "properties": {"name": "Jeff"}}::vertex (1 row) SELECT * FROM cypher('regex', $$ CREATE (n:Person {name: 'Joan'}) RETURN n $$) AS r(result agtype); - result ------------------------------------------------------------------------------------- - {"id": 844424930131971, "label": "Person", "properties": {"name": "Joan"}}::vertex + result +-------------------------------------------------------------------------------------- + {"id": 844424930131971, "label": ["Person"], "properties": {"name": "Joan"}}::vertex (1 row) SELECT * FROM cypher('regex', $$ @@ -1355,28 +1355,28 @@ $$) AS r(result agtype); SELECT * FROM cypher('regex', $$ MATCH (n:Person) WHERE n.name =~ '(?i)JoHn' RETURN n $$) AS r(result agtype); - result ------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "Person", "properties": {"name": "John"}}::vertex + result +-------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["Person"], "properties": {"name": "John"}}::vertex (1 row) SELECT * FROM cypher('regex', $$ MATCH (n:Person) WHERE n.name =~ 'Jo.n' RETURN n $$) AS r(result agtype); - result ------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "Person", "properties": {"name": "John"}}::vertex - {"id": 844424930131971, "label": "Person", "properties": {"name": "Joan"}}::vertex + result +-------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["Person"], "properties": {"name": "John"}}::vertex + {"id": 844424930131971, "label": ["Person"], "properties": {"name": "Joan"}}::vertex (2 rows) SELECT * FROM cypher('regex', $$ MATCH (n:Person) WHERE n.name =~ 'J.*' RETURN n $$) AS r(result agtype); - result ------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "Person", "properties": {"name": "John"}}::vertex - {"id": 844424930131970, "label": "Person", "properties": {"name": "Jeff"}}::vertex - {"id": 844424930131971, "label": "Person", "properties": {"name": "Joan"}}::vertex + result +-------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["Person"], "properties": {"name": "John"}}::vertex + {"id": 844424930131970, "label": ["Person"], "properties": {"name": "Jeff"}}::vertex + {"id": 844424930131971, "label": ["Person"], "properties": {"name": "Joan"}}::vertex (3 rows) -- @@ -2187,25 +2187,25 @@ ERROR: invalid input syntax for type double precision: "infi" SELECT * FROM cypher('expr', $$ RETURN {id:0, label:"vertex 0", properties:{}}::vertex $$) AS r(result agtype); - result ----------------------------------------------------------- - {"id": 0, "label": "vertex 0", "properties": {}}::vertex + result +------------------------------------------------------------ + {"id": 0, "label": ["vertex 0"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('expr', $$ RETURN {vertex_0:{id:0, label:"vertex 0", properties:{}}::vertex} $$) AS r(result agtype); - result ------------------------------------------------------------------------- - {"vertex_0": {"id": 0, "label": "vertex 0", "properties": {}}::vertex} + result +-------------------------------------------------------------------------- + {"vertex_0": {"id": 0, "label": ["vertex 0"], "properties": {}}::vertex} (1 row) SELECT * FROM cypher('expr', $$ RETURN {name:"container 0", vertices:[{vertex_0:{id:0, label:"vertex 0", properties:{}}::vertex}, {vertex_0:{id:0, label:"vertex 0", properties:{}}::vertex}]} $$) AS r(result agtype); - result ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"name": "container 0", "vertices": [{"vertex_0": {"id": 0, "label": "vertex 0", "properties": {}}::vertex}, {"vertex_0": {"id": 0, "label": "vertex 0", "properties": {}}::vertex}]} + result +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"name": "container 0", "vertices": [{"vertex_0": {"id": 0, "label": ["vertex 0"], "properties": {}}::vertex}, {"vertex_0": {"id": 0, "label": ["vertex 0"], "properties": {}}::vertex}]} (1 row) SELECT * FROM cypher('expr', $$ @@ -2244,9 +2244,9 @@ $$) AS r(result agtype); SELECT * FROM cypher('expr', $$ RETURN {name:"path 1", path:[{id:0, label:"vertex 0", properties:{}}::vertex, {id:2, label:"edge 0", properties:{}, start_id:0, end_id:1}::edge, {id:1, label:"vertex 1", properties:{}}::vertex]} $$) AS r(result agtype); - result ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"name": "path 1", "path": [{"id": 0, "label": "vertex 0", "properties": {}}::vertex, {"id": 2, "label": "edge 0", "end_id": 1, "start_id": 0, "properties": {}}::edge, {"id": 1, "label": "vertex 1", "properties": {}}::vertex]} + result +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"name": "path 1", "path": [{"id": 0, "label": ["vertex 0"], "properties": {}}::vertex, {"id": 2, "label": "edge 0", "end_id": 1, "start_id": 0, "properties": {}}::edge, {"id": 1, "label": ["vertex 1"], "properties": {}}::vertex]} (1 row) -- should return null @@ -2334,9 +2334,9 @@ $$) AS r(result agtype); ERROR: typecast object is not an edge -- make sure that output can be read back in and reproduce the output SELECT agtype_in('{"name": "container 0", "vertices": [{"vertex_0": {"id": 0, "label": "vertex 0", "properties": {}}::vertex}, {"vertex_0": {"id": 0, "label": "vertex 0", "properties": {}}::vertex}]}'); - agtype_in ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"name": "container 0", "vertices": [{"vertex_0": {"id": 0, "label": "vertex 0", "properties": {}}::vertex}, {"vertex_0": {"id": 0, "label": "vertex 0", "properties": {}}::vertex}]} + agtype_in +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"name": "container 0", "vertices": [{"vertex_0": {"id": 0, "label": ["vertex 0"], "properties": {}}::vertex}, {"vertex_0": {"id": 0, "label": ["vertex 0"], "properties": {}}::vertex}]} (1 row) SELECT agtype_in('{"name": "container 1", "edges": [{"id": 3, "label": "edge 0", "end_id": 1, "start_id": 0, "properties": {}}::edge, {"id": 4, "label": "edge 1", "end_id": 0, "start_id": 1, "properties": {}}::edge]}'); @@ -2346,47 +2346,47 @@ SELECT agtype_in('{"name": "container 1", "edges": [{"id": 3, "label": "edge 0", (1 row) SELECT agtype_in('{"name": "path 1", "path": [{"id": 0, "label": "vertex 0", "properties": {}}::vertex, {"id": 2, "label": "edge 0", "end_id": 1, "start_id": 0, "properties": {}}::edge, {"id": 1, "label": "vertex 1", "properties": {}}::vertex]}'); - agtype_in ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"name": "path 1", "path": [{"id": 0, "label": "vertex 0", "properties": {}}::vertex, {"id": 2, "label": "edge 0", "end_id": 1, "start_id": 0, "properties": {}}::edge, {"id": 1, "label": "vertex 1", "properties": {}}::vertex]} + agtype_in +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"name": "path 1", "path": [{"id": 0, "label": ["vertex 0"], "properties": {}}::vertex, {"id": 2, "label": "edge 0", "end_id": 1, "start_id": 0, "properties": {}}::edge, {"id": 1, "label": ["vertex 1"], "properties": {}}::vertex]} (1 row) -- typecast to path SELECT agtype_in('[{"id": 0, "label": "vertex 0", "properties": {}}::vertex, {"id": 2, "label": "edge 0", "end_id": 1, "start_id": 0, "properties": {}}::edge, {"id": 1, "label": "vertex 1", "properties": {}}::vertex]::path'); - agtype_in --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 0, "label": "vertex 0", "properties": {}}::vertex, {"id": 2, "label": "edge 0", "end_id": 1, "start_id": 0, "properties": {}}::edge, {"id": 1, "label": "vertex 1", "properties": {}}::vertex]::path + agtype_in +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + [{"id": 0, "label": ["vertex 0"], "properties": {}}::vertex, {"id": 2, "label": "edge 0", "end_id": 1, "start_id": 0, "properties": {}}::edge, {"id": 1, "label": ["vertex 1"], "properties": {}}::vertex]::path (1 row) SELECT agtype_in('{"Path" : [{"id": 0, "label": "vertex 0", "properties": {}}::vertex, {"id": 2, "label": "edge 0", "end_id": 1, "start_id": 0, "properties": {}}::edge, {"id": 1, "label": "vertex 1", "properties": {}}::vertex]::path}'); - agtype_in ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"Path": [{"id": 0, "label": "vertex 0", "properties": {}}::vertex, {"id": 2, "label": "edge 0", "end_id": 1, "start_id": 0, "properties": {}}::edge, {"id": 1, "label": "vertex 1", "properties": {}}::vertex]::path} + agtype_in +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"Path": [{"id": 0, "label": ["vertex 0"], "properties": {}}::vertex, {"id": 2, "label": "edge 0", "end_id": 1, "start_id": 0, "properties": {}}::edge, {"id": 1, "label": ["vertex 1"], "properties": {}}::vertex]::path} (1 row) SELECT * FROM cypher('expr', $$ RETURN [{id: 0, label: "vertex 0", properties: {}}::vertex, {id: 2, label: "edge 0", end_id: 1, start_id: 0, properties: {}}::edge, {id: 1, label: "vertex 1", properties: {}}::vertex]::path $$) AS r(result agtype); - result --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 0, "label": "vertex 0", "properties": {}}::vertex, {"id": 2, "label": "edge 0", "end_id": 1, "start_id": 0, "properties": {}}::edge, {"id": 1, "label": "vertex 1", "properties": {}}::vertex]::path + result +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + [{"id": 0, "label": ["vertex 0"], "properties": {}}::vertex, {"id": 2, "label": "edge 0", "end_id": 1, "start_id": 0, "properties": {}}::edge, {"id": 1, "label": ["vertex 1"], "properties": {}}::vertex]::path (1 row) SELECT * FROM cypher('expr', $$ RETURN {path : [{id: 0, label: "vertex 0", properties: {}}::vertex, {id: 2, label: "edge 0", end_id: 1, start_id: 0, properties: {}}::edge, {id: 1, label: "vertex 1", properties: {}}::vertex]::path} $$) AS r(result agtype); - result ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"path": [{"id": 0, "label": "vertex 0", "properties": {}}::vertex, {"id": 2, "label": "edge 0", "end_id": 1, "start_id": 0, "properties": {}}::edge, {"id": 1, "label": "vertex 1", "properties": {}}::vertex]::path} + result +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"path": [{"id": 0, "label": ["vertex 0"], "properties": {}}::vertex, {"id": 2, "label": "edge 0", "end_id": 1, "start_id": 0, "properties": {}}::edge, {"id": 1, "label": ["vertex 1"], "properties": {}}::vertex]::path} (1 row) -- verify that the output can be input SELECT agtype_in('[{"id": 0, "label": "vertex 0", "properties": {}}::vertex, {"id": 2, "label": "edge 0", "end_id": 1, "start_id": 0, "properties": {}}::edge, {"id": 1, "label": "vertex 1", "properties": {}}::vertex]::path'); - agtype_in --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 0, "label": "vertex 0", "properties": {}}::vertex, {"id": 2, "label": "edge 0", "end_id": 1, "start_id": 0, "properties": {}}::edge, {"id": 1, "label": "vertex 1", "properties": {}}::vertex]::path + agtype_in +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + [{"id": 0, "label": ["vertex 0"], "properties": {}}::vertex, {"id": 2, "label": "edge 0", "end_id": 1, "start_id": 0, "properties": {}}::edge, {"id": 1, "label": ["vertex 1"], "properties": {}}::vertex]::path (1 row) SELECT agtype_in('{"path": [{"id": 0, "label": "vertex 0", "properties": {}}::vertex, {"id": 2, "label": "edge 0", "end_id": 1, "start_id": 0, "properties": {}}::edge, {"id": 1, "label": "vertex 1", "properties": {}}::vertex]::path}'); - agtype_in ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"path": [{"id": 0, "label": "vertex 0", "properties": {}}::vertex, {"id": 2, "label": "edge 0", "end_id": 1, "start_id": 0, "properties": {}}::edge, {"id": 1, "label": "vertex 1", "properties": {}}::vertex]::path} + agtype_in +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"path": [{"id": 0, "label": ["vertex 0"], "properties": {}}::vertex, {"id": 2, "label": "edge 0", "end_id": 1, "start_id": 0, "properties": {}}::edge, {"id": 1, "label": ["vertex 1"], "properties": {}}::vertex]::path} (1 row) -- invalid paths should fail @@ -2631,14 +2631,14 @@ $$) AS (a agtype); -- show them SELECT * FROM cypher('expr', $$ MATCH (v) RETURN v $$) AS (expression agtype); - expression ----------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "v", "properties": {}}::vertex - {"id": 844424930131970, "label": "v", "properties": {"i": 0}}::vertex - {"id": 844424930131971, "label": "v", "properties": {"i": 1}}::vertex - {"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex - {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex - {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex + expression +------------------------------------------------------------------------------------ + {"id": 844424930131969, "label": ["v"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["v"], "properties": {"i": 0}}::vertex + {"id": 844424930131971, "label": ["v"], "properties": {"i": 1}}::vertex + {"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex + {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex + {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex (6 rows) SELECT * FROM cypher('expr', $$ MATCH ()-[e]-() RETURN e $$) AS (expression agtype); @@ -2762,12 +2762,12 @@ HINT: No function matches the given name and argument types. You might need to SELECT * FROM cypher('expr', $$ MATCH ()-[e]-() RETURN id(e), start_id(e), startNode(e) $$) AS (id agtype, start_id agtype, startNode agtype); - id | start_id | startnode -------------------+------------------+---------------------------------------------------------------------------------- - 1407374883553281 | 1125899906842626 | {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex - 1407374883553281 | 1125899906842626 | {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex - 1407374883553282 | 1125899906842625 | {"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex - 1407374883553282 | 1125899906842625 | {"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex + id | start_id | startnode +------------------+------------------+------------------------------------------------------------------------------------ + 1407374883553281 | 1125899906842626 | {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex + 1407374883553281 | 1125899906842626 | {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex + 1407374883553282 | 1125899906842625 | {"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex + 1407374883553282 | 1125899906842625 | {"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex (4 rows) -- should return null @@ -2795,12 +2795,12 @@ HINT: No function matches the given name and argument types. You might need to SELECT * FROM cypher('expr', $$ MATCH ()-[e]-() RETURN id(e), end_id(e), endNode(e) $$) AS (id agtype, end_id agtype, endNode agtype); - id | end_id | endnode -------------------+------------------+--------------------------------------------------------------------------------- - 1407374883553281 | 1125899906842627 | {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex - 1407374883553281 | 1125899906842627 | {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex - 1407374883553282 | 1125899906842626 | {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex - 1407374883553282 | 1125899906842626 | {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex + id | end_id | endnode +------------------+------------------+----------------------------------------------------------------------------------- + 1407374883553281 | 1125899906842627 | {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex + 1407374883553281 | 1125899906842627 | {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex + 1407374883553282 | 1125899906842626 | {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex + 1407374883553282 | 1125899906842626 | {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex (4 rows) -- should return null @@ -2861,14 +2861,14 @@ HINT: No function matches the given name and argument types. You might need to SELECT * FROM cypher('expr', $$ MATCH (v) RETURN label(v) $$) AS (label agtype); - label -------- - "v" - "v" - "v" - "v1" - "v1" - "v1" + label +-------- + ["v"] + ["v"] + ["v"] + ["v1"] + ["v1"] + ["v1"] (6 rows) SELECT * FROM cypher('expr', $$ @@ -2883,9 +2883,9 @@ $$) AS (label agtype); SELECT * FROM cypher('expr', $$ RETURN label({id: 0, label: 'typecast', properties: {}}::vertex) $$) AS (label agtype); - label ------------- - "typecast" + label +-------------- + ["typecast"] (1 row) -- return NULL @@ -6151,15 +6151,15 @@ SELECT * FROM cypher('UCSC', $$CREATE (:students {name: "Jessica", gpa: 3.9::num (0 rows) SELECT * FROM cypher('UCSC', $$ MATCH (u) RETURN (u) $$) AS (vertex agtype); - vertex ------------------------------------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "students", "properties": {"age": 21, "gpa": 3.0, "zip": 94110, "name": "Jack"}}::vertex - {"id": 844424930131970, "label": "students", "properties": {"age": 27, "gpa": 3.5, "zip": 95060, "name": "Jill"}}::vertex - {"id": 844424930131971, "label": "students", "properties": {"age": 32, "gpa": 3.75, "zip": 96062, "name": "Jim"}}::vertex - {"id": 844424930131972, "label": "students", "properties": {"age": 24, "gpa": 2.5, "zip": "95060", "name": "Rick"}}::vertex - {"id": 844424930131973, "label": "students", "properties": {"age": 23, "gpa": 3.8::numeric, "name": "Ann"}}::vertex - {"id": 844424930131974, "label": "students", "properties": {"age": 19, "gpa": 4.0, "zip": 90210, "name": "Derek"}}::vertex - {"id": 844424930131975, "label": "students", "properties": {"age": 20, "gpa": 3.9::numeric, "name": "Jessica"}}::vertex + vertex +------------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["students"], "properties": {"age": 21, "gpa": 3.0, "zip": 94110, "name": "Jack"}}::vertex + {"id": 844424930131970, "label": ["students"], "properties": {"age": 27, "gpa": 3.5, "zip": 95060, "name": "Jill"}}::vertex + {"id": 844424930131971, "label": ["students"], "properties": {"age": 32, "gpa": 3.75, "zip": 96062, "name": "Jim"}}::vertex + {"id": 844424930131972, "label": ["students"], "properties": {"age": 24, "gpa": 2.5, "zip": "95060", "name": "Rick"}}::vertex + {"id": 844424930131973, "label": ["students"], "properties": {"age": 23, "gpa": 3.8::numeric, "name": "Ann"}}::vertex + {"id": 844424930131974, "label": ["students"], "properties": {"age": 19, "gpa": 4.0, "zip": 90210, "name": "Derek"}}::vertex + {"id": 844424930131975, "label": ["students"], "properties": {"age": 20, "gpa": 3.9::numeric, "name": "Jessica"}}::vertex (7 rows) SELECT * FROM cypher('UCSC', $$ MATCH (u) RETURN avg(u.gpa), sum(u.gpa), sum(u.gpa)/count(u.gpa), count(u.gpa), count(*) $$) @@ -6181,17 +6181,17 @@ SELECT * FROM cypher('UCSC', $$CREATE (:students {name: "Mike", age: 18})$$) AS (0 rows) SELECT * FROM cypher('UCSC', $$ MATCH (u) RETURN (u) $$) AS (vertex agtype); - vertex ------------------------------------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "students", "properties": {"age": 21, "gpa": 3.0, "zip": 94110, "name": "Jack"}}::vertex - {"id": 844424930131970, "label": "students", "properties": {"age": 27, "gpa": 3.5, "zip": 95060, "name": "Jill"}}::vertex - {"id": 844424930131971, "label": "students", "properties": {"age": 32, "gpa": 3.75, "zip": 96062, "name": "Jim"}}::vertex - {"id": 844424930131972, "label": "students", "properties": {"age": 24, "gpa": 2.5, "zip": "95060", "name": "Rick"}}::vertex - {"id": 844424930131973, "label": "students", "properties": {"age": 23, "gpa": 3.8::numeric, "name": "Ann"}}::vertex - {"id": 844424930131974, "label": "students", "properties": {"age": 19, "gpa": 4.0, "zip": 90210, "name": "Derek"}}::vertex - {"id": 844424930131975, "label": "students", "properties": {"age": 20, "gpa": 3.9::numeric, "name": "Jessica"}}::vertex - {"id": 844424930131976, "label": "students", "properties": {"age": 24, "name": "Dave"}}::vertex - {"id": 844424930131977, "label": "students", "properties": {"age": 18, "name": "Mike"}}::vertex + vertex +------------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["students"], "properties": {"age": 21, "gpa": 3.0, "zip": 94110, "name": "Jack"}}::vertex + {"id": 844424930131970, "label": ["students"], "properties": {"age": 27, "gpa": 3.5, "zip": 95060, "name": "Jill"}}::vertex + {"id": 844424930131971, "label": ["students"], "properties": {"age": 32, "gpa": 3.75, "zip": 96062, "name": "Jim"}}::vertex + {"id": 844424930131972, "label": ["students"], "properties": {"age": 24, "gpa": 2.5, "zip": "95060", "name": "Rick"}}::vertex + {"id": 844424930131973, "label": ["students"], "properties": {"age": 23, "gpa": 3.8::numeric, "name": "Ann"}}::vertex + {"id": 844424930131974, "label": ["students"], "properties": {"age": 19, "gpa": 4.0, "zip": 90210, "name": "Derek"}}::vertex + {"id": 844424930131975, "label": ["students"], "properties": {"age": 20, "gpa": 3.9::numeric, "name": "Jessica"}}::vertex + {"id": 844424930131976, "label": ["students"], "properties": {"age": 24, "name": "Dave"}}::vertex + {"id": 844424930131977, "label": ["students"], "properties": {"age": 18, "name": "Mike"}}::vertex (9 rows) SELECT * FROM cypher('UCSC', $$ MATCH (u) RETURN avg(u.gpa), sum(u.gpa), sum(u.gpa)/count(u.gpa), count(u.gpa), count(*) $$) @@ -6486,18 +6486,18 @@ AS (a agtype); (0 rows) SELECT * FROM cypher('UCSC', $$ MATCH (u) RETURN (u) $$) AS (vertex agtype); - vertex ------------------------------------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "students", "properties": {"age": 21, "gpa": 3.0, "zip": 94110, "name": "Jack"}}::vertex - {"id": 844424930131970, "label": "students", "properties": {"age": 27, "gpa": 3.5, "zip": 95060, "name": "Jill"}}::vertex - {"id": 844424930131971, "label": "students", "properties": {"age": 32, "gpa": 3.75, "zip": 96062, "name": "Jim"}}::vertex - {"id": 844424930131972, "label": "students", "properties": {"age": 24, "gpa": 2.5, "zip": "95060", "name": "Rick"}}::vertex - {"id": 844424930131973, "label": "students", "properties": {"age": 23, "gpa": 3.8::numeric, "name": "Ann"}}::vertex - {"id": 844424930131974, "label": "students", "properties": {"age": 19, "gpa": 4.0, "zip": 90210, "name": "Derek"}}::vertex - {"id": 844424930131975, "label": "students", "properties": {"age": 20, "gpa": 3.9::numeric, "name": "Jessica"}}::vertex - {"id": 844424930131976, "label": "students", "properties": {"age": 24, "name": "Dave"}}::vertex - {"id": 844424930131977, "label": "students", "properties": {"age": 18, "name": "Mike"}}::vertex - {"id": 844424930131978, "label": "students", "properties": {"age": 27, "gpa": 3.2, "zip": 94110, "name": "Sven"}}::vertex + vertex +------------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["students"], "properties": {"age": 21, "gpa": 3.0, "zip": 94110, "name": "Jack"}}::vertex + {"id": 844424930131970, "label": ["students"], "properties": {"age": 27, "gpa": 3.5, "zip": 95060, "name": "Jill"}}::vertex + {"id": 844424930131971, "label": ["students"], "properties": {"age": 32, "gpa": 3.75, "zip": 96062, "name": "Jim"}}::vertex + {"id": 844424930131972, "label": ["students"], "properties": {"age": 24, "gpa": 2.5, "zip": "95060", "name": "Rick"}}::vertex + {"id": 844424930131973, "label": ["students"], "properties": {"age": 23, "gpa": 3.8::numeric, "name": "Ann"}}::vertex + {"id": 844424930131974, "label": ["students"], "properties": {"age": 19, "gpa": 4.0, "zip": 90210, "name": "Derek"}}::vertex + {"id": 844424930131975, "label": ["students"], "properties": {"age": 20, "gpa": 3.9::numeric, "name": "Jessica"}}::vertex + {"id": 844424930131976, "label": ["students"], "properties": {"age": 24, "name": "Dave"}}::vertex + {"id": 844424930131977, "label": ["students"], "properties": {"age": 18, "name": "Mike"}}::vertex + {"id": 844424930131978, "label": ["students"], "properties": {"age": 27, "gpa": 3.2, "zip": 94110, "name": "Sven"}}::vertex (10 rows) SELECT * FROM cypher('UCSC', $$ MATCH (u) RETURN count(u.zip), count(DISTINCT u.zip) $$) @@ -6836,12 +6836,12 @@ SELECT * FROM cypher('case_statement', $$ $$ ) AS (case_statement agtype); case_statement ------------------------------------------------------------------------------------------------ - {"id": 281474976710657, "label": "", "properties": {"i": 1, "id": 1}}::vertex - {"id": 281474976710658, "label": "", "properties": {"i": "a", "j": "b", "id": 2}}::vertex - {"id": 281474976710659, "label": "", "properties": {"i": 0, "j": 1, "id": 3}}::vertex - {"id": 281474976710660, "label": "", "properties": {"i": true, "j": false, "id": 4}}::vertex - {"id": 281474976710661, "label": "", "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex - {"id": 281474976710662, "label": "", "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": 1, "id": 1}}::vertex + {"id": 281474976710658, "label": [], "properties": {"i": "a", "j": "b", "id": 2}}::vertex + {"id": 281474976710659, "label": [], "properties": {"i": 0, "j": 1, "id": 3}}::vertex + {"id": 281474976710660, "label": [], "properties": {"i": true, "j": false, "id": 4}}::vertex + {"id": 281474976710661, "label": [], "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex + {"id": 281474976710662, "label": [], "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex (6 rows) --CASE with match and edges @@ -6856,8 +6856,8 @@ SELECT * FROM cypher('case_statement', $$ $$ ) AS (case_statement agtype); case_statement ---------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"i": 1, "id": 1}}::vertex - {"id": 281474976710660, "label": "", "properties": {"i": true, "j": false, "id": 4}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": 1, "id": 1}}::vertex + {"id": 281474976710660, "label": [], "properties": {"i": true, "j": false, "id": 4}}::vertex (2 rows) SELECT * FROM cypher('case_statement', $$ @@ -7071,12 +7071,12 @@ SELECT * FROM cypher('case_statement', $$ $$ ) AS (n agtype, case_statement agtype); n | case_statement ------------------------------------------------------------------------------------------------+---------------- - {"id": 281474976710658, "label": "", "properties": {"i": "a", "j": "b", "id": 2}}::vertex | "not count" - {"id": 281474976710661, "label": "", "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex | "not count" - {"id": 281474976710657, "label": "", "properties": {"i": 1, "id": 1}}::vertex | "not count" - {"id": 281474976710659, "label": "", "properties": {"i": 0, "j": 1, "id": 3}}::vertex | 1 - {"id": 281474976710660, "label": "", "properties": {"i": true, "j": false, "id": 4}}::vertex | "not count" - {"id": 281474976710662, "label": "", "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex | "not count" + {"id": 281474976710658, "label": [], "properties": {"i": "a", "j": "b", "id": 2}}::vertex | "not count" + {"id": 281474976710661, "label": [], "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex | "not count" + {"id": 281474976710657, "label": [], "properties": {"i": 1, "id": 1}}::vertex | "not count" + {"id": 281474976710659, "label": [], "properties": {"i": 0, "j": 1, "id": 3}}::vertex | 1 + {"id": 281474976710660, "label": [], "properties": {"i": true, "j": false, "id": 4}}::vertex | "not count" + {"id": 281474976710662, "label": [], "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex | "not count" (6 rows) --concatenated @@ -7089,12 +7089,12 @@ SELECT * FROM cypher('case_statement', $$ $$ ) AS (n agtype, case_statement agtype); n | case_statement ------------------------------------------------------------------------------------------------+---------------- - {"id": 281474976710658, "label": "", "properties": {"i": "a", "j": "b", "id": 2}}::vertex | "not count" - {"id": 281474976710661, "label": "", "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex | "not count" - {"id": 281474976710657, "label": "", "properties": {"i": 1, "id": 1}}::vertex | "not count" - {"id": 281474976710659, "label": "", "properties": {"i": 0, "j": 1, "id": 3}}::vertex | 6 - {"id": 281474976710660, "label": "", "properties": {"i": true, "j": false, "id": 4}}::vertex | "not count" - {"id": 281474976710662, "label": "", "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex | "not count" + {"id": 281474976710658, "label": [], "properties": {"i": "a", "j": "b", "id": 2}}::vertex | "not count" + {"id": 281474976710661, "label": [], "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex | "not count" + {"id": 281474976710657, "label": [], "properties": {"i": 1, "id": 1}}::vertex | "not count" + {"id": 281474976710659, "label": [], "properties": {"i": 0, "j": 1, "id": 3}}::vertex | 6 + {"id": 281474976710660, "label": [], "properties": {"i": true, "j": false, "id": 4}}::vertex | "not count" + {"id": 281474976710662, "label": [], "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex | "not count" (6 rows) --count(n) @@ -7107,12 +7107,12 @@ SELECT * FROM cypher('case_statement', $$ $$ ) AS (n agtype, case_statement agtype); n | case_statement ------------------------------------------------------------------------------------------------+---------------- - {"id": 281474976710658, "label": "", "properties": {"i": "a", "j": "b", "id": 2}}::vertex | "not count" - {"id": 281474976710661, "label": "", "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex | "not count" - {"id": 281474976710657, "label": "", "properties": {"i": 1, "id": 1}}::vertex | "not count" - {"id": 281474976710659, "label": "", "properties": {"i": 0, "j": 1, "id": 3}}::vertex | 1 - {"id": 281474976710660, "label": "", "properties": {"i": true, "j": false, "id": 4}}::vertex | "not count" - {"id": 281474976710662, "label": "", "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex | "not count" + {"id": 281474976710658, "label": [], "properties": {"i": "a", "j": "b", "id": 2}}::vertex | "not count" + {"id": 281474976710661, "label": [], "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex | "not count" + {"id": 281474976710657, "label": [], "properties": {"i": 1, "id": 1}}::vertex | "not count" + {"id": 281474976710659, "label": [], "properties": {"i": 0, "j": 1, "id": 3}}::vertex | 1 + {"id": 281474976710660, "label": [], "properties": {"i": true, "j": false, "id": 4}}::vertex | "not count" + {"id": 281474976710662, "label": [], "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex | "not count" (6 rows) --concatenated @@ -7125,12 +7125,12 @@ SELECT * FROM cypher('case_statement', $$ $$ ) AS (n agtype, case_statement agtype); n | case_statement ------------------------------------------------------------------------------------------------+---------------- - {"id": 281474976710658, "label": "", "properties": {"i": "a", "j": "b", "id": 2}}::vertex | "not count" - {"id": 281474976710661, "label": "", "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex | "not count" - {"id": 281474976710657, "label": "", "properties": {"i": 1, "id": 1}}::vertex | "not count" - {"id": 281474976710659, "label": "", "properties": {"i": 0, "j": 1, "id": 3}}::vertex | 6 - {"id": 281474976710660, "label": "", "properties": {"i": true, "j": false, "id": 4}}::vertex | "not count" - {"id": 281474976710662, "label": "", "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex | "not count" + {"id": 281474976710658, "label": [], "properties": {"i": "a", "j": "b", "id": 2}}::vertex | "not count" + {"id": 281474976710661, "label": [], "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex | "not count" + {"id": 281474976710657, "label": [], "properties": {"i": 1, "id": 1}}::vertex | "not count" + {"id": 281474976710659, "label": [], "properties": {"i": 0, "j": 1, "id": 3}}::vertex | 6 + {"id": 281474976710660, "label": [], "properties": {"i": true, "j": false, "id": 4}}::vertex | "not count" + {"id": 281474976710662, "label": [], "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex | "not count" (6 rows) --count(1) @@ -7143,12 +7143,12 @@ SELECT * FROM cypher('case_statement', $$ $$ ) AS (n agtype, case_statement agtype); n | case_statement ------------------------------------------------------------------------------------------------+---------------- - {"id": 281474976710658, "label": "", "properties": {"i": "a", "j": "b", "id": 2}}::vertex | "not count" - {"id": 281474976710661, "label": "", "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex | "not count" - {"id": 281474976710657, "label": "", "properties": {"i": 1, "id": 1}}::vertex | "not count" - {"id": 281474976710659, "label": "", "properties": {"i": 0, "j": 1, "id": 3}}::vertex | 1 - {"id": 281474976710660, "label": "", "properties": {"i": true, "j": false, "id": 4}}::vertex | "not count" - {"id": 281474976710662, "label": "", "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex | "not count" + {"id": 281474976710658, "label": [], "properties": {"i": "a", "j": "b", "id": 2}}::vertex | "not count" + {"id": 281474976710661, "label": [], "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex | "not count" + {"id": 281474976710657, "label": [], "properties": {"i": 1, "id": 1}}::vertex | "not count" + {"id": 281474976710659, "label": [], "properties": {"i": 0, "j": 1, "id": 3}}::vertex | 1 + {"id": 281474976710660, "label": [], "properties": {"i": true, "j": false, "id": 4}}::vertex | "not count" + {"id": 281474976710662, "label": [], "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex | "not count" (6 rows) --concatenated @@ -7161,12 +7161,12 @@ SELECT * FROM cypher('case_statement', $$ $$ ) AS (n agtype, case_statement agtype); n | case_statement ------------------------------------------------------------------------------------------------+---------------- - {"id": 281474976710658, "label": "", "properties": {"i": "a", "j": "b", "id": 2}}::vertex | "not count" - {"id": 281474976710661, "label": "", "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex | "not count" - {"id": 281474976710657, "label": "", "properties": {"i": 1, "id": 1}}::vertex | "not count" - {"id": 281474976710659, "label": "", "properties": {"i": 0, "j": 1, "id": 3}}::vertex | 6 - {"id": 281474976710660, "label": "", "properties": {"i": true, "j": false, "id": 4}}::vertex | "not count" - {"id": 281474976710662, "label": "", "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex | "not count" + {"id": 281474976710658, "label": [], "properties": {"i": "a", "j": "b", "id": 2}}::vertex | "not count" + {"id": 281474976710661, "label": [], "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex | "not count" + {"id": 281474976710657, "label": [], "properties": {"i": 1, "id": 1}}::vertex | "not count" + {"id": 281474976710659, "label": [], "properties": {"i": 0, "j": 1, "id": 3}}::vertex | 6 + {"id": 281474976710660, "label": [], "properties": {"i": true, "j": false, "id": 4}}::vertex | "not count" + {"id": 281474976710662, "label": [], "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex | "not count" (6 rows) --CASE with EXISTS() @@ -7180,12 +7180,12 @@ SELECT * FROM cypher('case_statement', $$ $$ ) AS (n agtype, case_statement agtype); n | case_statement ------------------------------------------------------------------------------------------------+----------------------------- - {"id": 281474976710657, "label": "", "properties": {"i": 1, "id": 1}}::vertex | "property j does not exist" - {"id": 281474976710658, "label": "", "properties": {"i": "a", "j": "b", "id": 2}}::vertex | "property j exists" - {"id": 281474976710659, "label": "", "properties": {"i": 0, "j": 1, "id": 3}}::vertex | "property j exists" - {"id": 281474976710660, "label": "", "properties": {"i": true, "j": false, "id": 4}}::vertex | "property j exists" - {"id": 281474976710661, "label": "", "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex | "property j exists" - {"id": 281474976710662, "label": "", "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex | "property j exists" + {"id": 281474976710657, "label": [], "properties": {"i": 1, "id": 1}}::vertex | "property j does not exist" + {"id": 281474976710658, "label": [], "properties": {"i": "a", "j": "b", "id": 2}}::vertex | "property j exists" + {"id": 281474976710659, "label": [], "properties": {"i": 0, "j": 1, "id": 3}}::vertex | "property j exists" + {"id": 281474976710660, "label": [], "properties": {"i": true, "j": false, "id": 4}}::vertex | "property j exists" + {"id": 281474976710661, "label": [], "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex | "property j exists" + {"id": 281474976710662, "label": [], "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex | "property j exists" (6 rows) --CASE evaluates to boolean true, is not a boolean, should hit ELSE @@ -7198,12 +7198,12 @@ SELECT * FROM cypher('case_statement', $$ $$ ) AS (n agtype, case_statement agtype); n | case_statement ------------------------------------------------------------------------------------------------+---------------------- - {"id": 281474976710657, "label": "", "properties": {"i": 1, "id": 1}}::vertex | "1 is not a boolean" - {"id": 281474976710658, "label": "", "properties": {"i": "a", "j": "b", "id": 2}}::vertex | "1 is not a boolean" - {"id": 281474976710659, "label": "", "properties": {"i": 0, "j": 1, "id": 3}}::vertex | "1 is not a boolean" - {"id": 281474976710660, "label": "", "properties": {"i": true, "j": false, "id": 4}}::vertex | "1 is not a boolean" - {"id": 281474976710661, "label": "", "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex | "1 is not a boolean" - {"id": 281474976710662, "label": "", "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex | "1 is not a boolean" + {"id": 281474976710657, "label": [], "properties": {"i": 1, "id": 1}}::vertex | "1 is not a boolean" + {"id": 281474976710658, "label": [], "properties": {"i": "a", "j": "b", "id": 2}}::vertex | "1 is not a boolean" + {"id": 281474976710659, "label": [], "properties": {"i": 0, "j": 1, "id": 3}}::vertex | "1 is not a boolean" + {"id": 281474976710660, "label": [], "properties": {"i": true, "j": false, "id": 4}}::vertex | "1 is not a boolean" + {"id": 281474976710661, "label": [], "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex | "1 is not a boolean" + {"id": 281474976710662, "label": [], "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex | "1 is not a boolean" (6 rows) --exists in WHEN, vacuously false because exists(n.j) evaluates to a boolean, n is a vertex @@ -7216,12 +7216,12 @@ SELECT * FROM cypher('case_statement', $$ $$ ) AS (j agtype, case_statement agtype); j | case_statement ------------------------------------------------------------------------------------------------+-------------------------------- - {"id": 281474976710657, "label": "", "properties": {"i": 1, "id": 1}}::vertex | "n is a vertex, not a boolean" - {"id": 281474976710658, "label": "", "properties": {"i": "a", "j": "b", "id": 2}}::vertex | "n is a vertex, not a boolean" - {"id": 281474976710659, "label": "", "properties": {"i": 0, "j": 1, "id": 3}}::vertex | "n is a vertex, not a boolean" - {"id": 281474976710660, "label": "", "properties": {"i": true, "j": false, "id": 4}}::vertex | "n is a vertex, not a boolean" - {"id": 281474976710661, "label": "", "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex | "n is a vertex, not a boolean" - {"id": 281474976710662, "label": "", "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex | "n is a vertex, not a boolean" + {"id": 281474976710657, "label": [], "properties": {"i": 1, "id": 1}}::vertex | "n is a vertex, not a boolean" + {"id": 281474976710658, "label": [], "properties": {"i": "a", "j": "b", "id": 2}}::vertex | "n is a vertex, not a boolean" + {"id": 281474976710659, "label": [], "properties": {"i": 0, "j": 1, "id": 3}}::vertex | "n is a vertex, not a boolean" + {"id": 281474976710660, "label": [], "properties": {"i": true, "j": false, "id": 4}}::vertex | "n is a vertex, not a boolean" + {"id": 281474976710661, "label": [], "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex | "n is a vertex, not a boolean" + {"id": 281474976710662, "label": [], "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex | "n is a vertex, not a boolean" (6 rows) --exists(*) (should fail) @@ -7251,17 +7251,17 @@ SELECT * FROM cypher('opt_forms', $$CREATE ({i:1})-[:KNOWS]->({i:2})<-[:KNOWS]-( SELECT * FROM cypher('opt_forms', $$MATCH (u) RETURN u$$) AS (result agtype); result ---------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"i": 1}}::vertex - {"id": 281474976710658, "label": "", "properties": {"i": 2}}::vertex - {"id": 281474976710659, "label": "", "properties": {"i": 3}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": 1}}::vertex + {"id": 281474976710658, "label": [], "properties": {"i": 2}}::vertex + {"id": 281474976710659, "label": [], "properties": {"i": 3}}::vertex (3 rows) SELECT * FROM cypher('opt_forms', $$MATCH (u) RETURN *$$) AS (result agtype); result ---------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"i": 1}}::vertex - {"id": 281474976710658, "label": "", "properties": {"i": 2}}::vertex - {"id": 281474976710659, "label": "", "properties": {"i": 3}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": 1}}::vertex + {"id": 281474976710658, "label": [], "properties": {"i": 2}}::vertex + {"id": 281474976710659, "label": [], "properties": {"i": 3}}::vertex (3 rows) SELECT * FROM cypher('opt_forms', $$MATCH (u)--(v) RETURN u.i, v.i$$) AS (u agtype, v agtype); @@ -7297,16 +7297,16 @@ SELECT * FROM cypher('opt_forms', $$MATCH (u)-->()<--(v) RETURN u.i, v.i$$) AS ( SELECT * FROM cypher('opt_forms', $$MATCH (u) CREATE (u)-[:edge]->() RETURN *$$) AS (results agtype); results ---------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"i": 1}}::vertex - {"id": 281474976710658, "label": "", "properties": {"i": 2}}::vertex - {"id": 281474976710659, "label": "", "properties": {"i": 3}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": 1}}::vertex + {"id": 281474976710658, "label": [], "properties": {"i": 2}}::vertex + {"id": 281474976710659, "label": [], "properties": {"i": 3}}::vertex (3 rows) SELECT * FROM cypher('opt_forms', $$MATCH (u)-->()<--(v) RETURN *$$) AS (col1 agtype, col2 agtype); col1 | col2 ----------------------------------------------------------------------+---------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"i": 3}}::vertex | {"id": 281474976710657, "label": "", "properties": {"i": 1}}::vertex - {"id": 281474976710657, "label": "", "properties": {"i": 1}}::vertex | {"id": 281474976710659, "label": "", "properties": {"i": 3}}::vertex + {"id": 281474976710659, "label": [], "properties": {"i": 3}}::vertex | {"id": 281474976710657, "label": [], "properties": {"i": 1}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": 1}}::vertex | {"id": 281474976710659, "label": [], "properties": {"i": 3}}::vertex (2 rows) -- Added typecasts ::pg_bigint and ::pg_float8 @@ -7373,42 +7373,42 @@ SELECT * FROM cypher('VLE', $$MATCH (u)-[*..5]-(v) RETURN u, v$$) AS (u agtype, -- Create a graph to test SELECT * FROM cypher('VLE', $$CREATE (b:begin)-[:edge {name: 'main edge', number: 1, dangerous: {type: "all", level: "all"}}]->(u1:middle)-[:edge {name: 'main edge', number: 2, dangerous: {type: "all", level: "all"}, packages: [2,4,6]}]->(u2:middle)-[:edge {name: 'main edge', number: 3, dangerous: {type: "all", level: "all"}}]->(u3:middle)-[:edge {name: 'main edge', number: 4, dangerous: {type: "all", level: "all"}}]->(e:end), (u1)-[:self_loop {name: 'self loop', number: 1, dangerous: {type: "all", level: "all"}}]->(u1), (e)-[:self_loop {name: 'self loop', number: 2, dangerous: {type: "all", level: "all"}}]->(e), (b)-[:alternate_edge {name: 'alternate edge', number: 1, packages: [2,4,6], dangerous: {type: "poisons", level: "all"}}]->(u1), (u2)-[:alternate_edge {name: 'alternate edge', number: 2, packages: [2,4,6], dangerous: {type: "poisons", level: "all"}}]->(u3), (u3)-[:alternate_edge {name: 'alternate edge', number: 3, packages: [2,4,6], dangerous: {type: "poisons", level: "all"}}]->(e), (u2)-[:bypass_edge {name: 'bypass edge', number: 1, packages: [1,3,5,7]}]->(e), (e)-[:alternate_edge {name: 'backup edge', number: 1, packages: [1,3,5,7]}]->(u3), (u3)-[:alternate_edge {name: 'backup edge', number: 2, packages: [1,3,5,7]}]->(u2), (u2)-[:bypass_edge {name: 'bypass edge', number: 2, packages: [1,3,5,7], dangerous: {type: "poisons", level: "all"}}]->(b) RETURN b, e $$) AS (b agtype, e agtype); - b | e ----------------------------------------------------------------------+-------------------------------------------------------------------- - {"id": 844424930131969, "label": "begin", "properties": {}}::vertex | {"id": 1688849860263937, "label": "end", "properties": {}}::vertex + b | e +-----------------------------------------------------------------------+---------------------------------------------------------------------- + {"id": 844424930131969, "label": ["begin"], "properties": {}}::vertex | {"id": 1688849860263937, "label": ["end"], "properties": {}}::vertex (1 row) -- test vertex_stats command SELECT * FROM cypher('VLE', $$ MATCH (u) RETURN vertex_stats(u) $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "begin", "in_degree": 1, "out_degree": 2, "self_loops": 0} - {"id": 1407374883553281, "label": "middle", "in_degree": 3, "out_degree": 2, "self_loops": 1} - {"id": 1407374883553282, "label": "middle", "in_degree": 2, "out_degree": 4, "self_loops": 0} - {"id": 1407374883553283, "label": "middle", "in_degree": 3, "out_degree": 3, "self_loops": 0} - {"id": 1688849860263937, "label": "end", "in_degree": 4, "out_degree": 2, "self_loops": 1} + result +------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["begin"], "in_degree": 1, "out_degree": 2, "self_loops": 0} + {"id": 1407374883553281, "label": ["middle"], "in_degree": 3, "out_degree": 2, "self_loops": 1} + {"id": 1407374883553282, "label": ["middle"], "in_degree": 2, "out_degree": 4, "self_loops": 0} + {"id": 1407374883553283, "label": ["middle"], "in_degree": 3, "out_degree": 3, "self_loops": 0} + {"id": 1688849860263937, "label": ["end"], "in_degree": 4, "out_degree": 2, "self_loops": 1} (5 rows) -- test indirection operator for a function SELECT * FROM cypher('VLE', $$ MATCH (u) WHERE vertex_stats(u).self_loops <> 0 RETURN vertex_stats(u) $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------ - {"id": 1407374883553281, "label": "middle", "in_degree": 3, "out_degree": 2, "self_loops": 1} - {"id": 1688849860263937, "label": "end", "in_degree": 4, "out_degree": 2, "self_loops": 1} + result +------------------------------------------------------------------------------------------------- + {"id": 1407374883553281, "label": ["middle"], "in_degree": 3, "out_degree": 2, "self_loops": 1} + {"id": 1688849860263937, "label": ["end"], "in_degree": 4, "out_degree": 2, "self_loops": 1} (2 rows) SELECT * FROM cypher('VLE', $$ MATCH (u) WHERE vertex_stats(u).in_degree < vertex_stats(u).out_degree RETURN vertex_stats(u) $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "begin", "in_degree": 1, "out_degree": 2, "self_loops": 0} - {"id": 1407374883553282, "label": "middle", "in_degree": 2, "out_degree": 4, "self_loops": 0} + result +------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["begin"], "in_degree": 1, "out_degree": 2, "self_loops": 0} + {"id": 1407374883553282, "label": ["middle"], "in_degree": 2, "out_degree": 4, "self_loops": 0} (2 rows) SELECT * FROM cypher('VLE', $$ MATCH (u) WHERE vertex_stats(u).out_degree < vertex_stats(u).in_degree RETURN vertex_stats(u) $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------ - {"id": 1407374883553281, "label": "middle", "in_degree": 3, "out_degree": 2, "self_loops": 1} - {"id": 1688849860263937, "label": "end", "in_degree": 4, "out_degree": 2, "self_loops": 1} + result +------------------------------------------------------------------------------------------------- + {"id": 1407374883553281, "label": ["middle"], "in_degree": 3, "out_degree": 2, "self_loops": 1} + {"id": 1688849860263937, "label": ["end"], "in_degree": 4, "out_degree": 2, "self_loops": 1} (2 rows) -- list functions relationships(), range(), keys() @@ -7502,28 +7502,28 @@ NOTICE: graph "list" has been created SELECT * from cypher('list', $$CREATE p=({name:"rick"})-[:knows]->({name:"morty"}) RETURN p$$) as (path agtype); path ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - [{"id": 281474976710657, "label": "", "properties": {"name": "rick"}}::vertex, {"id": 844424930131969, "label": "knows", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge, {"id": 281474976710658, "label": "", "properties": {"name": "morty"}}::vertex]::path + [{"id": 281474976710657, "label": [], "properties": {"name": "rick"}}::vertex, {"id": 844424930131969, "label": "knows", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge, {"id": 281474976710658, "label": [], "properties": {"name": "morty"}}::vertex]::path (1 row) SELECT * from cypher('list', $$CREATE p=({name:'rachael'})-[:knows]->({name:'monica'})-[:knows]->({name:'phoebe'}) RETURN p$$) as (path agtype); path --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710659, "label": "", "properties": {"name": "rachael"}}::vertex, {"id": 844424930131971, "label": "knows", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge, {"id": 281474976710660, "label": "", "properties": {"name": "monica"}}::vertex, {"id": 844424930131970, "label": "knows", "end_id": 281474976710661, "start_id": 281474976710660, "properties": {}}::edge, {"id": 281474976710661, "label": "", "properties": {"name": "phoebe"}}::vertex]::path + [{"id": 281474976710659, "label": [], "properties": {"name": "rachael"}}::vertex, {"id": 844424930131971, "label": "knows", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge, {"id": 281474976710660, "label": [], "properties": {"name": "monica"}}::vertex, {"id": 844424930131970, "label": "knows", "end_id": 281474976710661, "start_id": 281474976710660, "properties": {}}::edge, {"id": 281474976710661, "label": [], "properties": {"name": "phoebe"}}::vertex]::path (1 row) -- nodes() SELECT * from cypher('list', $$MATCH p=()-[]->() RETURN nodes(p)$$) as (nodes agtype); nodes ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710657, "label": "", "properties": {"name": "rick"}}::vertex, {"id": 281474976710658, "label": "", "properties": {"name": "morty"}}::vertex] - [{"id": 281474976710660, "label": "", "properties": {"name": "monica"}}::vertex, {"id": 281474976710661, "label": "", "properties": {"name": "phoebe"}}::vertex] - [{"id": 281474976710659, "label": "", "properties": {"name": "rachael"}}::vertex, {"id": 281474976710660, "label": "", "properties": {"name": "monica"}}::vertex] + [{"id": 281474976710657, "label": [], "properties": {"name": "rick"}}::vertex, {"id": 281474976710658, "label": [], "properties": {"name": "morty"}}::vertex] + [{"id": 281474976710660, "label": [], "properties": {"name": "monica"}}::vertex, {"id": 281474976710661, "label": [], "properties": {"name": "phoebe"}}::vertex] + [{"id": 281474976710659, "label": [], "properties": {"name": "rachael"}}::vertex, {"id": 281474976710660, "label": [], "properties": {"name": "monica"}}::vertex] (3 rows) SELECT * from cypher('list', $$MATCH p=()-[]->()-[]->() RETURN nodes(p)$$) as (nodes agtype); nodes --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710659, "label": "", "properties": {"name": "rachael"}}::vertex, {"id": 281474976710660, "label": "", "properties": {"name": "monica"}}::vertex, {"id": 281474976710661, "label": "", "properties": {"name": "phoebe"}}::vertex] + [{"id": 281474976710659, "label": [], "properties": {"name": "rachael"}}::vertex, {"id": 281474976710660, "label": [], "properties": {"name": "monica"}}::vertex, {"id": 281474976710661, "label": [], "properties": {"name": "phoebe"}}::vertex] (1 row) -- should return nothing @@ -7701,41 +7701,41 @@ LINE 1: SELECT * FROM cypher('list', $$ RETURN tail() $$) AS (tail a... HINT: No function matches the given name and argument types. You might need to add explicit type casts. -- labels() SELECT * from cypher('list', $$CREATE (u:People {name: "John"}) RETURN u$$) as (Vertices agtype); - vertices -------------------------------------------------------------------------------------- - {"id": 1125899906842625, "label": "People", "properties": {"name": "John"}}::vertex + vertices +--------------------------------------------------------------------------------------- + {"id": 1125899906842625, "label": ["People"], "properties": {"name": "John"}}::vertex (1 row) SELECT * from cypher('list', $$CREATE (u:People {name: "Larry"}) RETURN u$$) as (Vertices agtype); - vertices --------------------------------------------------------------------------------------- - {"id": 1125899906842626, "label": "People", "properties": {"name": "Larry"}}::vertex + vertices +---------------------------------------------------------------------------------------- + {"id": 1125899906842626, "label": ["People"], "properties": {"name": "Larry"}}::vertex (1 row) SELECT * from cypher('list', $$CREATE (u:Cars {name: "G35"}) RETURN u$$) as (Vertices agtype); - vertices ----------------------------------------------------------------------------------- - {"id": 1407374883553281, "label": "Cars", "properties": {"name": "G35"}}::vertex + vertices +------------------------------------------------------------------------------------ + {"id": 1407374883553281, "label": ["Cars"], "properties": {"name": "G35"}}::vertex (1 row) SELECT * from cypher('list', $$CREATE (u:Cars {name: "MR2"}) RETURN u$$) as (Vertices agtype); - vertices ----------------------------------------------------------------------------------- - {"id": 1407374883553282, "label": "Cars", "properties": {"name": "MR2"}}::vertex + vertices +------------------------------------------------------------------------------------ + {"id": 1407374883553282, "label": ["Cars"], "properties": {"name": "MR2"}}::vertex (1 row) SELECT * from cypher('list', $$MATCH (u) RETURN labels(u), u$$) as (Labels agtype, Vertices agtype); - labels | vertices -------------+-------------------------------------------------------------------------------------- - [""] | {"id": 281474976710657, "label": "", "properties": {"name": "rick"}}::vertex - [""] | {"id": 281474976710658, "label": "", "properties": {"name": "morty"}}::vertex - [""] | {"id": 281474976710659, "label": "", "properties": {"name": "rachael"}}::vertex - [""] | {"id": 281474976710660, "label": "", "properties": {"name": "monica"}}::vertex - [""] | {"id": 281474976710661, "label": "", "properties": {"name": "phoebe"}}::vertex - ["People"] | {"id": 1125899906842625, "label": "People", "properties": {"name": "John"}}::vertex - ["People"] | {"id": 1125899906842626, "label": "People", "properties": {"name": "Larry"}}::vertex - ["Cars"] | {"id": 1407374883553281, "label": "Cars", "properties": {"name": "G35"}}::vertex - ["Cars"] | {"id": 1407374883553282, "label": "Cars", "properties": {"name": "MR2"}}::vertex + labels | vertices +------------+---------------------------------------------------------------------------------------- + [] | {"id": 281474976710657, "label": [], "properties": {"name": "rick"}}::vertex + [] | {"id": 281474976710658, "label": [], "properties": {"name": "morty"}}::vertex + [] | {"id": 281474976710659, "label": [], "properties": {"name": "rachael"}}::vertex + [] | {"id": 281474976710660, "label": [], "properties": {"name": "monica"}}::vertex + [] | {"id": 281474976710661, "label": [], "properties": {"name": "phoebe"}}::vertex + ["People"] | {"id": 1125899906842625, "label": ["People"], "properties": {"name": "John"}}::vertex + ["People"] | {"id": 1125899906842626, "label": ["People"], "properties": {"name": "Larry"}}::vertex + ["Cars"] | {"id": 1407374883553281, "label": ["Cars"], "properties": {"name": "G35"}}::vertex + ["Cars"] | {"id": 1407374883553282, "label": ["Cars"], "properties": {"name": "MR2"}}::vertex (9 rows) -- should return SQL NULL @@ -7751,45 +7751,45 @@ ERROR: labels() argument must be a vertex -- Issue 989: Impossible to create an object with an array field of more than -- 100 elements. SELECT * FROM cypher('list', $$ CREATE (any_vertex: test_label { `largeArray`: [] }) RETURN any_vertex $$) AS (u agtype); - u -------------------------------------------------------------------------------------------- - {"id": 1688849860263937, "label": "test_label", "properties": {"largeArray": []}}::vertex + u +--------------------------------------------------------------------------------------------- + {"id": 1688849860263937, "label": ["test_label"], "properties": {"largeArray": []}}::vertex (1 row) SELECT * FROM cypher('list', $$ CREATE (any_vertex: test_label { `largeArray`: [0] }) RETURN any_vertex $$) AS (u agtype); - u --------------------------------------------------------------------------------------------- - {"id": 1688849860263938, "label": "test_label", "properties": {"largeArray": [0]}}::vertex + u +---------------------------------------------------------------------------------------------- + {"id": 1688849860263938, "label": ["test_label"], "properties": {"largeArray": [0]}}::vertex (1 row) SELECT * FROM cypher('list', $$ CREATE (any_vertex: test_label { `largeArray`: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99] }) RETURN any_vertex $$) AS (u agtype); - u ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - {"id": 1688849860263939, "label": "test_label", "properties": {"largeArray": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]}}::vertex + u +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 1688849860263939, "label": ["test_label"], "properties": {"largeArray": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]}}::vertex (1 row) SELECT * FROM cypher('list', $$ CREATE (any_vertex: test_label { `largeArray`: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] }) RETURN any_vertex $$) AS (u agtype); - u ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 1688849860263940, "label": "test_label", "properties": {"largeArray": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]}}::vertex + u +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + {"id": 1688849860263940, "label": ["test_label"], "properties": {"largeArray": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]}}::vertex (1 row) SELECT * FROM cypher('list', $$ CREATE (any_vertex: test_label { `largeArray`: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99] }) RETURN any_vertex $$) AS (u agtype); - u -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 1688849860263941, "label": "test_label", "properties": {"largeArray": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]}}::vertex + u +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 1688849860263941, "label": ["test_label"], "properties": {"largeArray": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]}}::vertex (1 row) SELECT * FROM cypher('list', $$ CREATE (any_vertex: test_label { `largeArray`: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99] }) RETURN any_vertex $$) AS (u agtype); - u ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - {"id": 1688849860263942, "label": "test_label", "properties": {"largeArray": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]}}::vertex + u +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 1688849860263942, "label": ["test_label"], "properties": {"largeArray": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]}}::vertex (1 row) SELECT * FROM cypher('list', $$ CREATE (any_vertex: test_label { `largeArray`: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99] }) RETURN any_vertex $$) AS (u agtype); - u -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 1688849860263943, "label": "test_label", "properties": {"largeArray": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]}}::vertex + u +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 1688849860263943, "label": ["test_label"], "properties": {"largeArray": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]}}::vertex (1 row) -- should return 7 rows with counts: 0, 1, 100, 101, 200, 400, 800 @@ -7827,9 +7827,9 @@ SELECT * FROM cypher('list',$$ CREATE (n:xyz {array:[0, 1, 2, 3, 4, 5, 6, 7, 8, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], 100]}) return n $$) as (a agtype); - a ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - {"id": 1970324836974593, "label": "xyz", "properties": {"array": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], 100]}}::vertex + a +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 1970324836974593, "label": ["xyz"], "properties": {"array": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], 100]}}::vertex (1 row) SELECT * FROM cypher('list',$$ MATCH (n:xyz) CREATE (m:xyz {array:[0,1,2,3,n.array,5,6,7,8,9, @@ -7843,16 +7843,16 @@ SELECT * FROM cypher('list',$$ MATCH (n:xyz) CREATE (m:xyz {array:[0,1,2,3,n.arr 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]}) return m $$) as (a agtype); - a ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 1970324836974594, "label": "xyz", "properties": {"array": [0, 1, 2, 3, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], 100], 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]}}::vertex + a +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 1970324836974594, "label": ["xyz"], "properties": {"array": [0, 1, 2, 3, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], 100], 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]}}::vertex (1 row) SELECT * FROM cypher('list',$$ MATCH (n:xyz) CREATE (m:xyz {array:[n.array,[n.array,[n.array]]]}) return m $$) as (a agtype); - a ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 1970324836974595, "label": "xyz", "properties": {"array": [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], 100], [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], 100], [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], 100]]]]}}::vertex - {"id": 1970324836974596, "label": "xyz", "properties": {"array": [[0, 1, 2, 3, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], 100], 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], [[0, 1, 2, 3, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], 100], 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], [[0, 1, 2, 3, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], 100], 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]]]]}}::vertex + a +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 1970324836974595, "label": ["xyz"], "properties": {"array": [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], 100], [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], 100], [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], 100]]]]}}::vertex + {"id": 1970324836974596, "label": ["xyz"], "properties": {"array": [[0, 1, 2, 3, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], 100], 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], [[0, 1, 2, 3, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], 100], 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], [[0, 1, 2, 3, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], 100], 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]]]]}}::vertex (2 rows) -- SET @@ -7882,9 +7882,9 @@ SELECT * FROM cypher('list',$$ MATCH p=(n:xyz)-[e]->() SET n.array=[0, 1, 2, 3, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] return n,e $$) as (a agtype, b agtype); - a | b -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 1970324836974597, "label": "xyz", "properties": {"array": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]}}::vertex | {"id": 2251799813685249, "label": "KNOWS", "end_id": 1970324836974598, "start_id": 1970324836974597, "properties": {"array": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]}}::edge + a | b +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 1970324836974597, "label": ["xyz"], "properties": {"array": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]}}::vertex | {"id": 2251799813685249, "label": "KNOWS", "end_id": 1970324836974598, "start_id": 1970324836974597, "properties": {"array": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]}}::edge (1 row) SELECT * FROM cypher('list',$$ MATCH p=(n:xyz)-[e]->() SET n.array=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, @@ -7898,9 +7898,9 @@ SELECT * FROM cypher('list',$$ MATCH p=(n:xyz)-[e]->() SET n.array=[0, 1, 2, 3, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, e.array, 100] return n,e $$) as (a agtype, b agtype); - a | b ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 1970324836974597, "label": "xyz", "properties": {"array": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], 100]}}::vertex | {"id": 2251799813685249, "label": "KNOWS", "end_id": 1970324836974598, "start_id": 1970324836974597, "properties": {"array": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]}}::edge + a | b +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 1970324836974597, "label": ["xyz"], "properties": {"array": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100], 100]}}::vertex | {"id": 2251799813685249, "label": "KNOWS", "end_id": 1970324836974598, "start_id": 1970324836974597, "properties": {"array": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]}}::edge (1 row) -- pg_typeof @@ -7946,11 +7946,11 @@ SELECT * FROM cypher('graph_395', $$ MATCH (p:Project)-[:Has]->(t:Task)-[:Assign WITH p, t, collect(u) AS users WITH p, {tn: t.name, users: users} AS task RETURN task $$) AS (p agtype); - p ------------------------------------------------------------------------------------------------------------------------------ - {"tn": "Task A", "users": [{"id": 1407374883553281, "label": "Person", "properties": {"age": 55, "name": "John"}}::vertex]} - {"tn": "Task B", "users": [{"id": 1407374883553282, "label": "Person", "properties": {"age": 43, "name": "Bob"}}::vertex]} - {"tn": "Task C", "users": [{"id": 1407374883553282, "label": "Person", "properties": {"age": 43, "name": "Bob"}}::vertex]} + p +------------------------------------------------------------------------------------------------------------------------------- + {"tn": "Task A", "users": [{"id": 1407374883553281, "label": ["Person"], "properties": {"age": 55, "name": "John"}}::vertex]} + {"tn": "Task B", "users": [{"id": 1407374883553282, "label": ["Person"], "properties": {"age": 43, "name": "Bob"}}::vertex]} + {"tn": "Task C", "users": [{"id": 1407374883553282, "label": ["Person"], "properties": {"age": 43, "name": "Bob"}}::vertex]} (3 rows) SELECT * FROM cypher('graph_395', $$ MATCH (p:Project)-[:Has]->(t:Task)-[:AssignedTo]->(u:Person) @@ -7958,10 +7958,10 @@ SELECT * FROM cypher('graph_395', $$ MATCH (p:Project)-[:Has]->(t:Task)-[:Assign WITH p, {tn: t.name, users: users} AS task WITH p, collect(task) AS tasks RETURN tasks $$) AS (p agtype); - p ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - [{"tn": "Task A", "users": [{"id": 1407374883553281, "label": "Person", "properties": {"age": 55, "name": "John"}}::vertex]}, {"tn": "Task B", "users": [{"id": 1407374883553282, "label": "Person", "properties": {"age": 43, "name": "Bob"}}::vertex]}] - [{"tn": "Task C", "users": [{"id": 1407374883553282, "label": "Person", "properties": {"age": 43, "name": "Bob"}}::vertex]}] + p +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"tn": "Task A", "users": [{"id": 1407374883553281, "label": ["Person"], "properties": {"age": 55, "name": "John"}}::vertex]}, {"tn": "Task B", "users": [{"id": 1407374883553282, "label": ["Person"], "properties": {"age": 43, "name": "Bob"}}::vertex]}] + [{"tn": "Task C", "users": [{"id": 1407374883553282, "label": ["Person"], "properties": {"age": 43, "name": "Bob"}}::vertex]}] (2 rows) SELECT * FROM cypher('graph_395', $$ MATCH (p:Project)-[:Has]->(t:Task)-[:AssignedTo]->(u:Person) @@ -7970,10 +7970,10 @@ SELECT * FROM cypher('graph_395', $$ MATCH (p:Project)-[:Has]->(t:Task)-[:Assign WITH p, collect(task) AS tasks WITH {pn: p.name, tasks:tasks} AS project RETURN project $$) AS (p agtype); - p ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - {"pn": "Project A", "tasks": [{"tn": "Task A", "users": [{"id": 1407374883553281, "label": "Person", "properties": {"age": 55, "name": "John"}}::vertex]}, {"tn": "Task B", "users": [{"id": 1407374883553282, "label": "Person", "properties": {"age": 43, "name": "Bob"}}::vertex]}]} - {"pn": "Project B", "tasks": [{"tn": "Task C", "users": [{"id": 1407374883553282, "label": "Person", "properties": {"age": 43, "name": "Bob"}}::vertex]}]} + p +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"pn": "Project A", "tasks": [{"tn": "Task A", "users": [{"id": 1407374883553281, "label": ["Person"], "properties": {"age": 55, "name": "John"}}::vertex]}, {"tn": "Task B", "users": [{"id": 1407374883553282, "label": ["Person"], "properties": {"age": 43, "name": "Bob"}}::vertex]}]} + {"pn": "Project B", "tasks": [{"tn": "Task C", "users": [{"id": 1407374883553282, "label": ["Person"], "properties": {"age": 43, "name": "Bob"}}::vertex]}]} (2 rows) -- @@ -8319,13 +8319,13 @@ NOTICE: graph "issue_1124" has been created SELECT results, pg_typeof(user) FROM cypher('issue_1124', $$ CREATE (u) RETURN u $$) AS (results agtype), user; results | pg_typeof ----------------------------------------------------------------+----------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex | name + {"id": 281474976710657, "label": [], "properties": {}}::vertex | name (1 row) SELECT results, pg_typeof(user) FROM cypher('issue_1124', $$ MATCH (u) RETURN u $$) AS (results agtype), user; results | pg_typeof ----------------------------------------------------------------+----------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex | name + {"id": 281474976710657, "label": [], "properties": {}}::vertex | name (1 row) -- @@ -8357,9 +8357,9 @@ SELECT * FROM agtype('{"a": 1}'); (1 row) SELECT * FROM agtype('{"id": 844424930131971, "label": "v", "properties": {"i": 1}}::vertex'); - agtype ------------------------------------------------------------------------ - {"id": 844424930131971, "label": "v", "properties": {"i": 1}}::vertex + agtype +------------------------------------------------------------------------- + {"id": 844424930131971, "label": ["v"], "properties": {"i": 1}}::vertex (1 row) SELECT * FROM agtype('{"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge'); @@ -8369,9 +8369,9 @@ SELECT * FROM agtype('{"id": 1407374883553282, "label": "e1", "end_id": 11258999 (1 row) SELECT * FROM agtype('[{"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex]::path'); - agtype ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 1125899906842625, "label": "v1", "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": "v1", "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": "v1", "properties": {"id": "end"}}::vertex]::path + agtype +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 1125899906842625, "label": ["v1"], "properties": {"id": "initial"}}::vertex, {"id": 1407374883553282, "label": "e1", "end_id": 1125899906842626, "start_id": 1125899906842625, "properties": {}}::edge, {"id": 1125899906842626, "label": ["v1"], "properties": {"id": "middle"}}::vertex, {"id": 1407374883553281, "label": "e1", "end_id": 1125899906842627, "start_id": 1125899906842626, "properties": {}}::edge, {"id": 1125899906842627, "label": ["v1"], "properties": {"id": "end"}}::vertex]::path (1 row) SELECT * FROM text(1); @@ -8421,31 +8421,31 @@ NOTICE: graph "issue_1303" has been created SELECT result, agtype('[1, 2, 3]') FROM cypher('issue_1303', $$ CREATE (u) RETURN u $$) AS (result agtype); result | agtype ----------------------------------------------------------------+----------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex | [1, 2, 3] + {"id": 281474976710657, "label": [], "properties": {}}::vertex | [1, 2, 3] (1 row) SELECT result, result2, pg_typeof(result2) FROM cypher('issue_1303', $$ MATCH (u) RETURN u $$) AS (result agtype), agtype('[1, 2, 3]') AS result2; result | result2 | pg_typeof ----------------------------------------------------------------+-----------+----------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex | [1, 2, 3] | agtype + {"id": 281474976710657, "label": [], "properties": {}}::vertex | [1, 2, 3] | agtype (1 row) SELECT result, result2, pg_typeof(result2) FROM cypher('issue_1303', $$ MATCH (u) RETURN u $$) AS (result agtype), text(1) AS result2; result | result2 | pg_typeof ----------------------------------------------------------------+---------+----------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex | 1 | text + {"id": 281474976710657, "label": [], "properties": {}}::vertex | 1 | text (1 row) SELECT result, result2, pg_typeof(result2), result3, pg_typeof(result3) FROM cypher('issue_1303', $$ MATCH (u) RETURN u $$) AS (result agtype), text(1) AS result2, agtype(result) AS result3; result | result2 | pg_typeof | result3 | pg_typeof ----------------------------------------------------------------+---------+-----------+----------------------------------------------------------------+----------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex | 1 | text | {"id": 281474976710657, "label": "", "properties": {}}::vertex | agtype + {"id": 281474976710657, "label": [], "properties": {}}::vertex | 1 | text | {"id": 281474976710657, "label": [], "properties": {}}::vertex | agtype (1 row) SELECT result, result2, pg_typeof(result2), result3, pg_typeof(result3) FROM cypher('issue_1303', $$ MATCH (u) RETURN u $$) AS (result agtype), text(1) AS result2, agtype(result2) AS result3; result | result2 | pg_typeof | result3 | pg_typeof ----------------------------------------------------------------+---------+-----------+---------+----------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex | 1 | text | 1 | agtype + {"id": 281474976710657, "label": [], "properties": {}}::vertex | 1 | text | 1 | agtype (1 row) -- Text OpExpr expression node types diff --git a/regress/expected/index.out b/regress/expected/index.out index f911900ab..caa1c9055 100644 --- a/regress/expected/index.out +++ b/regress/expected/index.out @@ -166,10 +166,10 @@ SELECT * FROM cypher('cypher_index', $$ CREATE (:idx {i: 1}) $$) AS (a agtype); --validate the data SELECT * FROM cypher('cypher_index', $$ MATCH(n) RETURN n $$) AS (a agtype); - a -------------------------------------------------------------------------- - {"id": 844424930131979, "label": "idx", "properties": {"i": 2}}::vertex - {"id": 844424930131980, "label": "idx", "properties": {"i": 1}}::vertex + a +--------------------------------------------------------------------------- + {"id": 844424930131979, "label": ["idx"], "properties": {"i": 2}}::vertex + {"id": 844424930131980, "label": ["idx"], "properties": {"i": 1}}::vertex (2 rows) --data cleanup @@ -204,19 +204,19 @@ SELECT * FROM cypher('cypher_index', $$ CREATE (:idx {i: 1}) $$) AS (a agtype); --validate the data SELECT * FROM cypher('cypher_index', $$ MATCH(n) RETURN n $$) AS (a agtype); - a -------------------------------------------------------------------------- - {"id": 844424930131981, "label": "idx", "properties": {"i": 2}}::vertex - {"id": 844424930131982, "label": "idx", "properties": {"i": 1}}::vertex + a +--------------------------------------------------------------------------- + {"id": 844424930131981, "label": ["idx"], "properties": {"i": 2}}::vertex + {"id": 844424930131982, "label": ["idx"], "properties": {"i": 1}}::vertex (2 rows) COMMIT; --validate the data again out of the transaction, just in case SELECT * FROM cypher('cypher_index', $$ MATCH(n) RETURN n $$) AS (a agtype); - a -------------------------------------------------------------------------- - {"id": 844424930131981, "label": "idx", "properties": {"i": 2}}::vertex - {"id": 844424930131982, "label": "idx", "properties": {"i": 1}}::vertex + a +--------------------------------------------------------------------------- + {"id": 844424930131981, "label": ["idx"], "properties": {"i": 2}}::vertex + {"id": 844424930131982, "label": ["idx"], "properties": {"i": 1}}::vertex (2 rows) --data cleanup @@ -326,51 +326,51 @@ SELECT * FROM cypher('cypher_index', $$ MATCH (c:City {city_id: 1}) RETURN c $$) as (n agtype); - n ------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 1970324836974593, "label": "City", "properties": {"name": "New York", "city_id": 1, "west_coast": false, "country_code": "US"}}::vertex + n +-------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 1970324836974593, "label": ["City"], "properties": {"name": "New York", "city_id": 1, "west_coast": false, "country_code": "US"}}::vertex (1 row) SELECT * FROM cypher('cypher_index', $$ MATCH (:Country {country_code: "US"})<-[]-(city:City) RETURN city $$) as (n agtype); - n ----------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 1970324836974593, "label": "City", "properties": {"name": "New York", "city_id": 1, "west_coast": false, "country_code": "US"}}::vertex - {"id": 1970324836974594, "label": "City", "properties": {"name": "San Fransisco", "city_id": 2, "west_coast": true, "country_code": "US"}}::vertex - {"id": 1970324836974595, "label": "City", "properties": {"name": "Los Angeles", "city_id": 3, "west_coast": true, "country_code": "US"}}::vertex - {"id": 1970324836974596, "label": "City", "properties": {"name": "Seattle", "city_id": 4, "west_coast": true, "country_code": "US"}}::vertex + n +------------------------------------------------------------------------------------------------------------------------------------------------------ + {"id": 1970324836974593, "label": ["City"], "properties": {"name": "New York", "city_id": 1, "west_coast": false, "country_code": "US"}}::vertex + {"id": 1970324836974594, "label": ["City"], "properties": {"name": "San Fransisco", "city_id": 2, "west_coast": true, "country_code": "US"}}::vertex + {"id": 1970324836974595, "label": ["City"], "properties": {"name": "Los Angeles", "city_id": 3, "west_coast": true, "country_code": "US"}}::vertex + {"id": 1970324836974596, "label": ["City"], "properties": {"name": "Seattle", "city_id": 4, "west_coast": true, "country_code": "US"}}::vertex (4 rows) SELECT * FROM cypher('cypher_index', $$ MATCH (c:City {west_coast: true}) RETURN c $$) as (n agtype); - n ----------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 1970324836974594, "label": "City", "properties": {"name": "San Fransisco", "city_id": 2, "west_coast": true, "country_code": "US"}}::vertex - {"id": 1970324836974595, "label": "City", "properties": {"name": "Los Angeles", "city_id": 3, "west_coast": true, "country_code": "US"}}::vertex - {"id": 1970324836974596, "label": "City", "properties": {"name": "Seattle", "city_id": 4, "west_coast": true, "country_code": "US"}}::vertex - {"id": 1970324836974597, "label": "City", "properties": {"name": "Vancouver", "city_id": 5, "west_coast": true, "country_code": "CA"}}::vertex + n +------------------------------------------------------------------------------------------------------------------------------------------------------ + {"id": 1970324836974594, "label": ["City"], "properties": {"name": "San Fransisco", "city_id": 2, "west_coast": true, "country_code": "US"}}::vertex + {"id": 1970324836974595, "label": ["City"], "properties": {"name": "Los Angeles", "city_id": 3, "west_coast": true, "country_code": "US"}}::vertex + {"id": 1970324836974596, "label": ["City"], "properties": {"name": "Seattle", "city_id": 4, "west_coast": true, "country_code": "US"}}::vertex + {"id": 1970324836974597, "label": ["City"], "properties": {"name": "Vancouver", "city_id": 5, "west_coast": true, "country_code": "CA"}}::vertex (4 rows) SELECT * FROM cypher('cypher_index', $$ MATCH (c:Country {life_expectancy: 82.05}) RETURN c $$) as (n agtype); - n ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 1407374883553282, "label": "Country", "properties": {"gdp": 1.643::numeric, "name": "Canada", "country_code": "CA", "life_expectancy": 82.05}}::vertex + n +----------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 1407374883553282, "label": ["Country"], "properties": {"gdp": 1.643::numeric, "name": "Canada", "country_code": "CA", "life_expectancy": 82.05}}::vertex (1 row) SELECT * FROM cypher('cypher_index', $$ MATCH (c:Country {gdp: 20.94::numeric}) RETURN c $$) as (n agtype); - n ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 1407374883553281, "label": "Country", "properties": {"gdp": 20.94::numeric, "name": "United States", "country_code": "US", "life_expectancy": 78.79}}::vertex + n +------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + {"id": 1407374883553281, "label": ["Country"], "properties": {"gdp": 20.94::numeric, "name": "United States", "country_code": "US", "life_expectancy": 78.79}}::vertex (1 row) DROP INDEX cypher_index.load_city_gin_idx; diff --git a/regress/expected/jsonb_operators.out b/regress/expected/jsonb_operators.out index 8e2f7a20f..bc57ff698 100644 --- a/regress/expected/jsonb_operators.out +++ b/regress/expected/jsonb_operators.out @@ -2233,51 +2233,51 @@ SELECT '{"id": 1688849860263937, "label": "EDGE", "end_id": 1970324836974593, "s (1 row) SELECT '{"id": 844424930131969, "label": "v", "properties": {}}::vertex'::agtype || '{"id": 844424930131971, "label": "v", "properties": {"key": "value"}}::vertex'::agtype; - ?column? --------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 844424930131969, "label": "v", "properties": {}}::vertex, {"id": 844424930131971, "label": "v", "properties": {"key": "value"}}::vertex] + ?column? +------------------------------------------------------------------------------------------------------------------------------------------------------ + [{"id": 844424930131969, "label": ["v"], "properties": {}}::vertex, {"id": 844424930131971, "label": ["v"], "properties": {"key": "value"}}::vertex] (1 row) SELECT '{"id": 844424930131969, "label": "v", "properties": {}}::vertex'::agtype || '[]'::agtype; - ?column? -------------------------------------------------------------------- - [{"id": 844424930131969, "label": "v", "properties": {}}::vertex] + ?column? +--------------------------------------------------------------------- + [{"id": 844424930131969, "label": ["v"], "properties": {}}::vertex] (1 row) SELECT '{"id": 844424930131969, "label": "v", "properties": {}}::vertex'::agtype || '{}'::agtype; - ?column? ------------------------------------------------------------------------ - [{"id": 844424930131969, "label": "v", "properties": {}}::vertex, {}] + ?column? +------------------------------------------------------------------------- + [{"id": 844424930131969, "label": ["v"], "properties": {}}::vertex, {}] (1 row) SELECT '{}'::agtype || '{"id": 844424930131969, "label": "v", "properties": {}}::vertex'::agtype; - ?column? ------------------------------------------------------------------------ - [{}, {"id": 844424930131969, "label": "v", "properties": {}}::vertex] + ?column? +------------------------------------------------------------------------- + [{}, {"id": 844424930131969, "label": ["v"], "properties": {}}::vertex] (1 row) SELECT '"id"'::agtype || '{"id": 844424930131969, "label": "v", "properties": {}}::vertex'::agtype; - ?column? -------------------------------------------------------------------------- - ["id", {"id": 844424930131969, "label": "v", "properties": {}}::vertex] + ?column? +--------------------------------------------------------------------------- + ["id", {"id": 844424930131969, "label": ["v"], "properties": {}}::vertex] (1 row) SELECT '{"id": 844424930131969, "label": "v", "properties": {}}::vertex'::agtype || '{"id": 1688849860263950, "label": "e_var", "end_id": 281474976710662, "start_id": 281474976710661, "properties": {}}::edge'::agtype; - ?column? ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - [{"id": 844424930131969, "label": "v", "properties": {}}::vertex, {"id": 1688849860263950, "label": "e_var", "end_id": 281474976710662, "start_id": 281474976710661, "properties": {}}::edge] + ?column? +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 844424930131969, "label": ["v"], "properties": {}}::vertex, {"id": 1688849860263950, "label": "e_var", "end_id": 281474976710662, "start_id": 281474976710661, "properties": {}}::edge] (1 row) SELECT '[{"id": 281474976710672, "label": "", "properties": {}}::vertex, {"id": 1688849860263960, "label": "e_var", "end_id": 281474976710673, "start_id": 281474976710672, "properties": {}}::edge, {"id": 281474976710673, "label": "", "properties": {}}::vertex]::path'::agtype || '{"id": 844424930131969, "label": "v", "properties": {}}::vertex'::agtype; - ?column? ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [[{"id": 281474976710672, "label": "", "properties": {}}::vertex, {"id": 1688849860263960, "label": "e_var", "end_id": 281474976710673, "start_id": 281474976710672, "properties": {}}::edge, {"id": 281474976710673, "label": "", "properties": {}}::vertex]::path, {"id": 844424930131969, "label": "v", "properties": {}}::vertex] + ?column? +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [[{"id": 281474976710672, "label": [], "properties": {}}::vertex, {"id": 1688849860263960, "label": "e_var", "end_id": 281474976710673, "start_id": 281474976710672, "properties": {}}::edge, {"id": 281474976710673, "label": [], "properties": {}}::vertex]::path, {"id": 844424930131969, "label": ["v"], "properties": {}}::vertex] (1 row) SELECT '[{"id": 281474976710672, "label": "", "properties": {}}::vertex, {"id": 1688849860263960, "label": "e_var", "end_id": 281474976710673, "start_id": 281474976710672, "properties": {}}::edge, {"id": 281474976710673, "label": "", "properties": {}}::vertex]::path'::agtype || '[{"id": 281474976710672, "label": "", "properties": {}}::vertex, {"id": 1688849860263960, "label": "e_var", "end_id": 281474976710673, "start_id": 281474976710672, "properties": {}}::edge, {"id": 281474976710673, "label": "", "properties": {}}::vertex]::path'::agtype; ?column? ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - [[{"id": 281474976710672, "label": "", "properties": {}}::vertex, {"id": 1688849860263960, "label": "e_var", "end_id": 281474976710673, "start_id": 281474976710672, "properties": {}}::edge, {"id": 281474976710673, "label": "", "properties": {}}::vertex]::path, [{"id": 281474976710672, "label": "", "properties": {}}::vertex, {"id": 1688849860263960, "label": "e_var", "end_id": 281474976710673, "start_id": 281474976710672, "properties": {}}::edge, {"id": 281474976710673, "label": "", "properties": {}}::vertex]::path] + [[{"id": 281474976710672, "label": [], "properties": {}}::vertex, {"id": 1688849860263960, "label": "e_var", "end_id": 281474976710673, "start_id": 281474976710672, "properties": {}}::edge, {"id": 281474976710673, "label": [], "properties": {}}::vertex]::path, [{"id": 281474976710672, "label": [], "properties": {}}::vertex, {"id": 1688849860263960, "label": "e_var", "end_id": 281474976710673, "start_id": 281474976710672, "properties": {}}::edge, {"id": 281474976710673, "label": [], "properties": {}}::vertex]::path] (1 row) -- using concat more than once in a query @@ -3569,19 +3569,19 @@ SELECT * FROM cypher('jsonb_operators', $$ WITH {b: [1,2,3]} AS m WITH m, m || { SELECT * FROM cypher('jsonb_operators', $$ MATCH(n) RETURN n || 1 || 'string' $$) AS (result agtype); result ---------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710657, "label": "", "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex, 1, "string"] + [{"id": 281474976710657, "label": [], "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex, 1, "string"] (1 row) SELECT * FROM cypher('jsonb_operators', $$ MATCH(n) RETURN n || {list: [true, null]} $$) AS (result agtype); result --------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710657, "label": "", "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex, {"list": [true, null]}] + [{"id": 281474976710657, "label": [], "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex, {"list": [true, null]}] (1 row) SELECT * FROM cypher('jsonb_operators', $$ MATCH (n) MATCH(m) RETURN n || m $$) AS (result agtype); result ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710657, "label": "", "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex, {"id": 281474976710657, "label": "", "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex] + [{"id": 281474976710657, "label": [], "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex, {"id": 281474976710657, "label": [], "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex] (1 row) SELECT * FROM cypher('jsonb_operators', $$ MATCH (n) RETURN n.list || [1, 2, 3] $$) AS (result agtype); @@ -3605,7 +3605,7 @@ SELECT * FROM cypher('jsonb_operators', $$ MATCH (n) RETURN n.json || n.json $$) SELECT * FROM cypher('jsonb_operators', $$ MATCH (n) RETURN n.json || n $$) AS (result agtype); result ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, {"id": 281474976710657, "label": "", "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex] + [{"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, {"id": 281474976710657, "label": [], "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex] (1 row) -- should give an error @@ -3627,7 +3627,7 @@ FROM cypher('jsonb_operators', $$ $$) as (a agtype); a ------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex + {"id": 281474976710657, "label": [], "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex (1 row) SELECT * @@ -3638,7 +3638,7 @@ FROM cypher('jsonb_operators', $$ $$) as (a agtype); a ------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex + {"id": 281474976710657, "label": [], "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex (1 row) SELECT * @@ -3649,7 +3649,7 @@ FROM cypher('jsonb_operators', $$ $$) as (a agtype); a ------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex + {"id": 281474976710657, "label": [], "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex (1 row) SELECT * @@ -3660,7 +3660,7 @@ FROM cypher('jsonb_operators', $$ $$) as (a agtype); a ------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex + {"id": 281474976710657, "label": [], "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex (1 row) SELECT * @@ -3671,7 +3671,7 @@ FROM cypher('jsonb_operators', $$ $$) as (a agtype); a ------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex + {"id": 281474976710657, "label": [], "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex (1 row) SELECT * @@ -3682,7 +3682,7 @@ FROM cypher('jsonb_operators', $$ $$) as (a agtype); a ------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex + {"id": 281474976710657, "label": [], "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex (1 row) SELECT * @@ -3693,7 +3693,7 @@ FROM cypher('jsonb_operators', $$ $$) as (a agtype); a ------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex + {"id": 281474976710657, "label": [], "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex (1 row) SELECT * @@ -3704,7 +3704,7 @@ FROM cypher('jsonb_operators', $$ $$) as (a agtype); a ------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex + {"id": 281474976710657, "label": [], "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex (1 row) SELECT * @@ -3766,7 +3766,7 @@ FROM cypher('jsonb_operators', $$ $$) as (a agtype); a ------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex + {"id": 281474976710657, "label": [], "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex (1 row) SELECT * @@ -3777,7 +3777,7 @@ FROM cypher('jsonb_operators', $$ $$) as (a agtype); a ------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex + {"id": 281474976710657, "label": [], "properties": {"json": {"a": 1, "b": ["a", "b"], "c": {"d": "a"}}, "list": ["a", "b", "c"]}}::vertex (1 row) SELECT * diff --git a/regress/expected/multiple_label.out b/regress/expected/multiple_label.out index af2dcdafb..3460245ab 100644 --- a/regress/expected/multiple_label.out +++ b/regress/expected/multiple_label.out @@ -530,7 +530,7 @@ NOTICE: graph "mlabels8" has been created (1 row) CREATE VIEW mlabels8.catalog AS - SELECT name, relation, allrelations + SELECT name, relation, allrelations, rel_kind FROM ag_catalog.ag_label WHERE graph IN (SELECT graphid @@ -544,13 +544,13 @@ SELECT * FROM cypher('mlabels8', $$ CREATE (:a:b) $$) as (":a:b" agtype); (0 rows) SELECT * FROM mlabels8.catalog; - name | relation | allrelations -------------------+---------------------------+------------------------------- - _ag_label_edge | mlabels8._ag_label_edge | {mlabels8._ag_label_edge} - _ag_label_vertex | mlabels8._ag_label_vertex | {mlabels8._ag_label_vertex} - _agr_ab | mlabels8._agr_ab | {mlabels8._agr_ab} - a | mlabels8.a | {mlabels8.a,mlabels8._agr_ab} - b | mlabels8.b | {mlabels8.b,mlabels8._agr_ab} + name | relation | allrelations | rel_kind +------------------+---------------------------+-------------------------------+---------- + _ag_label_edge | mlabels8._ag_label_edge | {mlabels8._ag_label_edge} | d + _ag_label_vertex | mlabels8._ag_label_vertex | {mlabels8._ag_label_vertex} | d + _agr_ab | mlabels8._agr_ab | {mlabels8._agr_ab} | i + a | mlabels8.a | {mlabels8.a,mlabels8._agr_ab} | s + b | mlabels8.b | {mlabels8.b,mlabels8._agr_ab} | s (5 rows) -- creates :c and :bc @@ -560,15 +560,15 @@ SELECT * FROM cypher('mlabels8', $$ CREATE (:b:c) $$) as (":b:c" agtype); (0 rows) SELECT * FROM mlabels8.catalog; - name | relation | allrelations -------------------+---------------------------+------------------------------------------------ - _ag_label_edge | mlabels8._ag_label_edge | {mlabels8._ag_label_edge} - _ag_label_vertex | mlabels8._ag_label_vertex | {mlabels8._ag_label_vertex} - _agr_ab | mlabels8._agr_ab | {mlabels8._agr_ab} - _agr_bc | mlabels8._agr_bc | {mlabels8._agr_bc} - a | mlabels8.a | {mlabels8.a,mlabels8._agr_ab} - b | mlabels8.b | {mlabels8.b,mlabels8._agr_ab,mlabels8._agr_bc} - c | mlabels8.c | {mlabels8.c,mlabels8._agr_bc} + name | relation | allrelations | rel_kind +------------------+---------------------------+------------------------------------------------+---------- + _ag_label_edge | mlabels8._ag_label_edge | {mlabels8._ag_label_edge} | d + _ag_label_vertex | mlabels8._ag_label_vertex | {mlabels8._ag_label_vertex} | d + _agr_ab | mlabels8._agr_ab | {mlabels8._agr_ab} | i + _agr_bc | mlabels8._agr_bc | {mlabels8._agr_bc} | i + a | mlabels8.a | {mlabels8.a,mlabels8._agr_ab} | s + b | mlabels8.b | {mlabels8.b,mlabels8._agr_ab,mlabels8._agr_bc} | s + c | mlabels8.c | {mlabels8.c,mlabels8._agr_bc} | s (7 rows) -- :a:b:c inserted in other labels' allrelations column @@ -578,16 +578,16 @@ SELECT * FROM cypher('mlabels8', $$ CREATE (:a:b:c) $$) as (":a:b:c" agtype); (0 rows) SELECT * FROM mlabels8.catalog; - name | relation | allrelations -------------------+---------------------------+------------------------------------------------------------------ - _ag_label_edge | mlabels8._ag_label_edge | {mlabels8._ag_label_edge} - _ag_label_vertex | mlabels8._ag_label_vertex | {mlabels8._ag_label_vertex} - _agr_ab | mlabels8._agr_ab | {mlabels8._agr_ab} - _agr_abc | mlabels8._agr_abc | {mlabels8._agr_abc} - _agr_bc | mlabels8._agr_bc | {mlabels8._agr_bc} - a | mlabels8.a | {mlabels8.a,mlabels8._agr_ab,mlabels8._agr_abc} - b | mlabels8.b | {mlabels8.b,mlabels8._agr_ab,mlabels8._agr_bc,mlabels8._agr_abc} - c | mlabels8.c | {mlabels8.c,mlabels8._agr_bc,mlabels8._agr_abc} + name | relation | allrelations | rel_kind +------------------+---------------------------+------------------------------------------------------------------+---------- + _ag_label_edge | mlabels8._ag_label_edge | {mlabels8._ag_label_edge} | d + _ag_label_vertex | mlabels8._ag_label_vertex | {mlabels8._ag_label_vertex} | d + _agr_ab | mlabels8._agr_ab | {mlabels8._agr_ab} | i + _agr_abc | mlabels8._agr_abc | {mlabels8._agr_abc} | i + _agr_bc | mlabels8._agr_bc | {mlabels8._agr_bc} | i + a | mlabels8.a | {mlabels8.a,mlabels8._agr_ab,mlabels8._agr_abc} | s + b | mlabels8.b | {mlabels8.b,mlabels8._agr_ab,mlabels8._agr_bc,mlabels8._agr_abc} | s + c | mlabels8.c | {mlabels8.c,mlabels8._agr_bc,mlabels8._agr_abc} | s (8 rows) -- cleanup @@ -958,3 +958,200 @@ NOTICE: graph "mlabels11" has been dropped (1 row) +/* + * Internal functions _label_names() and _agtype_build_vertex + */ +SElECT create_graph('mlabels12'); +NOTICE: graph "mlabels12" has been created + create_graph +-------------- + +(1 row) + +-- check create +SELECT * FROM cypher('mlabels12', $$ CREATE (x:Person:Student {title: 'Person and Student'}) RETURN x $$) as (a agtype); + a +---------------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["Person", "Student"], "properties": {"title": "Person and Student"}}::vertex +(1 row) + +SELECT * FROM cypher('mlabels12', $$ CREATE (x:Person {title: 'Person only'}) RETURN x $$) as (a agtype); + a +----------------------------------------------------------------------------------------------- + {"id": 1125899906842625, "label": ["Person"], "properties": {"title": "Person only"}}::vertex +(1 row) + +SELECT * FROM cypher('mlabels12', $$ CREATE (x {title: 'No label'}) RETURN x $$) as (a agtype); + a +----------------------------------------------------------------------------------- + {"id": 281474976710657, "label": [], "properties": {"title": "No label"}}::vertex +(1 row) + +-- check _label_names +SELECT + v.properties -> '"title"' AS "title", + _label_names(g.id, v.id) +FROM + mlabels12._ag_label_vertex AS v, + (SELECT graphid AS id + FROM ag_catalog.ag_graph + WHERE name = 'mlabels12' + LIMIT 1) AS g; + title | _label_names +----------------------+----------------------- + "No label" | [] + "Person and Student" | ["Person", "Student"] + "Person only" | ["Person"] +(3 rows) + +-- check match +SELECT * FROM cypher('mlabels12', $$ MATCH (x) RETURN x $$) as ("MATCH" agtype); + MATCH +---------------------------------------------------------------------------------------------------------------- + {"id": 281474976710657, "label": [], "properties": {"title": "No label"}}::vertex + {"id": 844424930131969, "label": ["Person", "Student"], "properties": {"title": "Person and Student"}}::vertex + {"id": 1125899906842625, "label": ["Person"], "properties": {"title": "Person only"}}::vertex +(3 rows) + +-- check set +SELECT * FROM cypher('mlabels12', $$ MATCH (x) SET x.age = 32 RETURN x $$) as ("SET" agtype); + SET +--------------------------------------------------------------------------------------------------------------------------- + {"id": 281474976710657, "label": [], "properties": {"age": 32, "title": "No label"}}::vertex + {"id": 844424930131969, "label": ["Person", "Student"], "properties": {"age": 32, "title": "Person and Student"}}::vertex + {"id": 1125899906842625, "label": ["Person"], "properties": {"age": 32, "title": "Person only"}}::vertex +(3 rows) + +-- check merge +SELECT * FROM cypher('mlabels12', $$ MERGE (x:Teacher:Person) RETURN x $$) as ("MERGE" agtype); + MERGE +------------------------------------------------------------------------------------ + {"id": 1688849860263937, "label": ["Person", "Teacher"], "properties": {}}::vertex +(1 row) + +-- check vle +SELECT * FROM cypher('mlabels12', $$ CREATE (:a:b)-[:r]->(:k)-[:r]->(:m:n) $$) as (a agtype); + a +--- +(0 rows) + +SELECT * FROM cypher('mlabels12', $$ MATCH p=()-[*2]->() RETURN p $$) as ("VLE" agtype); + VLE +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 2251799813685249, "label": ["a", "b"], "properties": {}}::vertex, {"id": 3096224743817218, "label": "r", "end_id": 3377699720527873, "start_id": 2251799813685249, "properties": {}}::edge, {"id": 3377699720527873, "label": ["k"], "properties": {}}::vertex, {"id": 3096224743817217, "label": "r", "end_id": 3659174697238529, "start_id": 3377699720527873, "properties": {}}::edge, {"id": 3659174697238529, "label": ["m", "n"], "properties": {}}::vertex]::path +(1 row) + +-- check vertex typecast +SELECT agtype_typecast_vertex('{"id": 281474976710657, "label": ["a", "b"], "properties": {"age": 32}}'::agtype); + agtype_typecast_vertex +--------------------------------------------------------------------------------- + {"id": 281474976710657, "label": ["a", "b"], "properties": {"age": 32}}::vertex +(1 row) + +SELECT agtype_typecast_vertex('{"id": 281474976710657, "label": ["a"], "properties": {"age": 32}}'::agtype); + agtype_typecast_vertex +---------------------------------------------------------------------------- + {"id": 281474976710657, "label": ["a"], "properties": {"age": 32}}::vertex +(1 row) + +SELECT agtype_typecast_vertex('{"id": 281474976710657, "label": [], "properties": {"age": 32}}'::agtype); + agtype_typecast_vertex +------------------------------------------------------------------------- + {"id": 281474976710657, "label": [], "properties": {"age": 32}}::vertex +(1 row) + +SELECT agtype_typecast_vertex('{"id": 281474976710657, "label": "hello", "properties": {"age": 32}}'::agtype); + agtype_typecast_vertex +-------------------------------------------------------------------------------- + {"id": 281474976710657, "label": ["hello"], "properties": {"age": 32}}::vertex +(1 row) + +SELECT agtype_typecast_vertex('{"id": 281474976710657, "label": "", "properties": {"age": 32}}'::agtype); + agtype_typecast_vertex +------------------------------------------------------------------------- + {"id": 281474976710657, "label": [], "properties": {"age": 32}}::vertex +(1 row) + +-- check agtype_in +SELECT agtype_in('{"id": 281474976710657, "label": ["a", "b"], "properties": {"age": 32}}::vertex'); + agtype_in +--------------------------------------------------------------------------------- + {"id": 281474976710657, "label": ["a", "b"], "properties": {"age": 32}}::vertex +(1 row) + +SELECT agtype_in('{"id": 281474976710657, "label": ["a"], "properties": {"age": 32}}::vertex'); + agtype_in +---------------------------------------------------------------------------- + {"id": 281474976710657, "label": ["a"], "properties": {"age": 32}}::vertex +(1 row) + +SELECT agtype_in('{"id": 281474976710657, "label": [], "properties": {"age": 32}}::vertex'); + agtype_in +------------------------------------------------------------------------- + {"id": 281474976710657, "label": [], "properties": {"age": 32}}::vertex +(1 row) + +SELECT agtype_in('{"id": 281474976710657, "label": "hello", "properties": {"age": 32}}::vertex'); + agtype_in +-------------------------------------------------------------------------------- + {"id": 281474976710657, "label": ["hello"], "properties": {"age": 32}}::vertex +(1 row) + +SELECT agtype_in('{"id": 281474976710657, "label": "", "properties": {"age": 32}}::vertex'); + agtype_in +------------------------------------------------------------------------- + {"id": 281474976710657, "label": [], "properties": {"age": 32}}::vertex +(1 row) + +-- check age_labels +SELECT * FROM cypher('mlabels12', $$ MATCH (x) RETURN labels(x) $$) as ("labels" agtype); + labels +----------------------- + [] + ["Student", "Person"] + ["Person"] + ["Person", "Teacher"] + ["a", "b"] + ["k"] + ["m", "n"] +(7 rows) + +-- check startnode and endnode +SELECT * FROM cypher('mlabels12', $$ MATCH ()-[e]->() RETURN startNode(e) $$) as ("startNode" agtype); + startNode +------------------------------------------------------------------------- + {"id": 2251799813685249, "label": ["a", "b"], "properties": {}}::vertex + {"id": 3377699720527873, "label": ["k"], "properties": {}}::vertex +(2 rows) + +SELECT * FROM cypher('mlabels12', $$ MATCH ()-[e]->() RETURN endNode(e) $$) as ("endNode" agtype); + endNode +------------------------------------------------------------------------- + {"id": 3377699720527873, "label": ["k"], "properties": {}}::vertex + {"id": 3659174697238529, "label": ["m", "n"], "properties": {}}::vertex +(2 rows) + +-- cleanup +SElECT drop_graph('mlabels12', true); +NOTICE: drop cascades to 15 other objects +DETAIL: drop cascades to table mlabels12._ag_label_vertex +drop cascades to table mlabels12._ag_label_edge +drop cascades to table mlabels12."_agr_PersonStudent" +drop cascades to table mlabels12."Person" +drop cascades to table mlabels12."Student" +drop cascades to table mlabels12."_agr_PersonTeacher" +drop cascades to table mlabels12."Teacher" +drop cascades to table mlabels12._agr_ab +drop cascades to table mlabels12.a +drop cascades to table mlabels12.b +drop cascades to table mlabels12.r +drop cascades to table mlabels12.k +drop cascades to table mlabels12._agr_mn +drop cascades to table mlabels12.m +drop cascades to table mlabels12.n +NOTICE: graph "mlabels12" has been dropped + drop_graph +------------ + +(1 row) + diff --git a/regress/sql/agtype.sql b/regress/sql/agtype.sql index 016f457f2..21e750896 100644 --- a/regress/sql/agtype.sql +++ b/regress/sql/agtype.sql @@ -307,11 +307,11 @@ SELECT '{"a":1 , "b":2, "c":3}'::agtype - 'null'; SELECT '{"a":1 , "b":2, "c":3}'::agtype - '["c","b"]' - '[1]' - '["a"]'; SELECT 'null'::agtype - '1'; SELECT 'null'::agtype - '[1]'; -SELECT '{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype - '"a"'; -SELECT '{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype - '["a"]'; -SELECT '{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype - '[1]'; +SELECT '{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype - '"a"'; +SELECT '{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype - '["a"]'; +SELECT '{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype - '[1]'; SELECT '{"id": 1688849860263951, "label": "e_var", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {"id": 0}}::edge'::agtype - '{"id": 1688849860263951, "label": "e_var", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {"id": 0}}::edge'::agtype; -SELECT '{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype - '[]'; +SELECT '{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype - '[]'; -- -- Test operator + for extended functionality @@ -323,8 +323,8 @@ SELECT '[{"a":1 , "b":2, "c":3}]'::agtype + '[{"d": 4}]'; SELECT '{"a":1 , "b":2, "c":3}'::agtype + '["b", 2, {"d": 4}]'::agtype; SELECT '["b", 2, {"d": 4}]'::agtype + '{"a":1 , "b":2, "c":3}'::agtype; -SELECT '{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype + '[1]'; -SELECT '{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex'::agtype + '[1, "e", true]'; +SELECT '{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype + '[1]'; +SELECT '{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex'::agtype + '[1, "e", true]'; SELECT '[]'::agtype + '{}'; SELECT '[]'::agtype + '{"a": 1}'; @@ -336,13 +336,13 @@ SELECT '{}'::agtype + '{}'; SELECT '1'::agtype + '[{"a":1 , "b":2, "c":3}]'::agtype; -SELECT '{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex'::agtype + '{"d": 4}'; +SELECT '{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex'::agtype + '{"d": 4}'; -SELECT '{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex'::agtype + '{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex'::agtype; -SELECT '[{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex]::path'::agtype + ' [{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex]::path'::agtype; -SELECT '[{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex]::path'::agtype + '{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype; +SELECT '{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex'::agtype + '{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex'::agtype; +SELECT '[{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex]::path'::agtype + ' [{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex]::path'::agtype; +SELECT '[{"id": 1688849860263938, "label": ["v2"], "properties": {"id": "middle"}}::vertex, {"id": 1970324836974594, "label": "e2", "end_id": 1688849860263937, "start_id": 1688849860263938, "properties": {}}::edge, {"id": 1688849860263937, "label": ["v2"], "properties": {"id": "initial"}}::vertex]::path'::agtype + '{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888, "e": {"f": "abcdef", "g": {}, "h": [[], {}]}, "i": {"j": 199, "k": {"l": "mnopq"}}}}::vertex'::agtype; SELECT '{"id": 1688849860263951, "label": "e_var", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {"id": 0}}::edge'::agtype + '{"id": 1688849860263951, "label": "e_var", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {"id": 0}}::edge'::agtype; -SELECT '{"id": 1688849860263951, "label": "e_var", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {"id": 0}}::edge'::agtype + '{"id": 1125899906842625, "label": "Vertex", "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex'::agtype; +SELECT '{"id": 1688849860263951, "label": "e_var", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {"id": 0}}::edge'::agtype + '{"id": 1125899906842625, "label": ["Vertex"], "properties": {"a": "xyz", "b": true, "c": -19.888}}::vertex'::agtype; -- errors out SELECT '1'::agtype + '{"a":1 , "b":2, "c":3}'::agtype; @@ -535,14 +535,14 @@ SELECT agtype_in('[1,3,5,7,9,11]') < agtype_in('"string"'); SELECT agtype_in('{"bool":true, "integer":1}') < agtype_in('[1,3,5,7,9,11]'); SELECT agtype_in('[1, "string"]') < agtype_in('[1, 1]'); SELECT agtype_in('{"bool":true, "integer":1}') < agtype_in('{"bool":true, "integer":null}'); -SELECT agtype_in('{"id":0, "label": "v", "properties":{"i":0}}::vertex') < agtype_in('{"bool":true, "i":0}'); -SELECT agtype_in('{"id":2, "start_id":0, "end_id":1, "label": "e", "properties":{"i":0}}::edge') < agtype_in('{"id":0, "label": "v", "properties":{"i":0}}::vertex'); -SELECT agtype_in('[{"id": 0, "label": "v", "properties": {"i": 0}}::vertex, {"id": 2, "start_id": 0, "end_id": 1, "label": "e", "properties": {"i": 0}}::edge, {"id": 1, "label": "v", "properties": {"i": 0}}::vertex]::path') < agtype_in('{"id":2, "start_id":0, "end_id":1, "label": "e", "properties":{"i":0}}::edge'); +SELECT agtype_in('{"id":0, "label": ["v"], "properties":{"i":0}}::vertex') < agtype_in('{"bool":true, "i":0}'); +SELECT agtype_in('{"id":2, "start_id":0, "end_id":1, "label": "e", "properties":{"i":0}}::edge') < agtype_in('{"id":0, "label": ["v"], "properties":{"i":0}}::vertex'); +SELECT agtype_in('[{"id": 0, "label": ["v"], "properties": {"i": 0}}::vertex, {"id": 2, "start_id": 0, "end_id": 1, "label": "e", "properties": {"i": 0}}::edge, {"id": 1, "label": ["v"], "properties": {"i": 0}}::vertex]::path') < agtype_in('{"id":2, "start_id":0, "end_id":1, "label": "e", "properties":{"i":0}}::edge'); SELECT agtype_in('1::numeric') < agtype_in('null'); SELECT agtype_in('true') < agtype_in('1::numeric'); -- Testing orderability between types SELECT * FROM create_graph('orderability_graph'); -SELECT * FROM cypher('orderability_graph', $$ CREATE (:vertex {prop: null}), (:vertex {prop: 1}), (:vertex {prop: 1.01}),(:vertex {prop: true}), (:vertex {prop:"string"}),(:vertex {prop:"string_2"}), (:vertex {prop:[1, 2, 3]}), (:vertex {prop:[1, 2, 3, 4, 5]}), (:vertex {prop:{bool:true, i:0}}), (:vertex {prop:{bool:true, i:null}}), (:vertex {prop: {id:0, label: "v", properties:{i:0}}::vertex}), (:vertex {prop: {id: 2, start_id: 0, end_id: 1, label: "e", properties: {i: 0}}::edge}), (:vertex {prop: [{id: 0, label: "v", properties: {i: 0}}::vertex, {id: 2, start_id: 0, end_id: 1, label: "e", properties: {i: 0}}::edge, {id: 1, label: "v", properties: {i: 0}}::vertex]::path}) $$) AS (x agtype); +SELECT * FROM cypher('orderability_graph', $$ CREATE (:vertex {prop: null}), (:vertex {prop: 1}), (:vertex {prop: 1.01}),(:vertex {prop: true}), (:vertex {prop:"string"}),(:vertex {prop:"string_2"}), (:vertex {prop:[1, 2, 3]}), (:vertex {prop:[1, 2, 3, 4, 5]}), (:vertex {prop:{bool:true, i:0}}), (:vertex {prop:{bool:true, i:null}}), (:vertex {prop: {id:0, label: ["v"], properties:{i:0}}::vertex}), (:vertex {prop: {id: 2, start_id: 0, end_id: 1, label: "e", properties: {i: 0}}::edge}), (:vertex {prop: [{id: 0, label: ["v"], properties: {i: 0}}::vertex, {id: 2, start_id: 0, end_id: 1, label: "e", properties: {i: 0}}::edge, {id: 1, label: ["v"], properties: {i: 0}}::vertex]::path}) $$) AS (x agtype); SELECT * FROM cypher('orderability_graph', $$ MATCH (n) RETURN n ORDER BY n.prop $$) AS (sorted agtype); SELECT * FROM cypher('orderability_graph', $$ MATCH (n) RETURN n ORDER BY n.prop DESC $$) AS (sorted agtype); SELECT * FROM drop_graph('orderability_graph', true); @@ -823,40 +823,40 @@ SELECT * FROM drop_graph('agtype_null_duplicate_test', true); -- Vertex -- --Basic Vertex Creation -SELECT _agtype_build_vertex('1'::graphid, $$label_name$$, agtype_build_map()); -SELECT _agtype_build_vertex('1'::graphid, $$label$$, agtype_build_map('id', 2)); +SELECT _agtype_build_vertex('1'::graphid, $$label_name$$::cstring, agtype_build_map()); +SELECT _agtype_build_vertex('1'::graphid, $$label$$::cstring, agtype_build_map('id', 2)); --Null properties -SELECT _agtype_build_vertex('1'::graphid, $$label_name$$, NULL); +SELECT _agtype_build_vertex('1'::graphid, $$label_name$$::cstring, NULL); --Test access operator -SELECT agtype_access_operator(_agtype_build_vertex('1'::graphid, $$label$$, +SELECT agtype_access_operator(_agtype_build_vertex('1'::graphid, $$label$$::cstring, agtype_build_map('id', 2)), '"id"'); -SELECT _agtype_build_vertex('1'::graphid, $$label$$, agtype_build_list()); +SELECT _agtype_build_vertex('1'::graphid, $$label$$::cstring, agtype_build_list()); --Vertex in a map SELECT agtype_build_map( 'vertex', - _agtype_build_vertex('1'::graphid, $$label_name$$, agtype_build_map())); + _agtype_build_vertex('1'::graphid, $$label_name$$::cstring, agtype_build_map())); SELECT agtype_access_operator( agtype_build_map( - 'vertex', _agtype_build_vertex('1'::graphid, $$label_name$$, + 'vertex', _agtype_build_vertex('1'::graphid, $$label_name$$::cstring, agtype_build_map('key', 'value')), - 'other_vertex', _agtype_build_vertex('1'::graphid, $$label_name$$, + 'other_vertex', _agtype_build_vertex('1'::graphid, $$label_name$$::cstring, agtype_build_map('key', 'other_value'))), '"vertex"'); --Vertex in a list SELECT agtype_build_list( - _agtype_build_vertex('1'::graphid, $$label_name$$, agtype_build_map()), - _agtype_build_vertex('2'::graphid, $$label_name$$, agtype_build_map())); + _agtype_build_vertex('1'::graphid, $$label_name$$::cstring, agtype_build_map()), + _agtype_build_vertex('2'::graphid, $$label_name$$::cstring, agtype_build_map())); SELECT agtype_access_operator( agtype_build_list( - _agtype_build_vertex('1'::graphid, $$label_name$$, + _agtype_build_vertex('1'::graphid, $$label_name$$::cstring, agtype_build_map('id', 3)), - _agtype_build_vertex('2'::graphid, $$label_name$$, + _agtype_build_vertex('2'::graphid, $$label_name$$::cstring, agtype_build_map('id', 4))), '0'); -- @@ -864,18 +864,18 @@ SELECT agtype_access_operator( -- --Basic Edge Creation SELECT _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label_name$$, agtype_build_map()); + $$label_name$$::cstring, agtype_build_map()); SELECT _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label$$, agtype_build_map('id', 2)); + $$label$$::cstring, agtype_build_map('id', 2)); --Null properties SELECT _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label_name$$, NULL); + $$label_name$$::cstring, NULL); --Test access operator SELECT agtype_access_operator(_agtype_build_edge('1'::graphid, '2'::graphid, - '3'::graphid, $$label$$, agtype_build_map('id', 2)),'"id"'); + '3'::graphid, $$label$$::cstring, agtype_build_map('id', 2)),'"id"'); @@ -883,97 +883,97 @@ SELECT agtype_access_operator(_agtype_build_edge('1'::graphid, '2'::graphid, SELECT agtype_build_map( 'edge', _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label_name$$, agtype_build_map())); + $$label_name$$::cstring, agtype_build_map())); SELECT agtype_access_operator( agtype_build_map( 'edge', _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label_name$$, agtype_build_map('key', 'value')), + $$label_name$$::cstring, agtype_build_map('key', 'value')), 'other_edge', _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label_name$$, agtype_build_map('key', 'other_value'))), + $$label_name$$::cstring, agtype_build_map('key', 'other_value'))), '"edge"'); --Edge in a list SELECT agtype_build_list( _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label_name$$, agtype_build_map()), + $$label_name$$::cstring, agtype_build_map()), _agtype_build_edge('2'::graphid, '2'::graphid, '3'::graphid, - $$label_name$$, agtype_build_map())); + $$label_name$$::cstring, agtype_build_map())); SELECT agtype_access_operator( agtype_build_list( - _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, $$label_name$$, + _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, $$label_name$$::cstring, agtype_build_map('id', 3)), - _agtype_build_edge('2'::graphid, '2'::graphid, '3'::graphid, $$label_name$$, + _agtype_build_edge('2'::graphid, '2'::graphid, '3'::graphid, $$label_name$$::cstring, agtype_build_map('id', 4))), '0'); -- Path SELECT _agtype_build_path( - _agtype_build_vertex('2'::graphid, $$label_name$$, agtype_build_map()), + _agtype_build_vertex('2'::graphid, $$label_name$$::cstring, agtype_build_map()), _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label$$, agtype_build_map('id', 2)), - _agtype_build_vertex('3'::graphid, $$label_name$$, agtype_build_map()) + $$label$$::cstring, agtype_build_map('id', 2)), + _agtype_build_vertex('3'::graphid, $$label_name$$::cstring, agtype_build_map()) ); --All these paths should produce Errors SELECT _agtype_build_path( - _agtype_build_vertex('2'::graphid, $$label_name$$, agtype_build_map()), + _agtype_build_vertex('2'::graphid, $$label_name$$::cstring, agtype_build_map()), _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label$$, agtype_build_map('id', 2)) + $$label$$::cstring, agtype_build_map('id', 2)) ); SELECT _agtype_build_path( - _agtype_build_vertex('2'::graphid, $$label_name$$, agtype_build_map()), + _agtype_build_vertex('2'::graphid, $$label_name$$::cstring, agtype_build_map()), _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label$$, agtype_build_map('id', 2)), - _agtype_build_vertex('3'::graphid, $$label_name$$, agtype_build_map()), + $$label$$::cstring, agtype_build_map('id', 2)), + _agtype_build_vertex('3'::graphid, $$label_name$$::cstring, agtype_build_map()), _agtype_build_edge('1'::graphid, '4'::graphid, '5'::graphid, - $$label$$, agtype_build_map('id', 2)) + $$label$$::cstring, agtype_build_map('id', 2)) ); SELECT _agtype_build_path( - _agtype_build_vertex('2'::graphid, $$label_name$$, agtype_build_map()), + _agtype_build_vertex('2'::graphid, $$label_name$$::cstring, agtype_build_map()), _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label$$, agtype_build_map('id', 2)), + $$label$$::cstring, agtype_build_map('id', 2)), NULL ); SELECT _agtype_build_path( - _agtype_build_vertex('2'::graphid, $$label_name$$, agtype_build_map()), + _agtype_build_vertex('2'::graphid, $$label_name$$::cstring, agtype_build_map()), _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label$$, agtype_build_map('id', 2)), + $$label$$::cstring, agtype_build_map('id', 2)), 1 ); SELECT _agtype_build_path( - _agtype_build_vertex('2'::graphid, $$label_name$$, agtype_build_map()), + _agtype_build_vertex('2'::graphid, $$label_name$$::cstring, agtype_build_map()), _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label$$, agtype_build_map('id', 2)), + $$label$$::cstring, agtype_build_map('id', 2)), _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label$$, agtype_build_map('id', 2)) + $$label$$::cstring, agtype_build_map('id', 2)) ); -- -- id, startid, endid -- -SELECT age_id(_agtype_build_vertex('1'::graphid, $$label_name$$, agtype_build_map())); +SELECT age_id(_agtype_build_vertex('1'::graphid, $$label_name$$::cstring, agtype_build_map())); SELECT age_id(_agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label_name$$, agtype_build_map('id', 2))); + $$label_name$$::cstring, agtype_build_map('id', 2))); SELECT age_start_id(_agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label_name$$, agtype_build_map('id', 2))); + $$label_name$$::cstring, agtype_build_map('id', 2))); SELECT age_end_id(_agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label_name$$, agtype_build_map('id', 2))); + $$label_name$$::cstring, agtype_build_map('id', 2))); SELECT age_id(_agtype_build_path( - _agtype_build_vertex('2'::graphid, $$label_name$$, agtype_build_map()), + _agtype_build_vertex('2'::graphid, $$label_name$$::cstring, agtype_build_map()), _agtype_build_edge('1'::graphid, '2'::graphid, '3'::graphid, - $$label$$, agtype_build_map('id', 2)), - _agtype_build_vertex('3'::graphid, $$label$$, agtype_build_map('id', 2)) + $$label$$::cstring, agtype_build_map('id', 2)), + _agtype_build_vertex('3'::graphid, $$label$$::cstring, agtype_build_map('id', 2)) )); SELECT age_id(agtype_in('1')); @@ -999,6 +999,43 @@ SELECT agtype_string_match_starts_with('"abcdefghijklmnopqrstuvwxyz"', '"bcde"') SELECT agtype_string_match_ends_with('"abcdefghijklmnopqrstuvwxyz"', '"vwxy"'); SELECT agtype_string_match_contains('"abcdefghijklmnopqrstuvwxyz"', '"hijl"'); +--Agtype Hash Comparison Function +SELECT agtype_hash_cmp(NULL); +SELECT agtype_hash_cmp('1'::agtype); +SELECT agtype_hash_cmp('1.0'::agtype); +SELECT agtype_hash_cmp('"1"'::agtype); +SELECT agtype_hash_cmp('[1]'::agtype); +SELECT agtype_hash_cmp('[1, 1]'::agtype); +SELECT agtype_hash_cmp('[1, 1, 1]'::agtype); +SELECT agtype_hash_cmp('[1, 1, 1, 1]'::agtype); +SELECT agtype_hash_cmp('[1, 1, 1, 1, 1]'::agtype); +SELECT agtype_hash_cmp('[[1]]'::agtype); +SELECT agtype_hash_cmp('[[1, 1]]'::agtype); +SELECT agtype_hash_cmp('[[1], 1]'::agtype); +SELECT agtype_hash_cmp('[1543872]'::agtype); +SELECT agtype_hash_cmp('[1, "abcde", 2.0]'::agtype); +SELECT agtype_hash_cmp(agtype_in('null')); +SELECT agtype_hash_cmp(agtype_in('[null]')); +SELECT agtype_hash_cmp(agtype_in('[null, null]')); +SELECT agtype_hash_cmp(agtype_in('[null, null, null]')); +SELECT agtype_hash_cmp(agtype_in('[null, null, null, null]')); +SELECT agtype_hash_cmp(agtype_in('[null, null, null, null, null]')); +SELECT agtype_hash_cmp('{"id":1, "label": ["test"], "properties":{"id":100}}'::agtype); +SELECT agtype_hash_cmp('{"id":1, "label": ["test"], "properties":{"id":100}}::vertex'::agtype); + +SELECT agtype_hash_cmp('{"id":2, "start_id":1, "end_id": 3, "label":"elabel", "properties":{}}'::agtype); +SELECT agtype_hash_cmp('{"id":2, "start_id":1, "end_id": 3, "label":"elabel", "properties":{}}::edge'::agtype); + +SELECT agtype_hash_cmp(' + [{"id":1, "label": ["test"], "properties":{"id":100}}::vertex, + {"id":2, "start_id":1, "end_id": 3, "label":"elabel", "properties":{}}::edge, + {"id":5, "label": ["vlabel"], "properties":{}}::vertex]'::agtype); + +SELECT agtype_hash_cmp(' + [{"id":1, "label": ["test"], "properties":{"id":100}}::vertex, + {"id":2, "start_id":1, "end_id": 3, "label":"elabel", "properties":{}}::edge, + {"id":5, "label": ["vlabel"], "properties":{}}::vertex]::path'::agtype); + --Agtype BTree Comparison Function SELECT agtype_btree_cmp('1'::agtype, '1'::agtype); SELECT agtype_btree_cmp('1'::agtype, '1.0'::agtype); @@ -1014,19 +1051,19 @@ SELECT agtype_btree_cmp(agtype_in('null'), NULL); SELECT agtype_btree_cmp( '1'::agtype, - '{"id":1, "label":"test", "properties":{"id":100}}::vertex'::agtype); + '{"id":1, "label": ["test"], "properties":{"id":100}}::vertex'::agtype); SELECT agtype_btree_cmp( - '{"id":1, "label":"test", "properties":{"id":100}}'::agtype, - '{"id":1, "label":"test", "properties":{"id":100}}'::agtype); + '{"id":1, "label": ["test"], "properties":{"id":100}}'::agtype, + '{"id":1, "label": ["test"], "properties":{"id":100}}'::agtype); SELECT agtype_btree_cmp( - '{"id":1, "label":"test", "properties":{"id":100}}'::agtype, - '{"id":1, "label":"test", "properties":{"id":200}}'::agtype); + '{"id":1, "label": ["test"], "properties":{"id":100}}'::agtype, + '{"id":1, "label": ["test"], "properties":{"id":200}}'::agtype); SELECT agtype_btree_cmp( - '{"id":1, "label":"test", "properties":{"id":100}}::vertex'::agtype, - '{"id":1, "label":"test", "properties":{"id":100}}::vertex'::agtype); + '{"id":1, "label": ["test"], "properties":{"id":100}}::vertex'::agtype, + '{"id":1, "label": ["test"], "properties":{"id":100}}::vertex'::agtype); SELECT agtype_btree_cmp( - '{"id":1, "label":"test", "properties":{"id":100}}::vertex'::agtype, - '{"id":1, "label":"test", "properties":{"id":200}}::vertex'::agtype); + '{"id":1, "label": ["test"], "properties":{"id":100}}::vertex'::agtype, + '{"id":1, "label": ["test"], "properties":{"id":200}}::vertex'::agtype); SELECT agtype_btree_cmp( '{"id":2, "start_id":1, "end_id": 3, "label":"elabel", "properties":{}}::edge'::agtype, '{"id":2, "start_id":1, "end_id": 3, "label":"elabel", "properties":{}}::edge'::agtype); @@ -1038,20 +1075,20 @@ SELECT agtype_btree_cmp( '{"id":8, "start_id":4, "end_id": 5, "label":"elabel", "properties":{"prop2": 2}}::edge'::agtype); SELECT agtype_btree_cmp( - '[{"id":1, "label":"test", "properties":{"id":100}}::vertex, + '[{"id":1, "label": ["test"], "properties":{"id":100}}::vertex, {"id":2, "start_id":1, "end_id": 3, "label":"elabel", "properties":{}}::edge, - {"id":3, "label":"vlabel", "properties":{}}::vertex]::path'::agtype, - '[{"id":1, "label":"test", "properties":{"id":100}}::vertex, + {"id":3, "label": ["vlabel"], "properties":{}}::vertex]::path'::agtype, + '[{"id":1, "label": ["test"], "properties":{"id":100}}::vertex, {"id":2, "start_id":1, "end_id": 3, "label":"elabel", "properties":{}}::edge, - {"id":3, "label":"vlabel", "properties":{}}::vertex]::path'::agtype); + {"id":3, "label": ["vlabel"], "properties":{}}::vertex]::path'::agtype); SELECT agtype_btree_cmp( - '[{"id":1, "label":"test", "properties":{"id":100}}::vertex, + '[{"id":1, "label": ["test"], "properties":{"id":100}}::vertex, {"id":2, "start_id":1, "end_id": 3, "label":"elabel", "properties":{}}::edge, - {"id":3, "label":"vlabel", "properties":{}}::vertex]::path'::agtype, - '[{"id":1, "label":"test", "properties":{"id":100}}::vertex, + {"id":3, "label": ["vlabel"], "properties":{}}::vertex]::path'::agtype, + '[{"id":1, "label": ["test"], "properties":{"id":100}}::vertex, {"id":2, "start_id":1, "end_id": 3, "label":"elabel", "properties":{}}::edge, - {"id":4, "label":"vlabel", "properties":{}}::vertex]::path'::agtype); + {"id":4, "label": ["vlabel"], "properties":{}}::vertex]::path'::agtype); --Int2 to Agtype in agtype_volatile_wrapper SELECT ag_catalog.agtype_volatile_wrapper(1::int2); diff --git a/regress/sql/multiple_label.sql b/regress/sql/multiple_label.sql index 0cc65aafe..288782fd5 100644 --- a/regress/sql/multiple_label.sql +++ b/regress/sql/multiple_label.sql @@ -145,7 +145,7 @@ SElECT drop_graph('mlabels7', true); */ SElECT create_graph('mlabels8'); CREATE VIEW mlabels8.catalog AS - SELECT name, relation, allrelations + SELECT name, relation, allrelations, rel_kind FROM ag_catalog.ag_label WHERE graph IN (SELECT graphid @@ -232,3 +232,52 @@ SELECT create_elabel('mlabels11', '_agr_pq'); SELECT * FROM cypher('mlabels11', $$ MATCH (x:a:b) RETURN x.title $$) as (a agtype); -- cleanup SElECT drop_graph('mlabels11', true); + + + +/* + * Internal functions _label_names() and _agtype_build_vertex + */ +SElECT create_graph('mlabels12'); +-- check create +SELECT * FROM cypher('mlabels12', $$ CREATE (x:Person:Student {title: 'Person and Student'}) RETURN x $$) as (a agtype); +SELECT * FROM cypher('mlabels12', $$ CREATE (x:Person {title: 'Person only'}) RETURN x $$) as (a agtype); +SELECT * FROM cypher('mlabels12', $$ CREATE (x {title: 'No label'}) RETURN x $$) as (a agtype); +-- check _label_names +SELECT + v.properties -> '"title"' AS "title", + _label_names(g.id, v.id) +FROM + mlabels12._ag_label_vertex AS v, + (SELECT graphid AS id + FROM ag_catalog.ag_graph + WHERE name = 'mlabels12' + LIMIT 1) AS g; +-- check match +SELECT * FROM cypher('mlabels12', $$ MATCH (x) RETURN x $$) as ("MATCH" agtype); +-- check set +SELECT * FROM cypher('mlabels12', $$ MATCH (x) SET x.age = 32 RETURN x $$) as ("SET" agtype); +-- check merge +SELECT * FROM cypher('mlabels12', $$ MERGE (x:Teacher:Person) RETURN x $$) as ("MERGE" agtype); +-- check vle +SELECT * FROM cypher('mlabels12', $$ CREATE (:a:b)-[:r]->(:k)-[:r]->(:m:n) $$) as (a agtype); +SELECT * FROM cypher('mlabels12', $$ MATCH p=()-[*2]->() RETURN p $$) as ("VLE" agtype); +-- check vertex typecast +SELECT agtype_typecast_vertex('{"id": 281474976710657, "label": ["a", "b"], "properties": {"age": 32}}'::agtype); +SELECT agtype_typecast_vertex('{"id": 281474976710657, "label": ["a"], "properties": {"age": 32}}'::agtype); +SELECT agtype_typecast_vertex('{"id": 281474976710657, "label": [], "properties": {"age": 32}}'::agtype); +SELECT agtype_typecast_vertex('{"id": 281474976710657, "label": "hello", "properties": {"age": 32}}'::agtype); +SELECT agtype_typecast_vertex('{"id": 281474976710657, "label": "", "properties": {"age": 32}}'::agtype); +-- check agtype_in +SELECT agtype_in('{"id": 281474976710657, "label": ["a", "b"], "properties": {"age": 32}}::vertex'); +SELECT agtype_in('{"id": 281474976710657, "label": ["a"], "properties": {"age": 32}}::vertex'); +SELECT agtype_in('{"id": 281474976710657, "label": [], "properties": {"age": 32}}::vertex'); +SELECT agtype_in('{"id": 281474976710657, "label": "hello", "properties": {"age": 32}}::vertex'); +SELECT agtype_in('{"id": 281474976710657, "label": "", "properties": {"age": 32}}::vertex'); +-- check age_labels +SELECT * FROM cypher('mlabels12', $$ MATCH (x) RETURN labels(x) $$) as ("labels" agtype); +-- check startnode and endnode +SELECT * FROM cypher('mlabels12', $$ MATCH ()-[e]->() RETURN startNode(e) $$) as ("startNode" agtype); +SELECT * FROM cypher('mlabels12', $$ MATCH ()-[e]->() RETURN endNode(e) $$) as ("endNode" agtype); +-- cleanup +SElECT drop_graph('mlabels12', true); diff --git a/sql/age_agtype.sql b/sql/age_agtype.sql index a6932cb1f..e6a0e20d6 100644 --- a/sql/age_agtype.sql +++ b/sql/age_agtype.sql @@ -1064,3 +1064,10 @@ CREATE FUNCTION ag_catalog.graph_exists(graph_name name) RETURNS agtype LANGUAGE c AS 'MODULE_PATHNAME', 'age_graph_exists'; + +CREATE FUNCTION ag_catalog._label_names(graph_oid oid, graphid) + RETURNS agtype + LANGUAGE c + IMMUTABLE +PARALLEL SAFE +AS 'MODULE_PATHNAME'; diff --git a/sql/age_main.sql b/sql/age_main.sql index 838dfd4b1..e4d666bc1 100644 --- a/sql/age_main.sql +++ b/sql/age_main.sql @@ -46,6 +46,14 @@ CREATE DOMAIN label_id AS int NOT NULL CHECK (VALUE > 0 AND VALUE <= 65535); CREATE DOMAIN label_kind AS "char" NOT NULL CHECK (VALUE = 'v' OR VALUE = 'e'); +CREATE DOMAIN rel_kind AS "char" + NOT NULL + CHECK ( + VALUE = 'd' OR -- default label's relation + VALUE = 's' OR -- a single label's relation + VALUE = 'i' -- an intersection relation + ); + CREATE TABLE ag_label ( name name NOT NULL, graph oid NOT NULL, @@ -54,6 +62,7 @@ CREATE TABLE ag_label ( relation regclass NOT NULL, seq_name name NOT NULL, allrelations regclass[] DEFAULT '{}', + rel_kind rel_kind, CONSTRAINT fk_graph_oid FOREIGN KEY(graph) REFERENCES ag_graph(graphid) @@ -369,6 +378,7 @@ CREATE FUNCTION ag_catalog._graphid(label_id int, entry_id bigint) PARALLEL SAFE AS 'MODULE_PATHNAME'; +-- // TODO: deprecated for vertices CREATE FUNCTION ag_catalog._label_name(graph_oid oid, graphid) RETURNS cstring LANGUAGE c @@ -376,6 +386,7 @@ CREATE FUNCTION ag_catalog._label_name(graph_oid oid, graphid) PARALLEL SAFE AS 'MODULE_PATHNAME'; + CREATE FUNCTION ag_catalog._extract_label_id(graphid) RETURNS label_id LANGUAGE c diff --git a/sql/agtype_graphid.sql b/sql/agtype_graphid.sql index 4e05943ae..b824fd390 100644 --- a/sql/agtype_graphid.sql +++ b/sql/agtype_graphid.sql @@ -57,7 +57,7 @@ AS 'MODULE_PATHNAME'; -- -- agtype - vertex -- -CREATE FUNCTION ag_catalog._agtype_build_vertex(graphid, cstring, agtype) +CREATE FUNCTION ag_catalog._agtype_build_vertex(graphid, agtype, agtype) RETURNS agtype LANGUAGE c IMMUTABLE @@ -65,6 +65,14 @@ CALLED ON NULL INPUT PARALLEL SAFE AS 'MODULE_PATHNAME'; +CREATE FUNCTION ag_catalog._agtype_build_vertex(graphid, cstring, agtype) + RETURNS agtype + LANGUAGE c + IMMUTABLE +CALLED ON NULL INPUT +PARALLEL SAFE +AS 'MODULE_PATHNAME', '_agtype_build_vertex_cstringlabel'; + -- -- agtype - edge -- diff --git a/src/backend/catalog/ag_label.c b/src/backend/catalog/ag_label.c index 9f32ce4aa..963da26bd 100644 --- a/src/backend/catalog/ag_label.c +++ b/src/backend/catalog/ag_label.c @@ -30,14 +30,20 @@ #include "commands/label_commands.h" #include "executor/cypher_utils.h" #include "utils/ag_cache.h" +#include "utils/graphid.h" +#include "utils/agtype_raw.h" + +static label_cache_data *get_entity_lcd(graphid entity_id, Oid graph_oid); +Datum _label_names(PG_FUNCTION_ARGS); /* * INSERT INTO ag_catalog.ag_label * VALUES (label_name, label_graph, label_id, label_kind, - * label_relation, seq_name) + * label_relation, seq_name, rel_kind) */ void insert_label(const char *label_name, Oid graph_oid, int32 label_id, - char label_kind, Oid label_relation, const char *seq_name) + char label_kind, Oid label_relation, const char *seq_name, + char rel_kind) { NameData label_name_data; NameData seq_name_data; @@ -91,6 +97,9 @@ void insert_label(const char *label_name, Oid graph_oid, int32 label_id, values[Anum_ag_label_allrelations - 1] = PointerGetDatum(allrelations); nulls[Anum_ag_label_allrelations - 1] = false; + values[Anum_ag_label_rel_kind - 1] = CharGetDatum(rel_kind); + nulls[Anum_ag_label_rel_kind - 1] = false; + tuple = heap_form_tuple(RelationGetDescr(ag_label), values, nulls); /* @@ -178,6 +187,35 @@ char *get_label_seq_relation_name(const char *label_name) return psprintf("%s_id_seq", label_name); } +static label_cache_data *get_entity_lcd(graphid entity_id, Oid graph_oid) +{ + label_cache_data *lcd; + int32 label_id; + + label_id = GET_LABEL_ID(entity_id); + lcd = search_label_graph_oid_cache(graph_oid, label_id); + Assert(lcd); + + return lcd; +} + +Oid get_entity_reloid(graphid entity_id, Oid graph_oid) +{ + label_cache_data *lcd = get_entity_lcd(entity_id, graph_oid); + return lcd->relation; +} + +char *get_entity_relname(graphid entity_id, Oid graph_oid) +{ + label_cache_data *lcd = get_entity_lcd(entity_id, graph_oid); + return NameStr(lcd->name); +} + +Datum get_entity_labels(graphid entity_id, Oid graph_oid) +{ + return DirectFunctionCall2(_label_names, graph_oid, entity_id); +} + PG_FUNCTION_INFO_V1(_label_name); /* @@ -211,6 +249,48 @@ Datum _label_name(PG_FUNCTION_ARGS) PG_RETURN_CSTRING(label_name); } +PG_FUNCTION_INFO_V1(_label_names); + +/* + * Arguments: + * [0] = graph OID + * [1] = entity (vertex\edge) ID + * + * Returns: + * an array of string as agtype + */ +Datum _label_names(PG_FUNCTION_ARGS) +{ + Oid graph_oid; + graphid entity_id; + agtype *res; + List *lcds; + ListCell *lc; + agtype_build_state *bstate; + + Assert(!PG_ARGISNULL(0)); + Assert(!PG_ARGISNULL(1)); + + graph_oid = PG_GETARG_OID(0); + entity_id = AG_GETARG_GRAPHID(1); + + lcds = search_label_allrelations_cache( + get_entity_reloid(entity_id, graph_oid)); + + bstate = init_agtype_build_state(list_length(lcds), AGT_FARRAY); + + foreach (lc, lcds) + { + label_cache_data *lcd = lfirst(lc); + write_string(bstate, NameStr(lcd->name)); + } + + res = build_agtype(bstate); + pfree_agtype_build_state(bstate); + + AG_RETURN_AGTYPE_P(res); +} + PG_FUNCTION_INFO_V1(_label_id); Datum _label_id(PG_FUNCTION_ARGS) diff --git a/src/backend/commands/graph_commands.c b/src/backend/commands/graph_commands.c index f7e8d070b..cc863a5f1 100644 --- a/src/backend/commands/graph_commands.c +++ b/src/backend/commands/graph_commands.c @@ -98,14 +98,16 @@ Oid create_graph_internal(const Name graph_name) nsp_id = create_schema_for_graph(graph_name); /* inserts the graph info into the relation which has all the other existing graphs info */ - insert_graph(graph_name, nsp_id); + insert_graph(graph_name, nsp_id); /* Increment the Command counter before create the generic labels. */ CommandCounterIncrement(); /* Create the default label tables */ - create_label(graph_name_str, AG_DEFAULT_LABEL_VERTEX, LABEL_TYPE_VERTEX, NIL); - create_label(graph_name_str, AG_DEFAULT_LABEL_EDGE, LABEL_TYPE_EDGE, NIL); + create_label(graph_name_str, AG_DEFAULT_LABEL_VERTEX, LABEL_TYPE_VERTEX, + LABEL_REL_KIND_DEFAULT, NIL); + create_label(graph_name_str, AG_DEFAULT_LABEL_EDGE, LABEL_TYPE_EDGE, + LABEL_REL_KIND_DEFAULT, NIL); return nsp_id; } diff --git a/src/backend/commands/label_commands.c b/src/backend/commands/label_commands.c index 73097a5be..1fb4e26f8 100644 --- a/src/backend/commands/label_commands.c +++ b/src/backend/commands/label_commands.c @@ -203,7 +203,8 @@ Datum create_vlabel(PG_FUNCTION_ARGS) parent = list_make1(rv); - create_label(graph_name, label_name, LABEL_TYPE_VERTEX, parent); + create_label(graph_name, label_name, LABEL_TYPE_VERTEX, + LABEL_REL_KIND_SINGLE, parent); ereport(NOTICE, (errmsg("VLabel \"%s\" has been created", label_name))); @@ -285,7 +286,8 @@ Datum create_elabel(PG_FUNCTION_ARGS) rv = get_label_range_var(graph_name, graph_oid, AG_DEFAULT_LABEL_EDGE); parent = list_make1(rv); - create_label(graph_name, label_name, LABEL_TYPE_EDGE, parent); + create_label(graph_name, label_name, LABEL_TYPE_EDGE, + LABEL_REL_KIND_SINGLE, parent); ereport(NOTICE, (errmsg("ELabel \"%s\" has been created", label_name))); @@ -299,7 +301,7 @@ Datum create_elabel(PG_FUNCTION_ARGS) * ag_catalog.ag_label. */ void create_label(char *graph_name, char *label_name, char label_type, - List *parents) + char rel_kind, List *parents) { graph_cache_data *cache_data; Oid graph_oid; @@ -352,7 +354,7 @@ void create_label(char *graph_name, char *label_name, char label_type, label_id = get_new_label_id(graph_oid, nsp_id); insert_label(label_name, graph_oid, label_id, label_type, - relation_id, seq_name); + relation_id, seq_name, rel_kind); CommandCounterIncrement(); } diff --git a/src/backend/executor/cypher_create.c b/src/backend/executor/cypher_create.c index 274960bb0..1c57e5b12 100644 --- a/src/backend/executor/cypher_create.c +++ b/src/backend/executor/cypher_create.c @@ -516,16 +516,14 @@ static Datum create_vertex(cypher_create_custom_scan_state *css, TupleTableSlot *scantuple; PlanState *ps; Datum result; - char *label_name = - !LABEL_EXPR_IS_EMPTY(node->label_expr) ? - (char *)strVal(linitial(node->label_expr->label_names)) : - ""; + Datum labels; ps = css->css.ss.ps.lefttree; scantuple = ps->ps_ExprContext->ecxt_scantuple; + labels = get_entity_labels(id, css->graph_oid); // make the vertex agtype - result = make_vertex(id, CStringGetDatum(label_name), + result = make_vertex(id, labels, scanTupleSlot->tts_values[node->prop_attr_num]); /* append to the path list */ diff --git a/src/backend/executor/cypher_delete.c b/src/backend/executor/cypher_delete.c index 6bb869833..61acc7c86 100644 --- a/src/backend/executor/cypher_delete.c +++ b/src/backend/executor/cypher_delete.c @@ -370,12 +370,11 @@ static void process_delete_list(CustomScanState *node) foreach(lc, css->delete_data->delete_items) { cypher_delete_item *item; - agtype_value *original_entity_value, *id, *label; + agtype_value *original_entity_value, *id; ScanKeyData scan_keys[1]; TableScanDesc scan_desc; ResultRelInfo *resultRelInfo; HeapTuple heap_tuple; - char *label_name; Integer *pos; int entity_position; @@ -392,10 +391,11 @@ static void process_delete_list(CustomScanState *node) entity_position); id = GET_AGTYPE_VALUE_OBJECT_VALUE(original_entity_value, "id"); - label = GET_AGTYPE_VALUE_OBJECT_VALUE(original_entity_value, "label"); - label_name = pnstrdup(label->val.string.val, label->val.string.len); - resultRelInfo = create_entity_result_rel_info(estate, css->delete_data->graph_name, label_name); + resultRelInfo = create_entity_result_rel_info( + estate, css->delete_data->graph_name, + get_entity_relname(id->val.int_value, + css->delete_data->graph_oid)); /* * Setup the scan key to require the id field on-disc to match the diff --git a/src/backend/executor/cypher_merge.c b/src/backend/executor/cypher_merge.c index f6c64be79..706f1a0d6 100644 --- a/src/backend/executor/cypher_merge.c +++ b/src/backend/executor/cypher_merge.c @@ -1121,13 +1121,11 @@ static Datum merge_vertex(cypher_merge_custom_scan_state *css, if (CYPHER_TARGET_NODE_OUTPUT(node->flags)) { Datum result; - char *label_name = - !LABEL_EXPR_IS_EMPTY(node->label_expr) ? - (char *)strVal(linitial(node->label_expr->label_names)) : - ""; + Datum labels; /* make the vertex agtype */ - result = make_vertex(id, CStringGetDatum(label_name), prop); + labels = get_entity_labels(id, css->graph_oid); + result = make_vertex(id, labels, prop); /* append to the path list */ if (CYPHER_TARGET_NODE_IN_PATH(node->flags)) diff --git a/src/backend/executor/cypher_set.c b/src/backend/executor/cypher_set.c index f8a04d24b..819cbcc08 100644 --- a/src/backend/executor/cypher_set.c +++ b/src/backend/executor/cypher_set.c @@ -23,6 +23,11 @@ #include "executor/cypher_executor.h" #include "executor/cypher_utils.h" +#include "nodes/cypher_nodes.h" +#include "utils/agtype.h" +#include "utils/graphid.h" +#include "utils/ag_cache.h" +#include "catalog/ag_label.h" static void begin_cypher_set(CustomScanState *node, EState *estate, int eflags); @@ -396,12 +401,12 @@ static void process_update_list(CustomScanState *node) ScanKeyData scan_keys[1]; TableScanDesc scan_desc; bool remove_property; - char *label_name; cypher_update_item *update_item; Datum new_entity; HeapTuple heap_tuple; char *clause_name = css->set_list->clause_name; int cid; + graph_cache_data *gcd; update_item = (cypher_update_item *)lfirst(lc); @@ -438,7 +443,6 @@ static void process_update_list(CustomScanState *node) id = GET_AGTYPE_VALUE_OBJECT_VALUE(original_entity_value, "id"); label = GET_AGTYPE_VALUE_OBJECT_VALUE(original_entity_value, "label"); - label_name = pnstrdup(label->val.string.val, label->val.string.len); /* get the properties we need to update */ original_properties = GET_AGTYPE_VALUE_OBJECT_VALUE(original_entity_value, "properties"); @@ -498,8 +502,10 @@ static void process_update_list(CustomScanState *node) } } + gcd = search_graph_name_cache(css->set_list->graph_name); resultRelInfo = create_entity_result_rel_info( - estate, css->set_list->graph_name, label_name); + estate, css->set_list->graph_name, + get_entity_relname(id->val.int_value, gcd->oid)); slot = ExecInitExtraTupleSlot( estate, RelationGetDescr(resultRelInfo->ri_RelationDesc), @@ -512,14 +518,18 @@ static void process_update_list(CustomScanState *node) */ if (original_entity_value->type == AGTV_VERTEX) { - new_entity = make_vertex(GRAPHID_GET_DATUM(id->val.int_value), - CStringGetDatum(label_name), - AGTYPE_P_GET_DATUM(agtype_value_to_agtype(altered_properties))); + new_entity = + make_vertex(GRAPHID_GET_DATUM(id->val.int_value), + AGTYPE_P_GET_DATUM(agtype_value_to_agtype(label)), + AGTYPE_P_GET_DATUM( + agtype_value_to_agtype(altered_properties))); slot = populate_vertex_tts(slot, id, altered_properties); } else if (original_entity_value->type == AGTV_EDGE) { + char *label_name = pnstrdup(label->val.string.val, + label->val.string.len); agtype_value *startid = GET_AGTYPE_VALUE_OBJECT_VALUE(original_entity_value, "start_id"); agtype_value *endid = GET_AGTYPE_VALUE_OBJECT_VALUE(original_entity_value, "end_id"); diff --git a/src/backend/parser/cypher_clause.c b/src/backend/parser/cypher_clause.c index feaa40071..a052db633 100644 --- a/src/backend/parser/cypher_clause.c +++ b/src/backend/parser/cypher_clause.c @@ -5652,11 +5652,11 @@ static Node *make_vertex_expr(cypher_parsestate *cpstate, Assert(pnsi != NULL); func_oid = get_ag_func_oid("_agtype_build_vertex", 3, GRAPHIDOID, - CSTRINGOID, AGTYPEOID); + AGTYPEOID, AGTYPEOID); id = scanNSItemForColumn(pstate, pnsi, 0, AG_VERTEX_COLNAME_ID, -1); - label_name_func_oid = get_ag_func_oid("_label_name", 2, OIDOID, + label_name_func_oid = get_ag_func_oid("_label_names", 2, OIDOID, GRAPHIDOID); graph_oid_const = makeConst(OIDOID, -1, InvalidOid, sizeof(Oid), diff --git a/src/backend/parser/cypher_label_expr.c b/src/backend/parser/cypher_label_expr.c index f829bf5bf..fc14a9148 100644 --- a/src/backend/parser/cypher_label_expr.c +++ b/src/backend/parser/cypher_label_expr.c @@ -56,19 +56,28 @@ void create_label_expr_relations(Oid graphoid, char *graphname, { List *parents; char *ag_label_relation; + char rel_kind; + cypher_label_expr_type label_expr_type; - Assert(LABEL_EXPR_TYPE(label_expr) != LABEL_EXPR_TYPE_OR); + label_expr_type = LABEL_EXPR_TYPE(label_expr); + + Assert(label_expr_type != LABEL_EXPR_TYPE_OR); /* set default labels as parent unless it is the default label itself */ - if (LABEL_EXPR_TYPE(label_expr) == LABEL_EXPR_TYPE_EMPTY) + if (label_expr_type == LABEL_EXPR_TYPE_EMPTY) { parents = NIL; + rel_kind = LABEL_REL_KIND_DEFAULT; } else { char *parent_label_name; RangeVar *parent_rv; + rel_kind = label_expr_type == LABEL_EXPR_TYPE_SINGLE ? + LABEL_REL_KIND_SINGLE : + LABEL_REL_KIND_INTR; + parent_label_name = label_expr_kind == LABEL_KIND_VERTEX ? AG_DEFAULT_LABEL_VERTEX : AG_DEFAULT_LABEL_EDGE; @@ -94,14 +103,15 @@ void create_label_expr_relations(Oid graphoid, char *graphname, return; } - /* this function creates ag_label entry and relation */ - create_label(graphname, ag_label_relation, label_expr_kind, parents); + /* creates ag_label entry and relation */ + create_label(graphname, ag_label_relation, label_expr_kind, rel_kind, + parents); /* * For multiple labels (AND expression), processes each individual labels * as described above. */ - if (LABEL_EXPR_TYPE(label_expr) == LABEL_EXPR_TYPE_AND) + if (label_expr_type == LABEL_EXPR_TYPE_AND) { ListCell *lc; Relation ag_label; @@ -118,7 +128,8 @@ void create_label_expr_relations(Oid graphoid, char *graphname, if (!label_exists(label_name, graphoid)) { - create_label(graphname, label_name, label_expr_kind, parents); + create_label(graphname, label_name, label_expr_kind, + LABEL_REL_KIND_SINGLE, parents); } /* diff --git a/src/backend/utils/adt/age_global_graph.c b/src/backend/utils/adt/age_global_graph.c index 30ec7479d..1f78d3f90 100644 --- a/src/backend/utils/adt/age_global_graph.c +++ b/src/backend/utils/adt/age_global_graph.c @@ -1333,7 +1333,7 @@ Datum age_vertex_stats(PG_FUNCTION_ARGS) agtv_temp = GET_AGTYPE_VALUE_OBJECT_VALUE(agtv_vertex, "label"); result.res = push_agtype_value(&result.parse_state, WAGT_KEY, string_to_agtype_value("label")); - result.res = push_agtype_value(&result.parse_state, WAGT_VALUE, agtv_temp); + copy_agtype_value(result.parse_state, agtv_temp, &result.res, true); /* set up an integer for returning values */ agtv_temp = &agtv_integer; diff --git a/src/backend/utils/adt/age_vle.c b/src/backend/utils/adt/age_vle.c index 6f7efbbc3..d32020faf 100644 --- a/src/backend/utils/adt/age_vle.c +++ b/src/backend/utils/adt/age_vle.c @@ -28,6 +28,7 @@ #include "catalog/ag_graph.h" #include "catalog/ag_label.h" #include "nodes/cypher_nodes.h" +#include "catalog/ag_label.h" /* defines */ #define GET_GRAPHID_ARRAY_FROM_CONTAINER(vpc) \ @@ -1612,6 +1613,7 @@ static agtype_value *build_path(VLE_path_container *vpc) for (index = 0; index < graphid_array_size; index += 2) { + Datum labels = (Datum)NULL; char *label_name = NULL; vertex_entry *ve = NULL; edge_entry *ee = NULL; @@ -1621,11 +1623,10 @@ static agtype_value *build_path(VLE_path_container *vpc) /* get the vertex entry from the hashtable */ ve = get_vertex_entry(ggctx, graphid_array[index]); /* get the label name from the oid */ - label_name = get_rel_name(get_vertex_entry_label_table_oid(ve)); + labels = get_entity_labels(get_vertex_entry_id(ve), graph_oid); /* reconstruct the vertex */ - agtv_vertex = agtype_value_build_vertex(get_vertex_entry_id(ve), - label_name, - get_vertex_entry_properties(ve)); + agtv_vertex = agtype_value_build_vertex( + get_vertex_entry_id(ve), labels, get_vertex_entry_properties(ve)); /* push the vertex */ path_result.res = push_agtype_value(&path_result.parse_state, WAGT_ELEM, agtv_vertex); diff --git a/src/backend/utils/adt/agtype.c b/src/backend/utils/adt/agtype.c index c1266df3e..de1bdb7ea 100644 --- a/src/backend/utils/adt/agtype.c +++ b/src/backend/utils/adt/agtype.c @@ -53,6 +53,7 @@ #include "utils/agtype_parser.h" #include "utils/ag_float8_supp.h" #include "utils/agtype_raw.h" +#include "utils/ag_cache.h" #include "catalog/ag_graph.h" #include "catalog/ag_label.h" @@ -545,6 +546,28 @@ static void agtype_typecast_object(agtype_in_state *state, char *annotation) /* verify that the structure conforms to a valid vertex */ if (is_object_vertex(agtv)) { + agtype_value *label_field; + + label_field = &(state->res->val.object.pairs[1].value); + + /* converts cstring label to array labels */ + if (label_field->type == AGTV_STRING) + { + agtype_value *labels; + agtype_parse_state *pstate; + + pstate = NULL; + push_agtype_value(&pstate, WAGT_BEGIN_ARRAY, NULL); + + if (label_field->val.string.len != 0) + { + push_agtype_value(&pstate, WAGT_ELEM, label_field); + } + + labels = push_agtype_value(&pstate, WAGT_END_ARRAY, NULL); + *label_field = *labels; + } + agtv->type = AGTV_VERTEX; /* if it isn't the top, we need to adjust the copied value */ if (!top) @@ -681,7 +704,7 @@ static bool is_object_vertex(agtype_value *agtv) /* check for a label of type string */ else if (key_len == 5 && pg_strncasecmp(key_val, "label", key_len) == 0 && - value->type == AGTV_STRING) + (value->type == AGTV_ARRAY || value->type == AGTV_STRING)) { has_label = true; } @@ -2242,12 +2265,12 @@ Datum make_path(List *path) PG_FUNCTION_INFO_V1(_agtype_build_vertex); /* - * SQL function agtype_build_vertex(graphid, cstring, agtype) + * SQL function agtype_build_vertex(graphid, agtype, agtype) */ Datum _agtype_build_vertex(PG_FUNCTION_ARGS) { graphid id; - char *label; + agtype *labels; agtype *properties; agtype_build_state *bstate; agtype *rawscalar; @@ -2268,7 +2291,7 @@ Datum _agtype_build_vertex(PG_FUNCTION_ARGS) } id = AG_GETARG_GRAPHID(0); - label = PG_GETARG_CSTRING(1); + labels = AG_GET_ARG_AGTYPE_P(1); if (fcinfo->args[2].isnull) { @@ -2293,7 +2316,83 @@ Datum _agtype_build_vertex(PG_FUNCTION_ARGS) write_string(bstate, "label"); write_string(bstate, "properties"); write_graphid(bstate, id); - write_string(bstate, label); + write_container(bstate, labels); + write_container(bstate, properties); + vertex = build_agtype(bstate); + pfree_agtype_build_state(bstate); + + bstate = init_agtype_build_state(1, AGT_FARRAY | AGT_FSCALAR); + write_extended(bstate, vertex, AGT_HEADER_VERTEX); + rawscalar = build_agtype(bstate); + pfree_agtype_build_state(bstate); + + PG_RETURN_POINTER(rawscalar); +} + + +PG_FUNCTION_INFO_V1(_agtype_build_vertex_cstringlabel); + +/* + * SQL function agtype_build_vertex(graphid, cstring, agtype) + * This is kept for backward compatibility. + */ +Datum _agtype_build_vertex_cstringlabel(PG_FUNCTION_ARGS) +{ + graphid id; + agtype *labels; + char *label_name; + agtype *properties; + agtype_build_state *bstate; + agtype *rawscalar; + agtype *vertex; + + /* handles null */ + if (fcinfo->args[0].isnull) + { + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("_agtype_build_vertex() graphid cannot be NULL"))); + } + + if (fcinfo->args[1].isnull) + { + ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("_agtype_build_vertex() label cannot be NULL"))); + } + + id = AG_GETARG_GRAPHID(0); + label_name = PG_GETARG_CSTRING(1); + + /* converts cstring label to array labels */ + bstate = init_agtype_build_state(1, AGT_FARRAY); + write_string(bstate, label_name); + labels = build_agtype(bstate); + pfree_agtype_build_state(bstate); + + if (fcinfo->args[2].isnull) + { + agtype_build_state *bstate = init_agtype_build_state(0, AGT_FOBJECT); + properties = build_agtype(bstate); + pfree_agtype_build_state(bstate); + } + else + { + properties = AG_GET_ARG_AGTYPE_P(2); + + if (!AGT_ROOT_IS_OBJECT(properties)) + { + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("_agtype_build_vertex() properties argument must be an object"))); + } + } + + bstate = init_agtype_build_state(3, AGT_FOBJECT); + write_string(bstate, "id"); + write_string(bstate, "label"); + write_string(bstate, "properties"); + write_graphid(bstate, id); + write_container(bstate, labels); write_container(bstate, properties); vertex = build_agtype(bstate); pfree_agtype_build_state(bstate); @@ -5049,7 +5148,7 @@ Datum agtype_typecast_vertex(PG_FUNCTION_ARGS) { agtype *arg_agt; agtype_value agtv_key; - agtype_value *agtv_graphid, *agtv_label, *agtv_properties; + agtype_value *agtv_graphid, *agtv_labels, *agtv_properties; Datum result; int count; @@ -5089,12 +5188,36 @@ Datum agtype_typecast_vertex(PG_FUNCTION_ARGS) agtv_key.val.string.val = "label"; agtv_key.val.string.len = 5; - agtv_label = find_agtype_value_from_container(&arg_agt->root, + agtv_labels = find_agtype_value_from_container(&arg_agt->root, AGT_FOBJECT, &agtv_key); - if (agtv_label == NULL || agtv_label->type != AGTV_STRING) + + if (agtv_labels && (agtv_labels->type == AGTV_ARRAY || + agtv_labels->type == AGTV_BINARY)) + { + /* good to go */ + ; + } + else if (agtv_labels && agtv_labels->type == AGTV_STRING) + { + /* converts to an array */ + agtype_parse_state *pstate; + + pstate = NULL; + push_agtype_value(&pstate, WAGT_BEGIN_ARRAY, NULL); + + if (agtv_labels->val.string.len > 0) + { + push_agtype_value(&pstate, WAGT_ELEM, agtv_labels); + } + + agtv_labels = push_agtype_value(&pstate, WAGT_END_ARRAY, NULL); + } + else + { ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("vertex typecast object has invalid or missing label"))); + } agtv_key.val.string.val = "properties"; agtv_key.val.string.len = 10; @@ -5110,7 +5233,7 @@ Datum agtype_typecast_vertex(PG_FUNCTION_ARGS) /* Hand it off to the build vertex routine */ result = DirectFunctionCall3(_agtype_build_vertex, Int64GetDatum(agtv_graphid->val.int_value), - CStringGetDatum(agtv_label->val.string.val), + PointerGetDatum(agtype_value_to_agtype(agtv_labels)), PointerGetDatum(agtype_value_to_agtype(agtv_properties))); return result; } @@ -5515,13 +5638,13 @@ static Datum get_vertex(const char *graph, const char *vertex_label, TableScanDesc scan_desc; HeapTuple tuple; TupleDesc tupdesc; - Datum id, properties, result; + Datum id, properties, labels, result; /* get the specific graph namespace (schema) */ Oid graph_namespace_oid = get_namespace_oid(graph, false); /* get the specific vertex label table (schema.vertex_label) */ - Oid vertex_label_table_oid = get_relname_relid(vertex_label, - graph_namespace_oid); + Oid vertex_label_table_oid = get_entity_reloid(graphid, + graph_namespace_oid); /* get the active snapshot */ Snapshot snapshot = GetActiveSnapshot(); @@ -5556,9 +5679,10 @@ static Datum get_vertex(const char *graph, const char *vertex_label, /* get the properties */ properties = column_get_datum(tupdesc, tuple, 1, "properties", AGTYPEOID, true); + /* get the labels */ + labels = get_entity_labels(graphid, graph_namespace_oid); /* reconstruct the vertex */ - result = DirectFunctionCall3(_agtype_build_vertex, id, - CStringGetDatum(vertex_label), properties); + result = DirectFunctionCall3(_agtype_build_vertex, id, labels, properties); /* end the scan and close the relation */ table_endscan(scan_desc); table_close(graph_vertex_label, ShareLock); @@ -11074,13 +11198,13 @@ Datum age_collect_aggfinalfn(PG_FUNCTION_ARGS) } /* helper function to quickly build an agtype_value vertex */ -agtype_value *agtype_value_build_vertex(graphid id, char *label, +agtype_value *agtype_value_build_vertex(graphid id, Datum labels, Datum properties) { agtype_in_state result; /* the label can't be NULL */ - Assert(label != NULL); + Assert(AGT_ROOT_IS_ARRAY(DATUM_GET_AGTYPE_P(labels))); memset(&result, 0, sizeof(agtype_in_state)); @@ -11097,8 +11221,7 @@ agtype_value *agtype_value_build_vertex(graphid id, char *label, /* push the label key/value pair */ result.res = push_agtype_value(&result.parse_state, WAGT_KEY, string_to_agtype_value("label")); - result.res = push_agtype_value(&result.parse_state, WAGT_VALUE, - string_to_agtype_value(label)); + add_agtype(labels, false, &result, AGTYPEOID, false); /* push the properties key/value pair */ result.res = push_agtype_value(&result.parse_state, WAGT_KEY, @@ -11548,7 +11671,6 @@ Datum age_labels(PG_FUNCTION_ARGS) agtype *agt_arg = NULL; agtype_value *agtv_temp = NULL; agtype_value *agtv_label = NULL; - agtype_in_state agis_result; /* get the vertex argument */ agt_arg = AG_GET_ARG_AGTYPE_P(0); @@ -11581,26 +11703,12 @@ Datum age_labels(PG_FUNCTION_ARGS) /* get the label from the vertex */ agtv_label = GET_AGTYPE_VALUE_OBJECT_VALUE(agtv_temp, "label"); - /* it cannot be NULL */ - Assert(agtv_label != NULL); - - /* clear the result structure */ - MemSet(&agis_result, 0, sizeof(agtype_in_state)); - /* push the beginning of the array */ - agis_result.res = push_agtype_value(&agis_result.parse_state, - WAGT_BEGIN_ARRAY, NULL); - - /* push in the label */ - agis_result.res = push_agtype_value(&agis_result.parse_state, WAGT_ELEM, - agtv_label); - - /* push the end of the array */ - agis_result.res = push_agtype_value(&agis_result.parse_state, - WAGT_END_ARRAY, NULL); + /* it cannot be NULL and must be an array */ + Assert(agtv_label != NULL && agtv_label->type == AGTV_ARRAY); /* convert the agtype_value to a datum to return to the caller */ - PG_RETURN_POINTER(agtype_value_to_agtype(agis_result.res)); + PG_RETURN_POINTER(agtype_value_to_agtype(agtv_label)); } PG_FUNCTION_INFO_V1(age_relationships); diff --git a/src/backend/utils/cache/ag_cache.c b/src/backend/utils/cache/ag_cache.c index 6fb566926..6d1a2612c 100644 --- a/src/backend/utils/cache/ag_cache.c +++ b/src/backend/utils/cache/ag_cache.c @@ -84,6 +84,12 @@ typedef struct label_seq_name_graph_cache_entry label_cache_data data; } label_seq_name_graph_cache_entry; +typedef struct label_allrelations_cache_entry +{ + Oid relation; + List *lcds; +} label_allrelations_cache_entry; + /* ag_graph.name */ static HTAB *graph_name_cache_hash = NULL; static ScanKeyData graph_name_scan_keys[1]; @@ -108,6 +114,9 @@ static ScanKeyData label_relation_scan_keys[1]; static HTAB *label_seq_name_graph_cache_hash = NULL; static ScanKeyData label_seq_name_graph_scan_keys[2]; +/* ag_label.allrelations */ +static HTAB *label_allrelations_cache_hash = NULL; + /* initialize all caches */ static void initialize_caches(void); @@ -137,6 +146,7 @@ static void create_label_name_graph_cache(void); static void create_label_graph_oid_cache(void); static void create_label_relation_cache(void); static void create_label_seq_name_graph_cache(void); +static void create_label_allrelations_cache(void); static void invalidate_label_caches(Datum arg, Oid relid); static void invalidate_label_name_graph_cache(Oid relid); static void flush_label_name_graph_cache(void); @@ -146,6 +156,8 @@ static void invalidate_label_relation_cache(Oid relid); static void flush_label_relation_cache(void); static void invalidate_label_seq_name_graph_cache(Oid relid); static void flush_label_seq_name_graph_cache(void); +static void invalidate_label_allrelations_cache(Oid relid); +static void flush_allrelations_cache(void); static label_cache_data *search_label_name_graph_cache_miss(Name name, Oid graph); @@ -162,6 +174,9 @@ static label_cache_data *search_label_seq_name_graph_cache_miss(Name name, static void *label_seq_name_graph_cache_hash_search(Name name, Oid graph, HASHACTION action, bool *found); +static List *search_label_allrelations_cache_miss(Oid relation); +static void *label_allrelations_cache_hash_search(Oid key, HASHACTION action, + bool *found); static void fill_label_cache_data(label_cache_data *cache_data, HeapTuple tuple, TupleDesc tuple_desc); @@ -538,6 +553,7 @@ static void create_label_caches(void) create_label_graph_oid_cache(); create_label_relation_cache(); create_label_seq_name_graph_cache(); + create_label_allrelations_cache(); } static void create_label_name_graph_cache(void) @@ -607,6 +623,23 @@ static void create_label_seq_name_graph_cache(void) HASH_ELEM | HASH_BLOBS); } +static void create_label_allrelations_cache(void) +{ + HASHCTL hash_ctl; + + MemSet(&hash_ctl, 0, sizeof(hash_ctl)); + hash_ctl.keysize = sizeof(Oid); + hash_ctl.entrysize = sizeof(label_allrelations_cache_entry); + + /* + * Please see the comment of hash_create() for the nelem value 16 here. + * HASH_BLOBS flag is set because the size of the key is sizeof(uint32). + */ + label_allrelations_cache_hash = + hash_create("ag_label (allrelations) cache", 16, &hash_ctl, + HASH_ELEM | HASH_BLOBS); +} + static void invalidate_label_caches(Datum arg, Oid relid) { Assert(label_name_graph_cache_hash); @@ -619,11 +652,14 @@ static void invalidate_label_caches(Datum arg, Oid relid) invalidate_label_graph_oid_cache(relid); invalidate_label_relation_cache(relid); invalidate_label_seq_name_graph_cache(relid); + invalidate_label_allrelations_cache(relid); // TODO: this is a temporary fix to cache being // corrupted after invalidation by create_label_expr_relations label_relation_cache_hash = NULL; + label_allrelations_cache_hash = NULL; create_label_relation_cache(); + create_label_allrelations_cache(); } else { @@ -631,11 +667,14 @@ static void invalidate_label_caches(Datum arg, Oid relid) flush_label_graph_oid_cache(); flush_label_relation_cache(); flush_label_seq_name_graph_cache(); + flush_allrelations_cache(); // TODO: this is a temporary fix to cache being // corrupted after invalidation by create_label_expr_relations label_relation_cache_hash = NULL; + label_allrelations_cache_hash = NULL; create_label_relation_cache(); + create_label_allrelations_cache(); } } @@ -773,6 +812,24 @@ static void invalidate_label_relation_cache(Oid relid) } } +static void invalidate_label_allrelations_cache(Oid relid) +{ + label_allrelations_cache_entry *entry; + void *removed; + + entry = hash_search(label_allrelations_cache_hash, &relid, HASH_FIND, NULL); + if (!entry) + { + return; + } + removed = hash_search(label_allrelations_cache_hash, &relid, HASH_REMOVE, + NULL); + if (!removed) + { + ereport(ERROR, (errmsg_internal("label (allrelations) cache corrupted"))); + } +} + static void flush_label_relation_cache(void) { HASH_SEQ_STATUS hash_seq; @@ -798,6 +855,31 @@ static void flush_label_relation_cache(void) } } +static void flush_allrelations_cache(void) +{ + HASH_SEQ_STATUS hash_seq; + + hash_seq_init(&hash_seq, label_allrelations_cache_hash); + for (;;) + { + label_allrelations_cache_entry *entry; + void *removed; + + entry = hash_seq_search(&hash_seq); + if (!entry) + { + break; + } + removed = hash_search(label_allrelations_cache_hash, &entry->relation, + HASH_REMOVE, NULL); + if (!removed) + { + ereport(ERROR, + (errmsg_internal("label (relation) cache corrupted"))); + } + } +} + static void invalidate_label_seq_name_graph_cache(Oid relid) { HASH_SEQ_STATUS hash_seq; @@ -1160,6 +1242,127 @@ static void *label_seq_name_graph_cache_hash_search(Name name, Oid graph, return hash_search(label_seq_name_graph_cache_hash, &key, action, found); } +/* + * Returns a list of label_cache_data of non-default labels that make up the + * given relation. + */ +List *search_label_allrelations_cache(Oid relation) +{ + label_allrelations_cache_entry *entry; + bool found; + + AssertArg(relation); + + initialize_caches(); + + entry = label_allrelations_cache_hash_search(relation, HASH_FIND, &found); + + if (found) + { + return entry->lcds; + } + + return search_label_allrelations_cache_miss(relation); +} + +static void *label_allrelations_cache_hash_search(Oid key, HASHACTION action, + bool *found) +{ + return hash_search(label_allrelations_cache_hash, &key, action, found); +} + +static List *search_label_allrelations_cache_miss(Oid relation) +{ + Relation ag_label; + SysScanDesc scan_desc; + HeapTuple tuple; + List *lcds = NIL; + bool found; + label_allrelations_cache_entry *entry; + MemoryContext oldctx; + + oldctx = MemoryContextSwitchTo(CacheMemoryContext); + + /* + * Calling table_open() might call AcceptInvalidationMessage() and that + * might invalidate the label caches. This is OK because this function is + * called when the desired entry is not in the cache. + */ + ag_label = table_open(ag_label_relation_id(), AccessShareLock); + + /* TODO: for now, do seq scan */ + scan_desc = systable_beginscan(ag_label, InvalidOid, false, NULL, 0, NULL); + + /* reads each row of ag_label */ + while (true) + { + label_cache_data *lcd; + bool isNull; + Datum ag_label_allrelations; + Datum rel_kind; + Datum *elemsp; + bool *nullsp; + int nelemsp; + int i; + + tuple = systable_getnext(scan_desc); + if (!HeapTupleIsValid(tuple)) + { + break; + } + + /* extracts allrelations and rel_kind */ + rel_kind = heap_getattr(tuple, Anum_ag_label_rel_kind, + RelationGetDescr(ag_label), &isNull); + Assert(!isNull); + ag_label_allrelations = heap_getattr(tuple, Anum_ag_label_allrelations, + RelationGetDescr(ag_label), + &isNull); + Assert(!isNull); + + if (DatumGetChar(rel_kind) != LABEL_REL_KIND_SINGLE) + { + continue; + } + + /* deconstructs allrelations to an array of Datums */ + elemsp = palloc(sizeof(Datum)); + nullsp = palloc(sizeof(bool)); + deconstruct_array(DatumGetArrayTypeP(ag_label_allrelations), + REGCLASSOID, 4, true, TYPALIGN_INT, &elemsp, &nullsp, + &nelemsp); + + /* for each item in allrelations */ + for (i = 0; i < nelemsp; i++) + { + Oid item; + + Assert(!nullsp[i]); + + item = DatumGetObjectId(elemsp[i]); + + /* argument `relation` is in allrelations */ + if (item == relation) + { + lcd = (label_cache_data *)palloc(sizeof(label_cache_data)); + fill_label_cache_data(lcd, tuple, RelationGetDescr(ag_label)); + lcds = lappend(lcds, lcd); + break; + } + } + } + + entry = label_allrelations_cache_hash_search(relation, HASH_ENTER, &found); + Assert(!found); + entry->lcds = lcds; + + systable_endscan(scan_desc); + table_close(ag_label, AccessShareLock); + MemoryContextSwitchTo(oldctx); + + return entry->lcds; +} + static void fill_label_cache_data(label_cache_data *cache_data, HeapTuple tuple, TupleDesc tuple_desc) { @@ -1178,26 +1381,32 @@ static void fill_label_cache_data(label_cache_data *cache_data, name = DatumGetName(value); Assert(name != NULL); namestrcpy(&cache_data->name, name->data); + /* ag_label.graph */ value = heap_getattr(tuple, Anum_ag_label_graph, tuple_desc, &is_null); Assert(!is_null); cache_data->graph = DatumGetObjectId(value); + /* ag_label.id */ value = heap_getattr(tuple, Anum_ag_label_id, tuple_desc, &is_null); Assert(!is_null); cache_data->id = DatumGetInt32(value); + /* ag_label.kind */ value = heap_getattr(tuple, Anum_ag_label_kind, tuple_desc, &is_null); Assert(!is_null); cache_data->kind = DatumGetChar(value); + /* ag_label.relation */ value = heap_getattr(tuple, Anum_ag_label_relation, tuple_desc, &is_null); Assert(!is_null); cache_data->relation = DatumGetObjectId(value); + /* ag_label.seq_name */ value = heap_getattr(tuple, Anum_ag_label_seq_name, tuple_desc, &is_null); Assert(!is_null); namestrcpy(&cache_data->seq_name, DatumGetName(value)->data); + // ag_label.allrelations value = heap_getattr(tuple, Anum_ag_label_allrelations, tuple_desc, &is_null); Assert(!is_null); @@ -1213,4 +1422,9 @@ static void fill_label_cache_data(label_cache_data *cache_data, allrelations_oids[i]); } MemoryContextSwitchTo(oldctx); + + // ag_label.rel_kind + value = heap_getattr(tuple, Anum_ag_label_rel_kind, tuple_desc, &is_null); + Assert(!is_null); + cache_data->rel_kind = DatumGetChar(value); } diff --git a/src/include/catalog/ag_label.h b/src/include/catalog/ag_label.h index b373de947..2f8ad2f03 100644 --- a/src/include/catalog/ag_label.h +++ b/src/include/catalog/ag_label.h @@ -47,9 +47,10 @@ #define Anum_ag_label_relation 5 #define Anum_ag_label_seq_name 6 #define Anum_ag_label_allrelations 7 +#define Anum_ag_label_rel_kind 8 -#define Natts_ag_label 7 +#define Natts_ag_label 8 #define ag_label_relation_id() ag_relation_id("ag_label", "table") #define ag_label_name_graph_index_id() \ @@ -66,8 +67,18 @@ #define LABEL_KIND_VERTEX 'v' #define LABEL_KIND_EDGE 'e' +/* + * Used in ag_label.rel_kind to mark what type of relation is + * ag_label.relation: + * default label, single label, or intersection relation + */ +#define LABEL_REL_KIND_DEFAULT 'd' +#define LABEL_REL_KIND_SINGLE 's' +#define LABEL_REL_KIND_INTR 'i' + void insert_label(const char *label_name, Oid graph_oid, int32 label_id, - char label_kind, Oid label_relation, const char *seq_name); + char label_kind, Oid label_relation, const char *seq_name, + char rel_kind); void delete_label(Oid relation); int32 get_label_id(const char *label_name, Oid graph_oid); @@ -77,6 +88,10 @@ char get_label_kind(const char *label_name, Oid label_graph); char *get_label_seq_relation_name(const char *label_name); +Oid get_entity_reloid(graphid entity_id, Oid graph_oid); +char *get_entity_relname(graphid entity_id, Oid graph_oid); +Datum get_entity_labels(graphid entity_id, Oid graph_oid); + bool label_id_exists(Oid graph_oid, int32 label_id); RangeVar *get_label_range_var(char *graph_name, Oid graph_oid, char *label_name); diff --git a/src/include/commands/label_commands.h b/src/include/commands/label_commands.h index cfbbdb336..9f51134da 100644 --- a/src/include/commands/label_commands.h +++ b/src/include/commands/label_commands.h @@ -53,7 +53,7 @@ (IS_DEFAULT_LABEL_EDGE(x) || IS_DEFAULT_LABEL_VERTEX(x)) void create_label(char *graph_name, char *label_name, char label_type, - List *parents); + char rel_kind, List *parents); Datum create_vlabel(PG_FUNCTION_ARGS); diff --git a/src/include/utils/ag_cache.h b/src/include/utils/ag_cache.h index 215e01d09..86a040cb3 100644 --- a/src/include/utils/ag_cache.h +++ b/src/include/utils/ag_cache.h @@ -38,6 +38,7 @@ typedef struct label_cache_data Oid relation; NameData seq_name; List *allrelations; + char rel_kind; } label_cache_data; /* callers of these functions must not modify the returned struct */ @@ -48,5 +49,6 @@ label_cache_data *search_label_name_graph_cache(const char *name, Oid graph); label_cache_data *search_label_graph_oid_cache(Oid graph, int32 id); label_cache_data *search_label_relation_cache(Oid relation); label_cache_data *search_label_seq_name_graph_cache(const char *name, Oid graph); +List *search_label_allrelations_cache(Oid relation); #endif diff --git a/src/include/utils/agtype.h b/src/include/utils/agtype.h index e77f04536..5f0ba96aa 100644 --- a/src/include/utils/agtype.h +++ b/src/include/utils/agtype.h @@ -537,7 +537,7 @@ Datum make_edge(Datum id, Datum startid, Datum endid, Datum label, Datum make_path(List *path); Datum column_get_datum(TupleDesc tupdesc, HeapTuple tuple, int column, const char *attname, Oid typid, bool isnull); -agtype_value *agtype_value_build_vertex(graphid id, char *label, +agtype_value *agtype_value_build_vertex(graphid id, Datum labels, Datum properties); agtype_value *agtype_value_build_edge(graphid id, char *label, graphid end_id, graphid start_id, Datum properties); From f954921881cf398ca9b9324ece46fdbd611742c8 Mon Sep 17 00:00:00 2001 From: Rafsun Masud Date: Thu, 7 Dec 2023 15:38:39 -0800 Subject: [PATCH 06/13] Add multiple label support to MATCH queries without variables It updates the function filter_vertices_on_label_id(). Additional changes: ------------------- - Add internal function _label_ids --- regress/expected/multiple_label.out | 148 +++++++++++++++---------- regress/sql/multiple_label.sql | 65 ++++++++--- sql/age_agtype.sql | 7 ++ src/backend/catalog/ag_label.c | 45 ++++++++ src/backend/parser/cypher_clause.c | 127 ++++++++++++++------- src/backend/parser/cypher_label_expr.c | 56 ++++++++++ src/include/parser/cypher_label_expr.h | 2 + 7 files changed, 336 insertions(+), 114 deletions(-) diff --git a/regress/expected/multiple_label.out b/regress/expected/multiple_label.out index 3460245ab..cc04443da 100644 --- a/regress/expected/multiple_label.out +++ b/regress/expected/multiple_label.out @@ -810,104 +810,136 @@ NOTICE: graph "mlabels9" has been dropped /* * Match without variables */ -SElECT create_graph('mlabels10'); +SELECT create_graph('mlabels10'); NOTICE: graph "mlabels10" has been created create_graph -------------- (1 row) -SELECT * FROM cypher('mlabels10', $$ CREATE (:a:b)-[:rel{title:'ab->pq'}]->(:p:q) $$) as (a agtype); +SELECT * FROM cypher('mlabels10', $$ CREATE ()-[:rel {start:''}]->(:x) $$) as (a agtype); a --- (0 rows) -SELECT * FROM cypher('mlabels10', $$ CREATE (:c)-[:rel{title:'c->m'}]->(:m) $$) as (a agtype); +SELECT * FROM cypher('mlabels10', $$ CREATE (:a)-[:rel {start:'a'}]->(:x) $$) as (a agtype); a --- (0 rows) -SELECT * FROM cypher('mlabels10', $$ CREATE (:d)-[:rel{title:'d->n'}]->(:n) $$) as (a agtype); +SELECT * FROM cypher('mlabels10', $$ CREATE (:a:b)-[:rel {start:'ab'}]->(:x) $$) as (a agtype); a --- (0 rows) --- AND -SELECT * FROM cypher('mlabels10', $$ MATCH (:a:b)-[e:rel]->() RETURN e.title $$) as (a agtype); - a ----------- - "ab->pq" -(1 row) +SELECT * FROM cypher('mlabels10', $$ CREATE (:c)-[:rel {start:'c'}]->(:x) $$) as (a agtype); + a +--- +(0 rows) -SELECT * FROM cypher('mlabels10', $$ MATCH ()-[e:rel]->(:p:q) RETURN e.title $$) as (a agtype); - a ----------- - "ab->pq" -(1 row) +SELECT * FROM cypher('mlabels10', $$ CREATE (:d)-[:rel {start:'d'}]->(:x) $$) as (a agtype); + a +--- +(0 rows) -SELECT * FROM cypher('mlabels10', $$ MATCH (:a:b)-[e:rel]->(:p:q) RETURN e.title $$) as (a agtype); - a ----------- - "ab->pq" -(1 row) +-- _label_ids() +WITH graph AS ( + SELECT graphid as id + FROM ag_catalog.ag_graph + WHERE name = 'mlabels10' + LIMIT 1 +) +SELECT + array_agg(C.name) AS "label names derived from _label_ids", + E.properties -> '"start"' AS start +FROM + mlabels10._ag_label_edge AS E, + ag_catalog.ag_label AS C, + graph +WHERE + C.graph = graph.id + AND + CASE + WHEN _label_ids(graph.id, E.start_id) = '{}' AND + C.kind = 'v' AND + c.rel_kind = 'd' + THEN true + ELSE C.id = ANY(_label_ids(graph.id, E.start_id)) + END +GROUP BY + start +ORDER BY + start +; + label names derived from _label_ids | start +-------------------------------------+------- + {_ag_label_vertex} | "" + {a} | "a" + {a,b} | "ab" + {c} | "c" + {d} | "d" +(5 rows) --- OR -SELECT * FROM cypher('mlabels10', $$ MATCH (:c|d)-[e:rel]->() RETURN e.title $$) as (a agtype); - a --------- - "c->m" - "d->n" -(2 rows) +-- matches all +SELECT * FROM cypher('mlabels10', $$ MATCH ()-[e:rel]->(x:x) RETURN e.start $$) as ("()" agtype); + () +------ + "" + "a" + "ab" + "c" + "d" +(5 rows) -SELECT * FROM cypher('mlabels10', $$ MATCH ()-[e:rel]->(:m|n) RETURN e.title $$) as (a agtype); - a --------- - "c->m" - "d->n" +-- matches :a and :a:b +SELECT * FROM cypher('mlabels10', $$ MATCH (:a)-[e:rel]->(x:x) RETURN e.start $$) as ("(:a)" agtype); + (:a) +------ + "a" + "ab" (2 rows) -SELECT * FROM cypher('mlabels10', $$ MATCH (:c|d)-[e:rel]->(:m|n) RETURN e.title $$) as (a agtype); - a +-- matches only :a:b +SELECT * FROM cypher('mlabels10', $$ MATCH (:a:b)-[e:rel]->(x:x) RETURN e.start $$) as ("(:a:b)" agtype); + (:a:b) -------- - "c->m" - "d->n" -(2 rows) + "ab" +(1 row) --- Single -SELECT * FROM cypher('mlabels10', $$ MATCH (:c)-[e:rel]->() RETURN e.title $$) as (a agtype); - a +-- matches none +SELECT * FROM cypher('mlabels10', $$ MATCH (:a:m)-[e:rel]->(x:x) RETURN e.start $$) as ("(:a:m)" agtype); + (:a:m) -------- - "c->m" -(1 row) +(0 rows) -SELECT * FROM cypher('mlabels10', $$ MATCH ()-[e:rel]->(:m) RETURN e.title $$) as (a agtype); - a +-- matches only :a, :a:b and :d +SELECT * FROM cypher('mlabels10', $$ MATCH (:a|d)-[e:rel]->(x:x) RETURN e.start $$) as ("(:a|d)" agtype); + (:a|d) -------- - "c->m" -(1 row) + "a" + "ab" + "d" +(3 rows) -SELECT * FROM cypher('mlabels10', $$ MATCH (:c)-[e:rel]->(:m) RETURN e.title $$) as (a agtype); - a +-- matches c only +SELECT * FROM cypher('mlabels10', $$ MATCH (:c|m)-[e:rel]->(x:x) RETURN e.start $$) as ("(:c|m)" agtype); + (:c|m) -------- - "c->m" + "c" (1 row) -- cleanup -SElECT drop_graph('mlabels10', true); -NOTICE: drop cascades to 13 other objects +SELECT drop_graph('mlabels10', true); +NOTICE: drop cascades to 9 other objects DETAIL: drop cascades to table mlabels10._ag_label_vertex drop cascades to table mlabels10._ag_label_edge -drop cascades to table mlabels10._agr_ab +drop cascades to table mlabels10.rel +drop cascades to table mlabels10.x drop cascades to table mlabels10.a +drop cascades to table mlabels10._agr_ab drop cascades to table mlabels10.b -drop cascades to table mlabels10.rel -drop cascades to table mlabels10._agr_pq -drop cascades to table mlabels10.p -drop cascades to table mlabels10.q drop cascades to table mlabels10.c -drop cascades to table mlabels10.m drop cascades to table mlabels10.d -drop cascades to table mlabels10.n NOTICE: graph "mlabels10" has been dropped drop_graph ------------ diff --git a/regress/sql/multiple_label.sql b/regress/sql/multiple_label.sql index 288782fd5..571089296 100644 --- a/regress/sql/multiple_label.sql +++ b/regress/sql/multiple_label.sql @@ -199,24 +199,55 @@ SElECT drop_graph('mlabels9', true); /* * Match without variables */ -SElECT create_graph('mlabels10'); -SELECT * FROM cypher('mlabels10', $$ CREATE (:a:b)-[:rel{title:'ab->pq'}]->(:p:q) $$) as (a agtype); -SELECT * FROM cypher('mlabels10', $$ CREATE (:c)-[:rel{title:'c->m'}]->(:m) $$) as (a agtype); -SELECT * FROM cypher('mlabels10', $$ CREATE (:d)-[:rel{title:'d->n'}]->(:n) $$) as (a agtype); --- AND -SELECT * FROM cypher('mlabels10', $$ MATCH (:a:b)-[e:rel]->() RETURN e.title $$) as (a agtype); -SELECT * FROM cypher('mlabels10', $$ MATCH ()-[e:rel]->(:p:q) RETURN e.title $$) as (a agtype); -SELECT * FROM cypher('mlabels10', $$ MATCH (:a:b)-[e:rel]->(:p:q) RETURN e.title $$) as (a agtype); --- OR -SELECT * FROM cypher('mlabels10', $$ MATCH (:c|d)-[e:rel]->() RETURN e.title $$) as (a agtype); -SELECT * FROM cypher('mlabels10', $$ MATCH ()-[e:rel]->(:m|n) RETURN e.title $$) as (a agtype); -SELECT * FROM cypher('mlabels10', $$ MATCH (:c|d)-[e:rel]->(:m|n) RETURN e.title $$) as (a agtype); --- Single -SELECT * FROM cypher('mlabels10', $$ MATCH (:c)-[e:rel]->() RETURN e.title $$) as (a agtype); -SELECT * FROM cypher('mlabels10', $$ MATCH ()-[e:rel]->(:m) RETURN e.title $$) as (a agtype); -SELECT * FROM cypher('mlabels10', $$ MATCH (:c)-[e:rel]->(:m) RETURN e.title $$) as (a agtype); +SELECT create_graph('mlabels10'); +SELECT * FROM cypher('mlabels10', $$ CREATE ()-[:rel {start:''}]->(:x) $$) as (a agtype); +SELECT * FROM cypher('mlabels10', $$ CREATE (:a)-[:rel {start:'a'}]->(:x) $$) as (a agtype); +SELECT * FROM cypher('mlabels10', $$ CREATE (:a:b)-[:rel {start:'ab'}]->(:x) $$) as (a agtype); +SELECT * FROM cypher('mlabels10', $$ CREATE (:c)-[:rel {start:'c'}]->(:x) $$) as (a agtype); +SELECT * FROM cypher('mlabels10', $$ CREATE (:d)-[:rel {start:'d'}]->(:x) $$) as (a agtype); +-- _label_ids() +WITH graph AS ( + SELECT graphid as id + FROM ag_catalog.ag_graph + WHERE name = 'mlabels10' + LIMIT 1 +) +SELECT + array_agg(C.name) AS "label names derived from _label_ids", + E.properties -> '"start"' AS start +FROM + mlabels10._ag_label_edge AS E, + ag_catalog.ag_label AS C, + graph +WHERE + C.graph = graph.id + AND + CASE + WHEN _label_ids(graph.id, E.start_id) = '{}' AND + C.kind = 'v' AND + c.rel_kind = 'd' + THEN true + ELSE C.id = ANY(_label_ids(graph.id, E.start_id)) + END +GROUP BY + start +ORDER BY + start +; +-- matches all +SELECT * FROM cypher('mlabels10', $$ MATCH ()-[e:rel]->(x:x) RETURN e.start $$) as ("()" agtype); +-- matches :a and :a:b +SELECT * FROM cypher('mlabels10', $$ MATCH (:a)-[e:rel]->(x:x) RETURN e.start $$) as ("(:a)" agtype); +-- matches only :a:b +SELECT * FROM cypher('mlabels10', $$ MATCH (:a:b)-[e:rel]->(x:x) RETURN e.start $$) as ("(:a:b)" agtype); +-- matches none +SELECT * FROM cypher('mlabels10', $$ MATCH (:a:m)-[e:rel]->(x:x) RETURN e.start $$) as ("(:a:m)" agtype); +-- matches only :a, :a:b and :d +SELECT * FROM cypher('mlabels10', $$ MATCH (:a|d)-[e:rel]->(x:x) RETURN e.start $$) as ("(:a|d)" agtype); +-- matches c only +SELECT * FROM cypher('mlabels10', $$ MATCH (:c|m)-[e:rel]->(x:x) RETURN e.start $$) as ("(:c|m)" agtype); -- cleanup -SElECT drop_graph('mlabels10', true); +SELECT drop_graph('mlabels10', true); diff --git a/sql/age_agtype.sql b/sql/age_agtype.sql index e6a0e20d6..14b4e2b94 100644 --- a/sql/age_agtype.sql +++ b/sql/age_agtype.sql @@ -1071,3 +1071,10 @@ CREATE FUNCTION ag_catalog._label_names(graph_oid oid, graphid) IMMUTABLE PARALLEL SAFE AS 'MODULE_PATHNAME'; + +CREATE FUNCTION ag_catalog._label_ids(graph_oid oid, graphid) + RETURNS int4[] + LANGUAGE c + IMMUTABLE +PARALLEL SAFE +AS 'MODULE_PATHNAME'; diff --git a/src/backend/catalog/ag_label.c b/src/backend/catalog/ag_label.c index 963da26bd..4b29e5903 100644 --- a/src/backend/catalog/ag_label.c +++ b/src/backend/catalog/ag_label.c @@ -291,6 +291,51 @@ Datum _label_names(PG_FUNCTION_ARGS) AG_RETURN_AGTYPE_P(res); } +PG_FUNCTION_INFO_V1(_label_ids); + +/* + * Arguments: + * [0] = graph OID + * [1] = entity (vertex\edge) ID + * + * Returns: + * a int32 array of label IDs + */ +Datum _label_ids(PG_FUNCTION_ARGS) +{ + Oid graph_oid; + graphid entity_id; + ArrayType *res; + List *lcds; + ListCell *lc; + Datum *label_ids; + int len; + int i; + + Assert(!PG_ARGISNULL(0)); + Assert(!PG_ARGISNULL(1)); + + graph_oid = PG_GETARG_OID(0); + entity_id = AG_GETARG_GRAPHID(1); + + lcds = search_label_allrelations_cache( + get_entity_reloid(entity_id, graph_oid)); + len = list_length(lcds); + label_ids = (Datum *)palloc(sizeof(Datum) * len); + + i = 0; + foreach (lc, lcds) + { + label_cache_data *lcd = lfirst(lc); + label_ids[i] = Int32GetDatum(lcd->id); + i++; + } + + res = construct_array(label_ids, len, INT4OID, 4, true, TYPALIGN_INT); + + PG_RETURN_ARRAYTYPE_P(res); +} + PG_FUNCTION_INFO_V1(_label_id); Datum _label_id(PG_FUNCTION_ARGS) diff --git a/src/backend/parser/cypher_clause.c b/src/backend/parser/cypher_clause.c index a052db633..7e1c67765 100644 --- a/src/backend/parser/cypher_clause.c +++ b/src/backend/parser/cypher_clause.c @@ -3778,54 +3778,103 @@ static A_Expr *filter_vertices_on_label_id(cypher_parsestate *cpstate, Node *id_field, cypher_label_expr *label_expr) { - A_Const *n; - FuncCall *fc; - String *ag_catalog, *extract_label_id; - label_cache_data *lcd; - A_Expr *lhs; - int32 label_id; - A_ArrayExpr *filter_ids; - A_ArrayExpr *empty_array; - A_Const *minus_one_const; - char *relname; - - ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("not yet implemented for multiple label"))); + A_Expr *result; + A_ArrayExpr *filter_label_ids_node; // label IDs in MATCH's filter + FuncCall *actual_label_ids_node; // label IDs of id_field entity + A_Const *graph_oid_const; + cypher_label_expr_type label_expr_type; + List *filter_label_ids; + ListCell *lc; + char *array_op; - relname = label_expr_relname(label_expr, LABEL_KIND_VERTEX); - lcd = search_label_name_graph_cache(relname, cpstate->graph_oid); + label_expr_type = LABEL_EXPR_TYPE(label_expr); + filter_label_ids = label_expr_label_ids_for_filter( + label_expr, LABEL_KIND_VERTEX, cpstate->graph_oid); - if (lcd) + if (filter_label_ids == NIL) { - label_id = lcd->id; + A_Const *l; + A_Const *r; + + l = makeNode(A_Const); + l->val.boolval.type = T_Boolean; + l->isnull = false; + l->location = -1; + r = makeNode(A_Const); + r->val.boolval.type = T_Boolean; + r->isnull = false; + r->location = -1; + + /* + * If filter_label_ids is empty because label_expr itself is empty, + * then it means match all (filter none). Otherwise, empty means + * match none. + */ + if (label_expr_type == LABEL_EXPR_TYPE_EMPTY) + { + l->val.boolval.boolval = true; + r->val.boolval.boolval = true; + } + else + { + l->val.boolval.boolval = true; + r->val.boolval.boolval = false; + } + + result = makeSimpleA_Expr(AEXPR_OP, "=", (Node *)l, (Node *)r, -1); + + return result; } - else + + /* + * Following code builds and returns either of the qual Node: + * filter_label_ids && _label_ids(graph_oid, id_field) + * filter_label_ids <@ _label_ids(graph_oid, id_field) + */ + + /* First, builds an A_ArrayExpr containing filter_label_ids */ + filter_label_ids_node = makeNode(A_ArrayExpr); + filter_label_ids_node->elements = NIL; + filter_label_ids_node->location = -1; + foreach (lc, filter_label_ids) { - label_id = -5; // -1 is reserved for array concat + A_Const *elem = makeNode(A_Const); + elem->val.ival.type = T_Integer; + elem->val.ival.ival = lfirst_int(lc); // label id + elem->location = -1; + + filter_label_ids_node->elements = + lappend(filter_label_ids_node->elements, elem); } - n = makeNode(A_Const); - n->val.ival.type = T_Integer; - n->val.ival.ival = label_id; - n->location = -1; - filter_ids = makeNode(A_ArrayExpr); - filter_ids->elements = list_make1(n); - filter_ids->location = -1; + /* Next, builds the _label_ids function call expression */ + graph_oid_const = makeNode(A_Const); + graph_oid_const->val.ival.type = T_Integer; + graph_oid_const->val.ival.ival = cpstate->graph_oid; + graph_oid_const->location = -1; + actual_label_ids_node = makeFuncCall( + list_make2(makeString("ag_catalog"), makeString("_label_ids")), + list_make2(graph_oid_const, id_field), COERCE_EXPLICIT_CALL, -1); - minus_one_const = makeNode(A_Const); - minus_one_const->val.ival.type = T_Integer; - minus_one_const->val.ival.ival = -1; + /* + * To match an entity, + * + * For AND label expression, + * filter_label_ids must be a subset (<@ operator) of the entity's actual + * label IDs. It means, all filter label IDs are present in the entity's + * label IDs. + * + * For OR and Single label expression, + * filter_label_ids must overlap (&& operator) with entity's actual label + * IDS. It means at least one filter label ID is present in the entity's + * label IDs. + */ + array_op = label_expr_type == LABEL_EXPR_TYPE_AND ? "<@" : "&&"; + result = makeSimpleA_Expr(AEXPR_OP, array_op, + (Node *)filter_label_ids_node, + (Node *)actual_label_ids_node, -1); - ag_catalog = makeString("ag_catalog"); - extract_label_id = makeString("_extract_label_id"); - fc = makeFuncCall(list_make2(ag_catalog, extract_label_id), - list_make1(id_field), COERCE_EXPLICIT_CALL, -1); - empty_array = makeNode(A_ArrayExpr); - empty_array->elements = list_make1(minus_one_const); - empty_array->location = -1; - lhs = makeSimpleA_Expr(AEXPR_OP, "||", (Node *)empty_array, (Node *)fc, -1); - - return makeSimpleA_Expr(AEXPR_OP, "@>", (Node *)lhs, (Node *)filter_ids, -1); + return result; } /* diff --git a/src/backend/parser/cypher_label_expr.c b/src/backend/parser/cypher_label_expr.c index fc14a9148..d5059e570 100644 --- a/src/backend/parser/cypher_label_expr.c +++ b/src/backend/parser/cypher_label_expr.c @@ -452,6 +452,62 @@ bool label_expr_are_equal(cypher_label_expr *le1, cypher_label_expr *le2) return true; } +/* + * Returns label IDs of labels contained by the label expressoin in arbitrary + * order. This is used by the MATCH clause to build filter quals. + * + * Note: Default labels are not considered labels by this function. So, for + * empty label expression, empty list is returned. Also, for non-empty types, + * empty list means the filter should not match any entities at all. For + * example, when no labels are valid in the expression. The caller is + * responsible for distinguishing between the two cases. + */ +List *label_expr_label_ids_for_filter(cypher_label_expr *label_expr, + char label_expr_kind, Oid graph_oid) +{ + cypher_label_expr_type label_expr_type; + List *result; + ListCell *lc; + + label_expr_type = LABEL_EXPR_TYPE(label_expr); + result = NIL; + + if (label_expr_type == LABEL_EXPR_TYPE_EMPTY) + { + return NIL; + } + + foreach (lc, label_expr->label_names) + { + char *label_name; + label_cache_data *lcd; + + label_name = strVal((String *)lfirst(lc)); + lcd = search_label_name_graph_cache(label_name, graph_oid); + + /* if a label_name does not exist in the cache */ + if (!lcd || lcd->kind != label_expr_kind) + { + if (label_expr_type == LABEL_EXPR_TYPE_AND) + { + /* for AND, nothing to match */ + return NIL; + } + else + { + /* for OR\Single, skip that label */ + continue; + } + } + else + { + result = lappend_int(result, lcd->id); + } + } + + return result; +} + /* * Checks unsupported label expression type in CREATE\MERGE clause and reports * error. diff --git a/src/include/parser/cypher_label_expr.h b/src/include/parser/cypher_label_expr.h index 43a88613e..a5f9e5771 100644 --- a/src/include/parser/cypher_label_expr.h +++ b/src/include/parser/cypher_label_expr.h @@ -59,6 +59,8 @@ char *find_first_invalid_label(cypher_label_expr *label_expr, char label_expr_kind, Oid graph_oid); char *label_expr_relname(cypher_label_expr *label_expr, char label_expr_kind); bool label_expr_are_equal(cypher_label_expr *le1, cypher_label_expr *le2); +List *label_expr_label_ids_for_filter(cypher_label_expr *label_expr, + char label_expr_kind, Oid graph_oid); void check_label_expr_type_for_create(ParseState *pstate, Node *entity); void check_reserved_label_name(char *label_name); From a7485f7aa88d88c2d435c89ef10dfd59892c6fb7 Mon Sep 17 00:00:00 2001 From: Rafsun Masud Date: Wed, 13 Dec 2023 12:51:09 -0800 Subject: [PATCH 07/13] Fix cache issues Cache issues fixed: ------------------- - Use of wrong data type for cache entry in label relation cache (pre-existing) - Use of wrong update function for catalog table (related to multiple label) Other changes: -------------- - The function _label_name() is unsupported for vertices --- Makefile | 1 - regress/expected/multiple_label.out | 4 ++-- sql/age_main.sql | 2 -- src/backend/catalog/ag_label.c | 6 ++++++ src/backend/parser/cypher_label_expr.c | 7 ++++--- src/backend/utils/cache/ag_cache.c | 22 ++++------------------ src/include/nodes/ag_nodes.h | 1 - 7 files changed, 16 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index 5085fd4c9..2e35c65f6 100644 --- a/Makefile +++ b/Makefile @@ -108,7 +108,6 @@ REGRESS = scan \ age_global_graph \ age_load \ index \ - multiple_label \ analyze \ graph_generation \ name_validation \ diff --git a/regress/expected/multiple_label.out b/regress/expected/multiple_label.out index cc04443da..5e730613e 100644 --- a/regress/expected/multiple_label.out +++ b/regress/expected/multiple_label.out @@ -1058,7 +1058,7 @@ SELECT * FROM cypher('mlabels12', $$ MATCH (x) SET x.age = 32 RETURN x $$) as (" SELECT * FROM cypher('mlabels12', $$ MERGE (x:Teacher:Person) RETURN x $$) as ("MERGE" agtype); MERGE ------------------------------------------------------------------------------------ - {"id": 1688849860263937, "label": ["Person", "Teacher"], "properties": {}}::vertex + {"id": 1688849860263937, "label": ["Teacher", "Person"], "properties": {}}::vertex (1 row) -- check vle @@ -1142,7 +1142,7 @@ SELECT * FROM cypher('mlabels12', $$ MATCH (x) RETURN labels(x) $$) as ("labels" [] ["Student", "Person"] ["Person"] - ["Person", "Teacher"] + ["Teacher", "Person"] ["a", "b"] ["k"] ["m", "n"] diff --git a/sql/age_main.sql b/sql/age_main.sql index e4d666bc1..320076e79 100644 --- a/sql/age_main.sql +++ b/sql/age_main.sql @@ -378,7 +378,6 @@ CREATE FUNCTION ag_catalog._graphid(label_id int, entry_id bigint) PARALLEL SAFE AS 'MODULE_PATHNAME'; --- // TODO: deprecated for vertices CREATE FUNCTION ag_catalog._label_name(graph_oid oid, graphid) RETURNS cstring LANGUAGE c @@ -386,7 +385,6 @@ CREATE FUNCTION ag_catalog._label_name(graph_oid oid, graphid) PARALLEL SAFE AS 'MODULE_PATHNAME'; - CREATE FUNCTION ag_catalog._extract_label_id(graphid) RETURNS label_id LANGUAGE c diff --git a/src/backend/catalog/ag_label.c b/src/backend/catalog/ag_label.c index 4b29e5903..2f6876b9d 100644 --- a/src/backend/catalog/ag_label.c +++ b/src/backend/catalog/ag_label.c @@ -241,6 +241,12 @@ Datum _label_name(PG_FUNCTION_ARGS) label_cache = search_label_graph_oid_cache(graph, label_id); + if (label_cache->kind == LABEL_KIND_VERTEX) + { + elog(ERROR, "_label_name is not supported for vertices; " + "try _label_names instead"); + } + label_name = NameStr(label_cache->name); if (IS_AG_DEFAULT_LABEL(label_name)) diff --git a/src/backend/parser/cypher_label_expr.c b/src/backend/parser/cypher_label_expr.c index d5059e570..17745f82f 100644 --- a/src/backend/parser/cypher_label_expr.c +++ b/src/backend/parser/cypher_label_expr.c @@ -2,6 +2,7 @@ #include "access/genam.h" #include "access/heapam.h" +#include "catalog/indexing.h" #include "utils/builtins.h" #include "utils/inval.h" #include "utils/lsyscache.h" @@ -118,7 +119,7 @@ void create_label_expr_relations(Oid graphoid, char *graphname, Assert(list_length(label_expr->label_names) > 1); - ag_label = table_open(ag_label_relation_id(), RowShareLock); + ag_label = table_open(ag_label_relation_id(), RowExclusiveLock); foreach (lc, label_expr->label_names) { @@ -139,7 +140,7 @@ void create_label_expr_relations(Oid graphoid, char *graphname, append_to_allrelations(ag_label, label_name, ag_label_relation, graphoid); } - table_close(ag_label, NoLock); + table_close(ag_label, RowExclusiveLock); /* signals to rebuild the ag_label cache */ CacheInvalidateRelcacheAll(); @@ -205,7 +206,7 @@ static void append_to_allrelations(Relation ag_label, char *label_name, new_ag_label_tup = heap_modify_tuple_by_cols(ag_label_tup, ag_label_tupdesc, 1, &replCols, &res_arraycat, &replIsNull); - simple_heap_update(ag_label, &ag_label_tup->t_data->t_ctid, + CatalogTupleUpdate(ag_label, &ag_label_tup->t_data->t_ctid, new_ag_label_tup); CommandCounterIncrement(); systable_endscan(ag_label_scan); diff --git a/src/backend/utils/cache/ag_cache.c b/src/backend/utils/cache/ag_cache.c index 6d1a2612c..d97e2b164 100644 --- a/src/backend/utils/cache/ag_cache.c +++ b/src/backend/utils/cache/ag_cache.c @@ -653,13 +653,6 @@ static void invalidate_label_caches(Datum arg, Oid relid) invalidate_label_relation_cache(relid); invalidate_label_seq_name_graph_cache(relid); invalidate_label_allrelations_cache(relid); - - // TODO: this is a temporary fix to cache being - // corrupted after invalidation by create_label_expr_relations - label_relation_cache_hash = NULL; - label_allrelations_cache_hash = NULL; - create_label_relation_cache(); - create_label_allrelations_cache(); } else { @@ -668,13 +661,6 @@ static void invalidate_label_caches(Datum arg, Oid relid) flush_label_relation_cache(); flush_label_seq_name_graph_cache(); flush_allrelations_cache(); - - // TODO: this is a temporary fix to cache being - // corrupted after invalidation by create_label_expr_relations - label_relation_cache_hash = NULL; - label_allrelations_cache_hash = NULL; - create_label_relation_cache(); - create_label_allrelations_cache(); } } @@ -875,7 +861,7 @@ static void flush_allrelations_cache(void) if (!removed) { ereport(ERROR, - (errmsg_internal("label (relation) cache corrupted"))); + (errmsg_internal("label (allrelations) cache corrupted"))); } } } @@ -1118,7 +1104,7 @@ static label_cache_data *search_label_relation_cache_miss(Oid relation) SysScanDesc scan_desc; HeapTuple tuple; bool found; - label_cache_data *entry; + label_relation_cache_entry *entry; memcpy(scan_keys, label_relation_scan_keys, sizeof(label_relation_scan_keys)); @@ -1150,12 +1136,12 @@ static label_cache_data *search_label_relation_cache_miss(Oid relation) Assert(!found); /* no concurrent update on label_relation_cache_hash */ /* fill the new entry with the retrieved tuple */ - fill_label_cache_data(entry, tuple, RelationGetDescr(ag_label)); + fill_label_cache_data(&entry->data, tuple, RelationGetDescr(ag_label)); systable_endscan(scan_desc); table_close(ag_label, AccessShareLock); - return entry; + return &entry->data; } label_cache_data *search_label_seq_name_graph_cache(const char *name, Oid graph) diff --git a/src/include/nodes/ag_nodes.h b/src/include/nodes/ag_nodes.h index eeb9c44ea..69aeb14ab 100644 --- a/src/include/nodes/ag_nodes.h +++ b/src/include/nodes/ag_nodes.h @@ -68,7 +68,6 @@ typedef enum ag_node_tag cypher_create_target_nodes_t, cypher_create_path_t, cypher_target_node_t, - // TODO: if cypher_label_expr_t goes before cypher_target_node_t, the program crashes cypher_label_expr_t, /* set/remove data structures */ cypher_update_information_t, From af5bed41d2f00768b8463cd82d1f98e036a156b2 Mon Sep 17 00:00:00 2001 From: Rafsun Masud Date: Wed, 13 Dec 2023 13:17:48 -0800 Subject: [PATCH 08/13] Refactor to improve quality Changes: -------- - Update create_label_expr_relations() to return RangeVar. It removes redundant call to label_expr_relname() in the code that also calls this function. - Use deconstruct_array() to convert ArrayType* to List* - Update test files after rebase --- regress/expected/cypher_match.out | 146 ++++++++++++------------- regress/expected/cypher_merge.out | 72 ++++++------ regress/expected/expr.out | 36 +++--- regress/expected/multiple_label.out | 4 +- src/backend/parser/cypher_clause.c | 37 ++----- src/backend/parser/cypher_label_expr.c | 14 ++- src/backend/utils/cache/ag_cache.c | 23 ++-- src/include/parser/cypher_label_expr.h | 6 +- 8 files changed, 164 insertions(+), 174 deletions(-) diff --git a/regress/expected/cypher_match.out b/regress/expected/cypher_match.out index 7cd2287b8..c5b1fbfcf 100644 --- a/regress/expected/cypher_match.out +++ b/regress/expected/cypher_match.out @@ -2992,9 +2992,9 @@ NOTICE: graph "issue_1393" has been created SELECT * FROM cypher('issue_1393', $$ CREATE (n1:Object) RETURN n1 $$) AS (n1 agtype); - n1 ----------------------------------------------------------------------- - {"id": 844424930131969, "label": "Object", "properties": {}}::vertex + n1 +------------------------------------------------------------------------ + {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex (1 row) -- vertex cases @@ -3015,17 +3015,17 @@ $$) AS (n1 agtype, n2 agtype); SELECT * FROM cypher('issue_1393', $$ MATCH (n1:Object) MATCH (n2:Object) WHERE NOT EXISTS((n1)-[]->(n2)) RETURN n1,n2 $$) AS (n1 agtype, n2 agtype); - n1 | n2 -----------------------------------------------------------------------+---------------------------------------------------------------------- - {"id": 844424930131969, "label": "Object", "properties": {}}::vertex | {"id": 844424930131969, "label": "Object", "properties": {}}::vertex + n1 | n2 +------------------------------------------------------------------------+------------------------------------------------------------------------ + {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('issue_1393', $$ MATCH (n1:Object) MATCH (n2:Object) WHERE NOT EXISTS((n1:Object)-[]->(n2:Object)) RETURN n1,n2 $$) AS (n1 agtype, n2 agtype); - n1 | n2 -----------------------------------------------------------------------+---------------------------------------------------------------------- - {"id": 844424930131969, "label": "Object", "properties": {}}::vertex | {"id": 844424930131969, "label": "Object", "properties": {}}::vertex + n1 | n2 +------------------------------------------------------------------------+------------------------------------------------------------------------ + {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('issue_1393', $$ @@ -3038,109 +3038,109 @@ $$) AS (n1 agtype, n2 agtype); SELECT * FROM cypher('issue_1393', $$ MATCH (n1:Object) MATCH (n2:Object) WHERE NOT EXISTS((n1)-[]->()) RETURN n1,n2 $$) AS (n1 agtype, n2 agtype); - n1 | n2 -----------------------------------------------------------------------+---------------------------------------------------------------------- - {"id": 844424930131969, "label": "Object", "properties": {}}::vertex | {"id": 844424930131969, "label": "Object", "properties": {}}::vertex + n1 | n2 +------------------------------------------------------------------------+------------------------------------------------------------------------ + {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('issue_1393', $$ CREATE (n1:Object)-[e:knows]->(n2:Object) RETURN n1, e, n2 $$) AS (n1 agtype, e agtype, n2 agtype); - n1 | e | n2 -----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------- - {"id": 844424930131970, "label": "Object", "properties": {}}::vertex | {"id": 1125899906842625, "label": "knows", "end_id": 844424930131971, "start_id": 844424930131970, "properties": {}}::edge | {"id": 844424930131971, "label": "Object", "properties": {}}::vertex + n1 | e | n2 +------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------ + {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex | {"id": 1125899906842625, "label": "knows", "end_id": 844424930131971, "start_id": 844424930131970, "properties": {}}::edge | {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('issue_1393', $$ MATCH (n1:Object) MATCH (n2:Object) WHERE EXISTS((n1)-[]->(n2)) RETURN n1,n2 $$) AS (n1 agtype, n2 agtype); - n1 | n2 -----------------------------------------------------------------------+---------------------------------------------------------------------- - {"id": 844424930131970, "label": "Object", "properties": {}}::vertex | {"id": 844424930131971, "label": "Object", "properties": {}}::vertex + n1 | n2 +------------------------------------------------------------------------+------------------------------------------------------------------------ + {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('issue_1393', $$ MATCH (n1:Object) MATCH (n2:Object) WHERE EXISTS((n1:Object)-[]->(n2:Object)) RETURN n1,n2 $$) AS (n1 agtype, n2 agtype); - n1 | n2 -----------------------------------------------------------------------+---------------------------------------------------------------------- - {"id": 844424930131970, "label": "Object", "properties": {}}::vertex | {"id": 844424930131971, "label": "Object", "properties": {}}::vertex + n1 | n2 +------------------------------------------------------------------------+------------------------------------------------------------------------ + {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex (1 row) SELECT * FROM cypher('issue_1393', $$ MATCH (n1:Object) MATCH (n2:Object) WHERE NOT EXISTS((n1)-[]->(n2)) RETURN n1,n2 $$) AS (n1 agtype, n2 agtype); - n1 | n2 -----------------------------------------------------------------------+---------------------------------------------------------------------- - {"id": 844424930131969, "label": "Object", "properties": {}}::vertex | {"id": 844424930131969, "label": "Object", "properties": {}}::vertex - {"id": 844424930131969, "label": "Object", "properties": {}}::vertex | {"id": 844424930131970, "label": "Object", "properties": {}}::vertex - {"id": 844424930131969, "label": "Object", "properties": {}}::vertex | {"id": 844424930131971, "label": "Object", "properties": {}}::vertex - {"id": 844424930131970, "label": "Object", "properties": {}}::vertex | {"id": 844424930131969, "label": "Object", "properties": {}}::vertex - {"id": 844424930131970, "label": "Object", "properties": {}}::vertex | {"id": 844424930131970, "label": "Object", "properties": {}}::vertex - {"id": 844424930131971, "label": "Object", "properties": {}}::vertex | {"id": 844424930131969, "label": "Object", "properties": {}}::vertex - {"id": 844424930131971, "label": "Object", "properties": {}}::vertex | {"id": 844424930131970, "label": "Object", "properties": {}}::vertex - {"id": 844424930131971, "label": "Object", "properties": {}}::vertex | {"id": 844424930131971, "label": "Object", "properties": {}}::vertex + n1 | n2 +------------------------------------------------------------------------+------------------------------------------------------------------------ + {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex (8 rows) SELECT * FROM cypher('issue_1393', $$ MATCH (n1:Object) MATCH (n2:Object) WHERE NOT EXISTS((n1:Object)-[]->(n2:Object)) RETURN n1,n2 $$) AS (n1 agtype, n2 agtype); - n1 | n2 -----------------------------------------------------------------------+---------------------------------------------------------------------- - {"id": 844424930131969, "label": "Object", "properties": {}}::vertex | {"id": 844424930131969, "label": "Object", "properties": {}}::vertex - {"id": 844424930131969, "label": "Object", "properties": {}}::vertex | {"id": 844424930131970, "label": "Object", "properties": {}}::vertex - {"id": 844424930131969, "label": "Object", "properties": {}}::vertex | {"id": 844424930131971, "label": "Object", "properties": {}}::vertex - {"id": 844424930131970, "label": "Object", "properties": {}}::vertex | {"id": 844424930131969, "label": "Object", "properties": {}}::vertex - {"id": 844424930131970, "label": "Object", "properties": {}}::vertex | {"id": 844424930131970, "label": "Object", "properties": {}}::vertex - {"id": 844424930131971, "label": "Object", "properties": {}}::vertex | {"id": 844424930131969, "label": "Object", "properties": {}}::vertex - {"id": 844424930131971, "label": "Object", "properties": {}}::vertex | {"id": 844424930131970, "label": "Object", "properties": {}}::vertex - {"id": 844424930131971, "label": "Object", "properties": {}}::vertex | {"id": 844424930131971, "label": "Object", "properties": {}}::vertex + n1 | n2 +------------------------------------------------------------------------+------------------------------------------------------------------------ + {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex (8 rows) SELECT * FROM cypher('issue_1393', $$ MATCH (n1:Object) MATCH (n2:Object) WHERE EXISTS((n1)-[]->()) RETURN n1,n2 $$) AS (n1 agtype, n2 agtype); - n1 | n2 -----------------------------------------------------------------------+---------------------------------------------------------------------- - {"id": 844424930131970, "label": "Object", "properties": {}}::vertex | {"id": 844424930131969, "label": "Object", "properties": {}}::vertex - {"id": 844424930131970, "label": "Object", "properties": {}}::vertex | {"id": 844424930131970, "label": "Object", "properties": {}}::vertex - {"id": 844424930131970, "label": "Object", "properties": {}}::vertex | {"id": 844424930131971, "label": "Object", "properties": {}}::vertex + n1 | n2 +------------------------------------------------------------------------+------------------------------------------------------------------------ + {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex (3 rows) SELECT * FROM cypher('issue_1393', $$ MATCH (n1:Object) MATCH (n2:Object) WHERE NOT EXISTS((n1)-[]->()) RETURN n1,n2 $$) AS (n1 agtype, n2 agtype); - n1 | n2 -----------------------------------------------------------------------+---------------------------------------------------------------------- - {"id": 844424930131969, "label": "Object", "properties": {}}::vertex | {"id": 844424930131969, "label": "Object", "properties": {}}::vertex - {"id": 844424930131971, "label": "Object", "properties": {}}::vertex | {"id": 844424930131969, "label": "Object", "properties": {}}::vertex - {"id": 844424930131969, "label": "Object", "properties": {}}::vertex | {"id": 844424930131970, "label": "Object", "properties": {}}::vertex - {"id": 844424930131971, "label": "Object", "properties": {}}::vertex | {"id": 844424930131970, "label": "Object", "properties": {}}::vertex - {"id": 844424930131969, "label": "Object", "properties": {}}::vertex | {"id": 844424930131971, "label": "Object", "properties": {}}::vertex - {"id": 844424930131971, "label": "Object", "properties": {}}::vertex | {"id": 844424930131971, "label": "Object", "properties": {}}::vertex + n1 | n2 +------------------------------------------------------------------------+------------------------------------------------------------------------ + {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex (6 rows) SELECT * FROM cypher('issue_1393', $$ MATCH (n1:Object) MATCH (n2:Object) WHERE EXISTS((n1:Object)-[]->()) RETURN n1,n2 $$) AS (n1 agtype, n2 agtype); - n1 | n2 -----------------------------------------------------------------------+---------------------------------------------------------------------- - {"id": 844424930131970, "label": "Object", "properties": {}}::vertex | {"id": 844424930131969, "label": "Object", "properties": {}}::vertex - {"id": 844424930131970, "label": "Object", "properties": {}}::vertex | {"id": 844424930131970, "label": "Object", "properties": {}}::vertex - {"id": 844424930131970, "label": "Object", "properties": {}}::vertex | {"id": 844424930131971, "label": "Object", "properties": {}}::vertex + n1 | n2 +------------------------------------------------------------------------+------------------------------------------------------------------------ + {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex (3 rows) SELECT * FROM cypher('issue_1393', $$ MATCH (n1:Object) MATCH (n2:Object) WHERE NOT EXISTS((n1:Object)-[]->()) RETURN n1,n2 $$) AS (n1 agtype, n2 agtype); - n1 | n2 -----------------------------------------------------------------------+---------------------------------------------------------------------- - {"id": 844424930131969, "label": "Object", "properties": {}}::vertex | {"id": 844424930131969, "label": "Object", "properties": {}}::vertex - {"id": 844424930131971, "label": "Object", "properties": {}}::vertex | {"id": 844424930131969, "label": "Object", "properties": {}}::vertex - {"id": 844424930131969, "label": "Object", "properties": {}}::vertex | {"id": 844424930131970, "label": "Object", "properties": {}}::vertex - {"id": 844424930131971, "label": "Object", "properties": {}}::vertex | {"id": 844424930131970, "label": "Object", "properties": {}}::vertex - {"id": 844424930131969, "label": "Object", "properties": {}}::vertex | {"id": 844424930131971, "label": "Object", "properties": {}}::vertex - {"id": 844424930131971, "label": "Object", "properties": {}}::vertex | {"id": 844424930131971, "label": "Object", "properties": {}}::vertex + n1 | n2 +------------------------------------------------------------------------+------------------------------------------------------------------------ + {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131969, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex + {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex (6 rows) -- should error @@ -3279,18 +3279,18 @@ SELECT * FROM cypher('issue_1393', $$ MATCH (n1) MATCH (n2) MATCH (n1)-[e1]->() MATCH (n2)<-[e2]-(n1) MATCH (n3) WHERE EXISTS((n3)-[e1]->(n2)) RETURN n1,n2,n3,e1 $$) AS (n1 agtype, n2 agtype, n3 agtype, e1 agtype); - n1 | n2 | n3 | e1 -----------------------------------------------------------------------+----------------------------------------------------------------------+----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------- - {"id": 844424930131970, "label": "Object", "properties": {}}::vertex | {"id": 844424930131971, "label": "Object", "properties": {}}::vertex | {"id": 844424930131970, "label": "Object", "properties": {}}::vertex | {"id": 1125899906842625, "label": "knows", "end_id": 844424930131971, "start_id": 844424930131970, "properties": {}}::edge + n1 | n2 | n3 | e1 +------------------------------------------------------------------------+------------------------------------------------------------------------+------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex | {"id": 1125899906842625, "label": "knows", "end_id": 844424930131971, "start_id": 844424930131970, "properties": {}}::edge (1 row) SELECT * FROM cypher('issue_1393', $$ MATCH (n1:Object) MATCH (n2:Object) MATCH (n1)-[e1:knows]->() MATCH (n2)<-[e2:knows]-(n1) MATCH (n3:Object) WHERE EXISTS((n3:Object)-[e1:knows]->(n2:Object)) RETURN n1,n2,n3,e1 $$) AS (n1 agtype, n2 agtype, n3 agtype, e1 agtype); - n1 | n2 | n3 | e1 -----------------------------------------------------------------------+----------------------------------------------------------------------+----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------- - {"id": 844424930131970, "label": "Object", "properties": {}}::vertex | {"id": 844424930131971, "label": "Object", "properties": {}}::vertex | {"id": 844424930131970, "label": "Object", "properties": {}}::vertex | {"id": 1125899906842625, "label": "knows", "end_id": 844424930131971, "start_id": 844424930131970, "properties": {}}::edge + n1 | n2 | n3 | e1 +------------------------------------------------------------------------+------------------------------------------------------------------------+------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131971, "label": ["Object"], "properties": {}}::vertex | {"id": 844424930131970, "label": ["Object"], "properties": {}}::vertex | {"id": 1125899906842625, "label": "knows", "end_id": 844424930131971, "start_id": 844424930131970, "properties": {}}::edge (1 row) -- diff --git a/regress/expected/cypher_merge.out b/regress/expected/cypher_merge.out index cddf4bb11..06841c500 100644 --- a/regress/expected/cypher_merge.out +++ b/regress/expected/cypher_merge.out @@ -1083,58 +1083,58 @@ NOTICE: graph "issue_1219" has been created (1 row) SELECT * FROM cypher('issue_1219', $$ CREATE (x:Label1{arr:[1,2,3,4]}) RETURN x $$) as (a agtype); - a ------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "Label1", "properties": {"arr": [1, 2, 3, 4]}}::vertex + a +------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["Label1"], "properties": {"arr": [1, 2, 3, 4]}}::vertex (1 row) SELECT * FROM cypher('issue_1219', $$ MATCH (x:Label1{arr:[1,2,3,4]}) MERGE (y:Label2{key1:2, key2:x.arr, key3:3}) RETURN y $$) as (result agtype); - result ------------------------------------------------------------------------------------------------------------------ - {"id": 1125899906842625, "label": "Label2", "properties": {"key1": 2, "key2": [1, 2, 3, 4], "key3": 3}}::vertex + result +------------------------------------------------------------------------------------------------------------------- + {"id": 1125899906842625, "label": ["Label2"], "properties": {"key1": 2, "key2": [1, 2, 3, 4], "key3": 3}}::vertex (1 row) SELECT * FROM cypher('issue_1219', $$ MATCH (x:Label1{arr:[1,2,3,4]}) MERGE (y:Label2{key2:id(x)}) RETURN y $$) as (result agtype); - result ----------------------------------------------------------------------------------------------- - {"id": 1125899906842626, "label": "Label2", "properties": {"key2": 844424930131969}}::vertex + result +------------------------------------------------------------------------------------------------ + {"id": 1125899906842626, "label": ["Label2"], "properties": {"key2": 844424930131969}}::vertex (1 row) SELECT * FROM cypher('issue_1219', $$ MATCH (x) RETURN x $$) as (a agtype); - a ------------------------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "Label1", "properties": {"arr": [1, 2, 3, 4]}}::vertex - {"id": 1125899906842625, "label": "Label2", "properties": {"key1": 2, "key2": [1, 2, 3, 4], "key3": 3}}::vertex - {"id": 1125899906842626, "label": "Label2", "properties": {"key2": 844424930131969}}::vertex + a +------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["Label1"], "properties": {"arr": [1, 2, 3, 4]}}::vertex + {"id": 1125899906842625, "label": ["Label2"], "properties": {"key1": 2, "key2": [1, 2, 3, 4], "key3": 3}}::vertex + {"id": 1125899906842626, "label": ["Label2"], "properties": {"key2": 844424930131969}}::vertex (3 rows) -- these shouldn't create more SELECT * FROM cypher('issue_1219', $$ MATCH (x:Label1{arr:[1,2,3,4]}) MERGE (y:Label2{key1:2, key2:x.arr, key3:3}) RETURN y $$) as (result agtype); - result ------------------------------------------------------------------------------------------------------------------ - {"id": 1125899906842625, "label": "Label2", "properties": {"key1": 2, "key2": [1, 2, 3, 4], "key3": 3}}::vertex + result +------------------------------------------------------------------------------------------------------------------- + {"id": 1125899906842625, "label": ["Label2"], "properties": {"key1": 2, "key2": [1, 2, 3, 4], "key3": 3}}::vertex (1 row) SELECT * FROM cypher('issue_1219', $$ MATCH (x:Label1{arr:[1,2,3,4]}) MERGE (y:Label2{key2:id(x)}) RETURN y $$) as (result agtype); - result ----------------------------------------------------------------------------------------------- - {"id": 1125899906842626, "label": "Label2", "properties": {"key2": 844424930131969}}::vertex + result +------------------------------------------------------------------------------------------------ + {"id": 1125899906842626, "label": ["Label2"], "properties": {"key2": 844424930131969}}::vertex (1 row) SELECT * FROM cypher('issue_1219', $$ MATCH (x) RETURN x $$) as (a agtype); - a ------------------------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "Label1", "properties": {"arr": [1, 2, 3, 4]}}::vertex - {"id": 1125899906842625, "label": "Label2", "properties": {"key1": 2, "key2": [1, 2, 3, 4], "key3": 3}}::vertex - {"id": 1125899906842626, "label": "Label2", "properties": {"key2": 844424930131969}}::vertex + a +------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["Label1"], "properties": {"arr": [1, 2, 3, 4]}}::vertex + {"id": 1125899906842625, "label": ["Label2"], "properties": {"key1": 2, "key2": [1, 2, 3, 4], "key3": 3}}::vertex + {"id": 1125899906842626, "label": ["Label2"], "properties": {"key2": 844424930131969}}::vertex (3 rows) -- create a path @@ -1149,20 +1149,20 @@ SELECT * FROM cypher('issue_1219', $$ MATCH (u:Label1{name:"John"})-[e:knows]->(v:Label1{name: "Jane"}) MERGE (y:Label2{start_id:id(u), edge_id:id(e), end_id:id(v)}) RETURN y $$) as (result agtype); - result ----------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 1125899906842627, "label": "Label2", "properties": {"end_id": 844424930131971, "edge_id": 1407374883553281, "start_id": 844424930131970}}::vertex + result +------------------------------------------------------------------------------------------------------------------------------------------------------------ + {"id": 1125899906842627, "label": ["Label2"], "properties": {"end_id": 844424930131971, "edge_id": 1407374883553281, "start_id": 844424930131970}}::vertex (1 row) SELECT * FROM cypher('issue_1219', $$ MATCH (x) RETURN x $$) as (result agtype); - result ----------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "Label1", "properties": {"arr": [1, 2, 3, 4]}}::vertex - {"id": 844424930131970, "label": "Label1", "properties": {"name": "John"}}::vertex - {"id": 844424930131971, "label": "Label1", "properties": {"name": "Jane"}}::vertex - {"id": 1125899906842625, "label": "Label2", "properties": {"key1": 2, "key2": [1, 2, 3, 4], "key3": 3}}::vertex - {"id": 1125899906842626, "label": "Label2", "properties": {"key2": 844424930131969}}::vertex - {"id": 1125899906842627, "label": "Label2", "properties": {"end_id": 844424930131971, "edge_id": 1407374883553281, "start_id": 844424930131970}}::vertex + result +------------------------------------------------------------------------------------------------------------------------------------------------------------ + {"id": 844424930131969, "label": ["Label1"], "properties": {"arr": [1, 2, 3, 4]}}::vertex + {"id": 844424930131970, "label": ["Label1"], "properties": {"name": "John"}}::vertex + {"id": 844424930131971, "label": ["Label1"], "properties": {"name": "Jane"}}::vertex + {"id": 1125899906842625, "label": ["Label2"], "properties": {"key1": 2, "key2": [1, 2, 3, 4], "key3": 3}}::vertex + {"id": 1125899906842626, "label": ["Label2"], "properties": {"key2": 844424930131969}}::vertex + {"id": 1125899906842627, "label": ["Label2"], "properties": {"end_id": 844424930131971, "edge_id": 1407374883553281, "start_id": 844424930131970}}::vertex (6 rows) SELECT * FROM cypher('issue_1219', $$ MATCH ()-[e]->() RETURN e $$) as (result agtype); diff --git a/regress/expected/expr.out b/regress/expected/expr.out index 13e9a1d56..ee46c77a8 100644 --- a/regress/expected/expr.out +++ b/regress/expected/expr.out @@ -6886,7 +6886,7 @@ SELECT * FROM cypher('case_statement', $$ $$ ) AS (case_statement agtype); case_statement ------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"i": 1, "id": 1}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": 1, "id": 1}}::vertex "none" "none" "none" @@ -6907,7 +6907,7 @@ $$ ) AS (case_statement agtype); "none" "none" "none" - {"id": 281474976710660, "label": "", "properties": {"i": true, "j": false, "id": 4}}::vertex + {"id": 281474976710660, "label": [], "properties": {"i": true, "j": false, "id": 4}}::vertex "none" "none" (6 rows) @@ -6942,11 +6942,11 @@ $$ ) AS (case_statement agtype); case_statement ------------------------------------------------------------------------------------------------ "none" - {"id": 281474976710658, "label": "", "properties": {"i": "a", "j": "b", "id": 2}}::vertex - {"id": 281474976710659, "label": "", "properties": {"i": 0, "j": 1, "id": 3}}::vertex - {"id": 281474976710660, "label": "", "properties": {"i": true, "j": false, "id": 4}}::vertex - {"id": 281474976710661, "label": "", "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex - {"id": 281474976710662, "label": "", "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex + {"id": 281474976710658, "label": [], "properties": {"i": "a", "j": "b", "id": 2}}::vertex + {"id": 281474976710659, "label": [], "properties": {"i": 0, "j": 1, "id": 3}}::vertex + {"id": 281474976710660, "label": [], "properties": {"i": true, "j": false, "id": 4}}::vertex + {"id": 281474976710661, "label": [], "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex + {"id": 281474976710662, "label": [], "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex (6 rows) SELECT * FROM cypher('case_statement', $$ @@ -6959,12 +6959,12 @@ SELECT * FROM cypher('case_statement', $$ $$ ) AS (case_statement agtype); case_statement ------------------------------------------------------------------------------------------------ - {"id": 281474976710657, "label": "", "properties": {"i": 1, "id": 1}}::vertex - {"id": 281474976710658, "label": "", "properties": {"i": "a", "j": "b", "id": 2}}::vertex - {"id": 281474976710659, "label": "", "properties": {"i": 0, "j": 1, "id": 3}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": 1, "id": 1}}::vertex + {"id": 281474976710658, "label": [], "properties": {"i": "a", "j": "b", "id": 2}}::vertex + {"id": 281474976710659, "label": [], "properties": {"i": 0, "j": 1, "id": 3}}::vertex "none" - {"id": 281474976710661, "label": "", "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex - {"id": 281474976710662, "label": "", "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex + {"id": 281474976710661, "label": [], "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex + {"id": 281474976710662, "label": [], "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex (6 rows) --should return n @@ -6978,12 +6978,12 @@ SELECT * FROM cypher('case_statement', $$ $$ ) AS (case_statement agtype); case_statement ------------------------------------------------------------------------------------------------ - {"id": 281474976710657, "label": "", "properties": {"i": 1, "id": 1}}::vertex - {"id": 281474976710658, "label": "", "properties": {"i": "a", "j": "b", "id": 2}}::vertex - {"id": 281474976710659, "label": "", "properties": {"i": 0, "j": 1, "id": 3}}::vertex - {"id": 281474976710660, "label": "", "properties": {"i": true, "j": false, "id": 4}}::vertex - {"id": 281474976710661, "label": "", "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex - {"id": 281474976710662, "label": "", "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex + {"id": 281474976710657, "label": [], "properties": {"i": 1, "id": 1}}::vertex + {"id": 281474976710658, "label": [], "properties": {"i": "a", "j": "b", "id": 2}}::vertex + {"id": 281474976710659, "label": [], "properties": {"i": 0, "j": 1, "id": 3}}::vertex + {"id": 281474976710660, "label": [], "properties": {"i": true, "j": false, "id": 4}}::vertex + {"id": 281474976710661, "label": [], "properties": {"i": [], "j": [0, 1, 2], "id": 5}}::vertex + {"id": 281474976710662, "label": [], "properties": {"i": {}, "j": {"i": 1}, "id": 6}}::vertex (6 rows) --chained expression in THEN diff --git a/regress/expected/multiple_label.out b/regress/expected/multiple_label.out index 5e730613e..cc04443da 100644 --- a/regress/expected/multiple_label.out +++ b/regress/expected/multiple_label.out @@ -1058,7 +1058,7 @@ SELECT * FROM cypher('mlabels12', $$ MATCH (x) SET x.age = 32 RETURN x $$) as (" SELECT * FROM cypher('mlabels12', $$ MERGE (x:Teacher:Person) RETURN x $$) as ("MERGE" agtype); MERGE ------------------------------------------------------------------------------------ - {"id": 1688849860263937, "label": ["Teacher", "Person"], "properties": {}}::vertex + {"id": 1688849860263937, "label": ["Person", "Teacher"], "properties": {}}::vertex (1 row) -- check vle @@ -1142,7 +1142,7 @@ SELECT * FROM cypher('mlabels12', $$ MATCH (x) RETURN labels(x) $$) as ("labels" [] ["Student", "Person"] ["Person"] - ["Teacher", "Person"] + ["Person", "Teacher"] ["a", "b"] ["k"] ["m", "n"] diff --git a/src/backend/parser/cypher_clause.c b/src/backend/parser/cypher_clause.c index 7e1c67765..a2073bb19 100644 --- a/src/backend/parser/cypher_clause.c +++ b/src/backend/parser/cypher_clause.c @@ -5949,7 +5949,6 @@ transform_create_cypher_edge(cypher_parsestate *cpstate, List **target_list, AttrNumber resno; ParseNamespaceItem *pnsi; char *invalid_label; - char *relname; check_label_expr_type_for_create(pstate, (Node *)edge); @@ -5964,8 +5963,6 @@ transform_create_cypher_edge(cypher_parsestate *cpstate, List **target_list, parser_errposition(pstate, edge->location))); } - relname = label_expr_relname(edge->label_expr, LABEL_KIND_EDGE); - rel->type = LABEL_KIND_EDGE; rel->flags = CYPHER_TARGET_NODE_FLAG_INSERT; rel->label_expr = edge->label_expr; @@ -6020,11 +6017,9 @@ transform_create_cypher_edge(cypher_parsestate *cpstate, List **target_list, parser_errposition(&cpstate->pstate, edge->location))); } - create_label_expr_relations(cpstate->graph_oid, cpstate->graph_name, - edge->label_expr, LABEL_KIND_EDGE); - /* lock the relation of the label */ - rv = makeRangeVar(cpstate->graph_name, relname, -1); + rv = create_label_expr_relations(cpstate->graph_oid, cpstate->graph_name, + edge->label_expr, LABEL_KIND_EDGE); label_relation = parserOpenTable(&cpstate->pstate, rv, RowExclusiveLock); /* Store the relid */ @@ -6265,7 +6260,6 @@ transform_create_cypher_new_node(cypher_parsestate *cpstate, char *alias; int resno; ParseNamespaceItem *pnsi; - char *relname; check_label_expr_type_for_create(pstate, (Node *)node); @@ -6273,17 +6267,12 @@ transform_create_cypher_new_node(cypher_parsestate *cpstate, rel->tuple_position = InvalidAttrNumber; rel->variable_name = NULL; rel->resultRelInfo = NULL; - - relname = label_expr_relname(node->label_expr, LABEL_KIND_VERTEX); + rel->flags = CYPHER_TARGET_NODE_FLAG_INSERT; rel->label_expr = node->label_expr; /* create the label entry */ - create_label_expr_relations(cpstate->graph_oid, cpstate->graph_name, - node->label_expr, LABEL_KIND_VERTEX); - - rel->flags = CYPHER_TARGET_NODE_FLAG_INSERT; - - rv = makeRangeVar(cpstate->graph_name, relname, -1); + rv = create_label_expr_relations(cpstate->graph_oid, cpstate->graph_name, + node->label_expr, LABEL_KIND_VERTEX); label_relation = parserOpenTable(&cpstate->pstate, rv, RowExclusiveLock); /* Store the relid */ @@ -7303,7 +7292,6 @@ transform_merge_cypher_edge(cypher_parsestate *cpstate, List **target_list, RangeVar *rv; RTEPermissionInfo *rte_pi; ParseNamespaceItem *pnsi; - char *relname; check_label_expr_type_for_create(pstate, (Node *)edge); @@ -7347,13 +7335,9 @@ transform_merge_cypher_edge(cypher_parsestate *cpstate, List **target_list, parser_errposition(&cpstate->pstate, edge->location))); } - relname = label_expr_relname(edge->label_expr, LABEL_KIND_EDGE); - - create_label_expr_relations(cpstate->graph_oid, cpstate->graph_name, - edge->label_expr, LABEL_KIND_EDGE); - /* lock the relation of the label */ - rv = makeRangeVar(cpstate->graph_name, relname, -1); + rv = create_label_expr_relations(cpstate->graph_oid, cpstate->graph_name, + edge->label_expr, LABEL_KIND_EDGE); label_relation = parserOpenTable(&cpstate->pstate, rv, RowExclusiveLock); /* @@ -7407,7 +7391,6 @@ transform_merge_cypher_node(cypher_parsestate *cpstate, List **target_list, RangeVar *rv; RTEPermissionInfo *rte_pi; ParseNamespaceItem *pnsi; - char *relname; check_label_expr_type_for_create((ParseState *)cpstate, (Node *)node); @@ -7457,8 +7440,6 @@ transform_merge_cypher_node(cypher_parsestate *cpstate, List **target_list, rel->tuple_position = InvalidAttrNumber; rel->variable_name = node->name; rel->resultRelInfo = NULL; - - relname = label_expr_relname(node->label_expr, LABEL_KIND_VERTEX); rel->label_expr = node->label_expr; create_label_expr_relations(cpstate->graph_oid, cpstate->graph_name, @@ -7466,7 +7447,9 @@ transform_merge_cypher_node(cypher_parsestate *cpstate, List **target_list, rel->flags |= CYPHER_TARGET_NODE_FLAG_INSERT; - rv = makeRangeVar(cpstate->graph_name, relname, -1); + // create the label relation + rv = create_label_expr_relations(cpstate->graph_oid, cpstate->graph_name, + node->label_expr, LABEL_KIND_VERTEX); label_relation = parserOpenTable(&cpstate->pstate, rv, RowExclusiveLock); /* diff --git a/src/backend/parser/cypher_label_expr.c b/src/backend/parser/cypher_label_expr.c index 17745f82f..e129440ca 100644 --- a/src/backend/parser/cypher_label_expr.c +++ b/src/backend/parser/cypher_label_expr.c @@ -19,7 +19,7 @@ static void append_to_allrelations(Relation ag_label, char *label_name, /* * Creates ag_label entries and relations required for the given `label_expr` - * if does not exists. + * if does not exists. Returns the RangeVar of ag_label.relation. * * The label_expr may represent empty, single or multiple labels. For empty * (default labels) and single label, a relation is created and an ag_label @@ -51,14 +51,15 @@ static void append_to_allrelations(Relation ag_label, char *label_name, * being treated as a label, it has a label ID). The latter option is easier to * implement. */ -void create_label_expr_relations(Oid graphoid, char *graphname, - cypher_label_expr *label_expr, - char label_expr_kind) +RangeVar *create_label_expr_relations(Oid graphoid, char *graphname, + cypher_label_expr *label_expr, + char label_expr_kind) { List *parents; char *ag_label_relation; char rel_kind; cypher_label_expr_type label_expr_type; + RangeVar *rv; label_expr_type = LABEL_EXPR_TYPE(label_expr); @@ -94,6 +95,7 @@ void create_label_expr_relations(Oid graphoid, char *graphname, * holds the intersection relation name. */ ag_label_relation = label_expr_relname(label_expr, label_expr_kind); + rv = makeRangeVar(graphname, ag_label_relation, -1); /* * If the relation exists, it can be assumed that all required ag_label @@ -101,7 +103,7 @@ void create_label_expr_relations(Oid graphoid, char *graphname, */ if (ag_relation_exists(ag_label_relation, graphoid)) { - return; + return rv; } /* creates ag_label entry and relation */ @@ -146,6 +148,8 @@ void create_label_expr_relations(Oid graphoid, char *graphname, CacheInvalidateRelcacheAll(); CommandCounterIncrement(); } + + return rv; } /* diff --git a/src/backend/utils/cache/ag_cache.c b/src/backend/utils/cache/ag_cache.c index d97e2b164..ff3f3f0d5 100644 --- a/src/backend/utils/cache/ag_cache.c +++ b/src/backend/utils/cache/ag_cache.c @@ -1356,10 +1356,10 @@ static void fill_label_cache_data(label_cache_data *cache_data, Datum value; Name name; MemoryContext oldctx; - Oid *allrelations_oids; - ArrayType *allrelations_arr; - int allrelations_len; int i; + Datum *elemsp; + bool *nullsp; + int nelemsp; /* ag_label.name */ value = heap_getattr(tuple, Anum_ag_label_name, tuple_desc, &is_null); @@ -1396,16 +1396,19 @@ static void fill_label_cache_data(label_cache_data *cache_data, // ag_label.allrelations value = heap_getattr(tuple, Anum_ag_label_allrelations, tuple_desc, &is_null); Assert(!is_null); - allrelations_arr = DatumGetArrayTypeP(value); - allrelations_len = ArrayGetNItems(ARR_NDIM(allrelations_arr), - ARR_DIMS(allrelations_arr)); - allrelations_oids = (Oid *) ARR_DATA_PTR(allrelations_arr); - cache_data->allrelations = NIL; + + elemsp = (Datum *)palloc(sizeof(Datum)); + nullsp = (bool *)palloc(sizeof(bool)); + deconstruct_array(DatumGetArrayTypeP(value), REGCLASSOID, 4, true, + TYPALIGN_INT, &elemsp, &nullsp, &nelemsp); + oldctx = MemoryContextSwitchTo(CacheMemoryContext); - for (i = 0; i < allrelations_len; i++) + cache_data->allrelations = NIL; + for (i = 0; i < nelemsp; i++) { + Assert(!nullsp[i]); cache_data->allrelations = lappend_oid(cache_data->allrelations, - allrelations_oids[i]); + DatumGetObjectId(elemsp[i])); } MemoryContextSwitchTo(oldctx); diff --git a/src/include/parser/cypher_label_expr.h b/src/include/parser/cypher_label_expr.h index a5f9e5771..f5f169e4d 100644 --- a/src/include/parser/cypher_label_expr.h +++ b/src/include/parser/cypher_label_expr.h @@ -49,9 +49,9 @@ (list_length(get_label_expr_relations((label_expr), (label_expr_kind), \ (graph_oid))) > 0) -void create_label_expr_relations(Oid graphoid, char *graphname, - cypher_label_expr *label_expr, - char label_expr_kind); +RangeVar *create_label_expr_relations(Oid graphoid, char *graphname, + cypher_label_expr *label_expr, + char label_expr_kind); List *get_label_expr_relations(cypher_label_expr *label_expr, char label_expr_kind, Oid graph_oid); From f3495c3c3d654bceafd8b42bc09789125b83bbcf Mon Sep 17 00:00:00 2001 From: Rafsun Masud Date: Mon, 12 Feb 2024 15:13:20 -0800 Subject: [PATCH 09/13] Add brackets to scope some case statements This fixes some compile-time errors that occur if PostgreSQL is configured with the --with-llvm option. --- src/backend/parser/cypher_label_expr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/backend/parser/cypher_label_expr.c b/src/backend/parser/cypher_label_expr.c index e129440ca..716eb23a2 100644 --- a/src/backend/parser/cypher_label_expr.c +++ b/src/backend/parser/cypher_label_expr.c @@ -260,6 +260,7 @@ List *get_label_expr_relations(cypher_label_expr *label_expr, case LABEL_EXPR_TYPE_AND: case LABEL_EXPR_TYPE_OR: + { List *reloids; List *(*merge_lists)(List *, const List *); ListCell *lc; @@ -322,7 +323,7 @@ List *get_label_expr_relations(cypher_label_expr *label_expr, } } return reloids; - + } default: elog(ERROR, "invalid cypher_label_expr type"); return NIL; @@ -378,6 +379,7 @@ char *label_expr_relname(cypher_label_expr *label_expr, char label_expr_kind) return (char *)strVal(linitial(label_expr->label_names)); case LABEL_EXPR_TYPE_AND: + { /* * generates a name for intersection relation * i.e. for CREATE (:A:B:C), _agr_ABC @@ -401,6 +403,7 @@ char *label_expr_relname(cypher_label_expr *label_expr, char label_expr_kind) pfree(relname_strinfo); return relname; + } case LABEL_EXPR_TYPE_OR: elog(ERROR, "label expression type OR cannot have a table"); From 101eb94ac9e1f828e57b775ab172eca4474fe43f Mon Sep 17 00:00:00 2001 From: Rafsun Masud Date: Wed, 24 Apr 2024 12:26:16 -0700 Subject: [PATCH 10/13] Fix issues after rebasing Changes: ------- * Include missing header files * Update newly added tests * Other minor changes --- regress/expected/age_global_graph.out | 24 +- regress/expected/cypher_create.out | 4 +- regress/expected/cypher_match.out | 6 +- regress/expected/cypher_merge.out | 214 +++++++------- regress/expected/cypher_set.out | 18 +- regress/expected/cypher_subquery.out | 374 ++++++++++++------------ regress/expected/list_comprehension.out | 86 +++--- src/backend/parser/cypher_clause.c | 1 + src/backend/parser/cypher_gram.y | 11 +- src/backend/parser/cypher_label_expr.c | 1 + src/backend/utils/adt/agtype.c | 2 +- src/backend/utils/cache/ag_cache.c | 2 +- src/include/catalog/ag_label.h | 2 + 13 files changed, 365 insertions(+), 380 deletions(-) diff --git a/regress/expected/age_global_graph.out b/regress/expected/age_global_graph.out index e0ed26a1d..cbc23c1a3 100644 --- a/regress/expected/age_global_graph.out +++ b/regress/expected/age_global_graph.out @@ -274,10 +274,10 @@ SELECT * FROM cypher('ag_graph_1', $$ MATCH (u)-[]->(v) SET u.id = id(u) RETURN u,v $$) AS (u agtype, v agtype); u | v --------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"id": 281474976710659, "name": "u"}}::vertex | {"id": 281474976710660, "label": "", "properties": {"id": 281474976710660, "name": "v"}}::vertex - {"id": 281474976710661, "label": "", "properties": {"id": 281474976710661, "name": "u"}}::vertex | {"id": 281474976710662, "label": "", "properties": {"id": 281474976710662, "name": "v"}}::vertex - {"id": 281474976710663, "label": "", "properties": {"id": 281474976710663, "name": "u"}}::vertex | {"id": 281474976710664, "label": "", "properties": {"id": 281474976710664, "name": "v"}}::vertex - {"id": 281474976710665, "label": "", "properties": {"id": 281474976710665, "name": "u"}}::vertex | {"id": 281474976710666, "label": "", "properties": {"id": 281474976710666, "name": "v"}}::vertex + {"id": 281474976710659, "label": [], "properties": {"id": 281474976710659, "name": "u"}}::vertex | {"id": 281474976710660, "label": [], "properties": {"id": 281474976710660, "name": "v"}}::vertex + {"id": 281474976710661, "label": [], "properties": {"id": 281474976710661, "name": "u"}}::vertex | {"id": 281474976710662, "label": [], "properties": {"id": 281474976710662, "name": "v"}}::vertex + {"id": 281474976710663, "label": [], "properties": {"id": 281474976710663, "name": "u"}}::vertex | {"id": 281474976710664, "label": [], "properties": {"id": 281474976710664, "name": "v"}}::vertex + {"id": 281474976710665, "label": [], "properties": {"id": 281474976710665, "name": "u"}}::vertex | {"id": 281474976710666, "label": [], "properties": {"id": 281474976710666, "name": "v"}}::vertex (4 rows) SELECT * FROM cypher('ag_graph_1', $$ MATCH (u)-[]->(v) MERGE (v)-[:stalks]->(u) $$) AS (result agtype); @@ -288,14 +288,14 @@ SELECT * FROM cypher('ag_graph_1', $$ MATCH (u)-[]->(v) MERGE (v)-[:stalks]->(u) SELECT * FROM cypher('ag_graph_1', $$ MATCH (u)-[e]->(v) RETURN u, e, v $$) AS (u agtype, e agtype, v agtype); u | e | v --------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------- - {"id": 281474976710660, "label": "", "properties": {"id": 281474976710660, "name": "v"}}::vertex | {"id": 1407374883553281, "label": "stalks", "end_id": 281474976710659, "start_id": 281474976710660, "properties": {}}::edge | {"id": 281474976710659, "label": "", "properties": {"id": 281474976710659, "name": "u"}}::vertex - {"id": 281474976710659, "label": "", "properties": {"id": 281474976710659, "name": "u"}}::vertex | {"id": 1125899906842625, "label": "knows", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge | {"id": 281474976710660, "label": "", "properties": {"id": 281474976710660, "name": "v"}}::vertex - {"id": 281474976710662, "label": "", "properties": {"id": 281474976710662, "name": "v"}}::vertex | {"id": 1407374883553282, "label": "stalks", "end_id": 281474976710661, "start_id": 281474976710662, "properties": {}}::edge | {"id": 281474976710661, "label": "", "properties": {"id": 281474976710661, "name": "u"}}::vertex - {"id": 281474976710661, "label": "", "properties": {"id": 281474976710661, "name": "u"}}::vertex | {"id": 1125899906842626, "label": "knows", "end_id": 281474976710662, "start_id": 281474976710661, "properties": {}}::edge | {"id": 281474976710662, "label": "", "properties": {"id": 281474976710662, "name": "v"}}::vertex - {"id": 281474976710664, "label": "", "properties": {"id": 281474976710664, "name": "v"}}::vertex | {"id": 1407374883553283, "label": "stalks", "end_id": 281474976710663, "start_id": 281474976710664, "properties": {}}::edge | {"id": 281474976710663, "label": "", "properties": {"id": 281474976710663, "name": "u"}}::vertex - {"id": 281474976710663, "label": "", "properties": {"id": 281474976710663, "name": "u"}}::vertex | {"id": 1125899906842627, "label": "knows", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {}}::edge | {"id": 281474976710664, "label": "", "properties": {"id": 281474976710664, "name": "v"}}::vertex - {"id": 281474976710666, "label": "", "properties": {"id": 281474976710666, "name": "v"}}::vertex | {"id": 1407374883553284, "label": "stalks", "end_id": 281474976710665, "start_id": 281474976710666, "properties": {}}::edge | {"id": 281474976710665, "label": "", "properties": {"id": 281474976710665, "name": "u"}}::vertex - {"id": 281474976710665, "label": "", "properties": {"id": 281474976710665, "name": "u"}}::vertex | {"id": 1125899906842628, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710665, "properties": {}}::edge | {"id": 281474976710666, "label": "", "properties": {"id": 281474976710666, "name": "v"}}::vertex + {"id": 281474976710660, "label": [], "properties": {"id": 281474976710660, "name": "v"}}::vertex | {"id": 1407374883553281, "label": "stalks", "end_id": 281474976710659, "start_id": 281474976710660, "properties": {}}::edge | {"id": 281474976710659, "label": [], "properties": {"id": 281474976710659, "name": "u"}}::vertex + {"id": 281474976710659, "label": [], "properties": {"id": 281474976710659, "name": "u"}}::vertex | {"id": 1125899906842625, "label": "knows", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge | {"id": 281474976710660, "label": [], "properties": {"id": 281474976710660, "name": "v"}}::vertex + {"id": 281474976710662, "label": [], "properties": {"id": 281474976710662, "name": "v"}}::vertex | {"id": 1407374883553282, "label": "stalks", "end_id": 281474976710661, "start_id": 281474976710662, "properties": {}}::edge | {"id": 281474976710661, "label": [], "properties": {"id": 281474976710661, "name": "u"}}::vertex + {"id": 281474976710661, "label": [], "properties": {"id": 281474976710661, "name": "u"}}::vertex | {"id": 1125899906842626, "label": "knows", "end_id": 281474976710662, "start_id": 281474976710661, "properties": {}}::edge | {"id": 281474976710662, "label": [], "properties": {"id": 281474976710662, "name": "v"}}::vertex + {"id": 281474976710664, "label": [], "properties": {"id": 281474976710664, "name": "v"}}::vertex | {"id": 1407374883553283, "label": "stalks", "end_id": 281474976710663, "start_id": 281474976710664, "properties": {}}::edge | {"id": 281474976710663, "label": [], "properties": {"id": 281474976710663, "name": "u"}}::vertex + {"id": 281474976710663, "label": [], "properties": {"id": 281474976710663, "name": "u"}}::vertex | {"id": 1125899906842627, "label": "knows", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {}}::edge | {"id": 281474976710664, "label": [], "properties": {"id": 281474976710664, "name": "v"}}::vertex + {"id": 281474976710666, "label": [], "properties": {"id": 281474976710666, "name": "v"}}::vertex | {"id": 1407374883553284, "label": "stalks", "end_id": 281474976710665, "start_id": 281474976710666, "properties": {}}::edge | {"id": 281474976710665, "label": [], "properties": {"id": 281474976710665, "name": "u"}}::vertex + {"id": 281474976710665, "label": [], "properties": {"id": 281474976710665, "name": "u"}}::vertex | {"id": 1125899906842628, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710665, "properties": {}}::edge | {"id": 281474976710666, "label": [], "properties": {"id": 281474976710666, "name": "v"}}::vertex (8 rows) -- what is there now? diff --git a/regress/expected/cypher_create.out b/regress/expected/cypher_create.out index ccf119328..cdf7cd3ba 100644 --- a/regress/expected/cypher_create.out +++ b/regress/expected/cypher_create.out @@ -895,7 +895,7 @@ SELECT * FROM cypher('cypher_create', $$ $$) as (r agtype); r ---------------------------------------------------------------- - {"id": 281474976710685, "label": "", "properties": {}}::vertex + {"id": 281474976710685, "label": [], "properties": {}}::vertex (1 row) SELECT * FROM cypher('cypher_create', $$ @@ -903,7 +903,7 @@ SELECT * FROM cypher('cypher_create', $$ $$) as (m agtype); m ---------------------------------------------------------------- - {"id": 281474976710689, "label": "", "properties": {}}::vertex + {"id": 281474976710689, "label": [], "properties": {}}::vertex (1 row) -- diff --git a/regress/expected/cypher_match.out b/regress/expected/cypher_match.out index c5b1fbfcf..577d2527b 100644 --- a/regress/expected/cypher_match.out +++ b/regress/expected/cypher_match.out @@ -3298,9 +3298,9 @@ $$) AS (n1 agtype, n2 agtype, n3 agtype, e1 agtype); -- -- Using the test_enable_containment graph for these tests SELECT * FROM cypher('test_enable_containment', $$ CREATE p=(:Customer)-[:bought {store:'Amazon', addr:{city: 'Vancouver', street: 30}}]->(y:Product) RETURN p $$) as (a agtype); - a ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 844424930131970, "label": "Customer", "properties": {}}::vertex, {"id": 1125899906842625, "label": "bought", "end_id": 1407374883553281, "start_id": 844424930131970, "properties": {"addr": {"city": "Vancouver", "street": 30}, "store": "Amazon"}}::edge, {"id": 1407374883553281, "label": "Product", "properties": {}}::vertex]::path + a +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + [{"id": 844424930131970, "label": ["Customer"], "properties": {}}::vertex, {"id": 1125899906842625, "label": "bought", "end_id": 1407374883553281, "start_id": 844424930131970, "properties": {"addr": {"city": "Vancouver", "street": 30}, "store": "Amazon"}}::edge, {"id": 1407374883553281, "label": ["Product"], "properties": {}}::vertex]::path (1 row) -- With enable_containment on diff --git a/regress/expected/cypher_merge.out b/regress/expected/cypher_merge.out index 06841c500..b64860135 100644 --- a/regress/expected/cypher_merge.out +++ b/regress/expected/cypher_merge.out @@ -1283,9 +1283,9 @@ SELECT * FROM cypher('issue_1630', $$ WITH ['jon', 'snow'] AS cols MERGE (v:PERSION {first: cols[0], last: cols[1]}) RETURN v $$) AS (v agtype); - v ------------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "PERSION", "properties": {"last": "snow", "first": "jon"}}::vertex + v +------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["PERSION"], "properties": {"last": "snow", "first": "jon"}}::vertex (1 row) -- will it retrieve it, if it exists? @@ -1293,15 +1293,15 @@ SELECT * FROM cypher('issue_1630', $$ WITH ['jon', 'snow'] AS cols MERGE (v:PERSION {first: cols[0], last: cols[1]}) RETURN v $$) AS (v agtype); - v ------------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "PERSION", "properties": {"last": "snow", "first": "jon"}}::vertex + v +------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["PERSION"], "properties": {"last": "snow", "first": "jon"}}::vertex (1 row) SELECT * FROM cypher('issue_1630', $$ MATCH (u) RETURN (u) $$) AS (u agtype); - u ------------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "PERSION", "properties": {"last": "snow", "first": "jon"}}::vertex + u +------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["PERSION"], "properties": {"last": "snow", "first": "jon"}}::vertex (1 row) -- a whole array @@ -1309,9 +1309,9 @@ SELECT * FROM cypher('issue_1630', $$ WITH ['jon', 'snow'] AS cols MERGE (v:PERSION {namea: cols}) RETURN v $$) AS (v agtype); - v ------------------------------------------------------------------------------------------------ - {"id": 844424930131970, "label": "PERSION", "properties": {"namea": ["jon", "snow"]}}::vertex + v +------------------------------------------------------------------------------------------------- + {"id": 844424930131970, "label": ["PERSION"], "properties": {"namea": ["jon", "snow"]}}::vertex (1 row) -- a whole object @@ -1319,9 +1319,9 @@ SELECT * FROM cypher('issue_1630', $$ WITH {first: 'jon', last: 'snow'} AS cols MERGE (v:PERSION {nameo: cols}) RETURN v $$) AS (v agtype); - v ----------------------------------------------------------------------------------------------------------------- - {"id": 844424930131971, "label": "PERSION", "properties": {"nameo": {"last": "snow", "first": "jon"}}}::vertex + v +------------------------------------------------------------------------------------------------------------------ + {"id": 844424930131971, "label": ["PERSION"], "properties": {"nameo": {"last": "snow", "first": "jon"}}}::vertex (1 row) -- delete them to start over @@ -1334,9 +1334,9 @@ SELECT * FROM cypher('issue_1630', $$ WITH {first: 'jon', last: 'snow'} AS cols MERGE (v:PERSION {first: cols.first, last: cols.last}) RETURN v $$) AS (v agtype); - v ------------------------------------------------------------------------------------------------------ - {"id": 844424930131972, "label": "PERSION", "properties": {"last": "snow", "first": "jon"}}::vertex + v +------------------------------------------------------------------------------------------------------- + {"id": 844424930131972, "label": ["PERSION"], "properties": {"last": "snow", "first": "jon"}}::vertex (1 row) -- delete them to start over @@ -1352,9 +1352,9 @@ SELECT * FROM cypher('issue_1630', WITH name AS cols MERGE (v:PERSION {first: cols.first, last: cols.last}) RETURN v $$) AS (v agtype); - v ------------------------------------------------------------------------------------------------------ - {"id": 844424930131973, "label": "PERSION", "properties": {"last": "snow", "first": "jon"}}::vertex + v +------------------------------------------------------------------------------------------------------- + {"id": 844424930131973, "label": ["PERSION"], "properties": {"last": "snow", "first": "jon"}}::vertex (1 row) -- will it retrieve the one created? @@ -1364,9 +1364,9 @@ SELECT * FROM cypher('issue_1630', WITH name AS cols MERGE (v:PERSION {first: cols.first, last: cols.last}) RETURN v $$) AS (v agtype); - v ------------------------------------------------------------------------------------------------------ - {"id": 844424930131973, "label": "PERSION", "properties": {"last": "snow", "first": "jon"}}::vertex + v +------------------------------------------------------------------------------------------------------- + {"id": 844424930131973, "label": ["PERSION"], "properties": {"last": "snow", "first": "jon"}}::vertex (1 row) -- delete them to start over @@ -1382,9 +1382,9 @@ SELECT * FROM cypher('issue_1630', WITH name AS cols MERGE (v:PERSION {first: cols.first, last: cols.last}) RETURN v, cols $$) AS (v agtype, cols agtype); - v | cols ------------------------------------------------------------------------------------------------------+---------------------------------- - {"id": 844424930131974, "label": "PERSION", "properties": {"last": "snow", "first": "jon"}}::vertex | {"last": "snow", "first": "jon"} + v | cols +-------------------------------------------------------------------------------------------------------+---------------------------------- + {"id": 844424930131974, "label": ["PERSION"], "properties": {"last": "snow", "first": "jon"}}::vertex | {"last": "snow", "first": "jon"} (1 row) -- @@ -1408,10 +1408,10 @@ SELECT * FROM cypher('issue_1691', $$ UNWIND ["foo", "bar", "foo", "foo"] as n RETURN u, e, v $$) AS (u agtype, e agtype, v agtype); u | e | v -----------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"name": "foo"}}::vertex | {"id": 844424930131969, "label": "knows", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge | {"id": 281474976710658, "label": "", "properties": {}}::vertex - {"id": 281474976710659, "label": "", "properties": {"name": "bar"}}::vertex | {"id": 844424930131970, "label": "knows", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge | {"id": 281474976710660, "label": "", "properties": {}}::vertex - {"id": 281474976710657, "label": "", "properties": {"name": "foo"}}::vertex | {"id": 844424930131969, "label": "knows", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge | {"id": 281474976710658, "label": "", "properties": {}}::vertex - {"id": 281474976710657, "label": "", "properties": {"name": "foo"}}::vertex | {"id": 844424930131969, "label": "knows", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge | {"id": 281474976710658, "label": "", "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {"name": "foo"}}::vertex | {"id": 844424930131969, "label": "knows", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge | {"id": 281474976710658, "label": [], "properties": {}}::vertex + {"id": 281474976710659, "label": [], "properties": {"name": "bar"}}::vertex | {"id": 844424930131970, "label": "knows", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge | {"id": 281474976710660, "label": [], "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {"name": "foo"}}::vertex | {"id": 844424930131969, "label": "knows", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge | {"id": 281474976710658, "label": [], "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {"name": "foo"}}::vertex | {"id": 844424930131969, "label": "knows", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge | {"id": 281474976710658, "label": [], "properties": {}}::vertex (4 rows) -- should only return the same above 4 rows @@ -1420,10 +1420,10 @@ SELECT * FROM cypher('issue_1691', $$ UNWIND ["foo", "bar", "foo", "foo"] as n RETURN u, e, v $$) AS (u agtype, e agtype, v agtype); u | e | v -----------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"name": "foo"}}::vertex | {"id": 844424930131969, "label": "knows", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge | {"id": 281474976710658, "label": "", "properties": {}}::vertex - {"id": 281474976710659, "label": "", "properties": {"name": "bar"}}::vertex | {"id": 844424930131970, "label": "knows", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge | {"id": 281474976710660, "label": "", "properties": {}}::vertex - {"id": 281474976710657, "label": "", "properties": {"name": "foo"}}::vertex | {"id": 844424930131969, "label": "knows", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge | {"id": 281474976710658, "label": "", "properties": {}}::vertex - {"id": 281474976710657, "label": "", "properties": {"name": "foo"}}::vertex | {"id": 844424930131969, "label": "knows", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge | {"id": 281474976710658, "label": "", "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {"name": "foo"}}::vertex | {"id": 844424930131969, "label": "knows", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge | {"id": 281474976710658, "label": [], "properties": {}}::vertex + {"id": 281474976710659, "label": [], "properties": {"name": "bar"}}::vertex | {"id": 844424930131970, "label": "knows", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge | {"id": 281474976710660, "label": [], "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {"name": "foo"}}::vertex | {"id": 844424930131969, "label": "knows", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge | {"id": 281474976710658, "label": [], "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {"name": "foo"}}::vertex | {"id": 844424930131969, "label": "knows", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge | {"id": 281474976710658, "label": [], "properties": {}}::vertex (4 rows) -- should only return 2 distinct rows from above @@ -1431,8 +1431,8 @@ SELECT * FROM cypher('issue_1691', $$ MATCH (u)-[e]->(v) RETURN u, e, v $$) AS (u agtype, e agtype, v agtype); u | e | v -----------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"name": "foo"}}::vertex | {"id": 844424930131969, "label": "knows", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge | {"id": 281474976710658, "label": "", "properties": {}}::vertex - {"id": 281474976710659, "label": "", "properties": {"name": "bar"}}::vertex | {"id": 844424930131970, "label": "knows", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge | {"id": 281474976710660, "label": "", "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {"name": "foo"}}::vertex | {"id": 844424930131969, "label": "knows", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge | {"id": 281474976710658, "label": [], "properties": {}}::vertex + {"id": 281474976710659, "label": [], "properties": {"name": "bar"}}::vertex | {"id": 844424930131970, "label": "knows", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge | {"id": 281474976710660, "label": [], "properties": {}}::vertex (2 rows) SELECT * FROM cypher('issue_1691', $$MATCH ()-[e]->() DELETE e $$) AS (a agtype); @@ -1449,55 +1449,55 @@ SELECT * FROM cypher('issue_1691', $$MATCH (u) DELETE u $$) AS (a agtype); SELECT * FROM cypher('issue_1691', $$ UNWIND ["foo", "foo"] AS each MERGE (v:TEST {name: each}) RETURN v $$) AS (v agtype); - v ----------------------------------------------------------------------------------- - {"id": 1125899906842625, "label": "TEST", "properties": {"name": "foo"}}::vertex - {"id": 1125899906842625, "label": "TEST", "properties": {"name": "foo"}}::vertex + v +------------------------------------------------------------------------------------ + {"id": 1125899906842625, "label": ["TEST"], "properties": {"name": "foo"}}::vertex + {"id": 1125899906842625, "label": ["TEST"], "properties": {"name": "foo"}}::vertex (2 rows) SELECT * FROM cypher('issue_1691', $$ MATCH (u) RETURN (u) $$) AS (u agtype); - u ----------------------------------------------------------------------------------- - {"id": 1125899906842625, "label": "TEST", "properties": {"name": "foo"}}::vertex + u +------------------------------------------------------------------------------------ + {"id": 1125899906842625, "label": ["TEST"], "properties": {"name": "foo"}}::vertex (1 row) -- should just return 5 foo records that are all the same one SELECT * FROM cypher('issue_1691', $$ UNWIND ["foo", "foo", "bar", "foo", "bar"] AS each MERGE (v:TEST {name: "foo"}) RETURN v $$) AS (v agtype); - v ----------------------------------------------------------------------------------- - {"id": 1125899906842625, "label": "TEST", "properties": {"name": "foo"}}::vertex - {"id": 1125899906842625, "label": "TEST", "properties": {"name": "foo"}}::vertex - {"id": 1125899906842625, "label": "TEST", "properties": {"name": "foo"}}::vertex - {"id": 1125899906842625, "label": "TEST", "properties": {"name": "foo"}}::vertex - {"id": 1125899906842625, "label": "TEST", "properties": {"name": "foo"}}::vertex + v +------------------------------------------------------------------------------------ + {"id": 1125899906842625, "label": ["TEST"], "properties": {"name": "foo"}}::vertex + {"id": 1125899906842625, "label": ["TEST"], "properties": {"name": "foo"}}::vertex + {"id": 1125899906842625, "label": ["TEST"], "properties": {"name": "foo"}}::vertex + {"id": 1125899906842625, "label": ["TEST"], "properties": {"name": "foo"}}::vertex + {"id": 1125899906842625, "label": ["TEST"], "properties": {"name": "foo"}}::vertex (5 rows) SELECT * FROM cypher('issue_1691', $$ MATCH (u) RETURN (u) $$) AS (u agtype); - u ----------------------------------------------------------------------------------- - {"id": 1125899906842625, "label": "TEST", "properties": {"name": "foo"}}::vertex + u +------------------------------------------------------------------------------------ + {"id": 1125899906842625, "label": ["TEST"], "properties": {"name": "foo"}}::vertex (1 row) -- should just return 5 bar records that are all the same one SELECT * FROM cypher('issue_1691', $$ UNWIND ["foo", "foo", "bar", "foo", "bar"] AS each MERGE (v:TEST {name: "bar"}) RETURN v $$) AS (v agtype); - v ----------------------------------------------------------------------------------- - {"id": 1125899906842626, "label": "TEST", "properties": {"name": "bar"}}::vertex - {"id": 1125899906842626, "label": "TEST", "properties": {"name": "bar"}}::vertex - {"id": 1125899906842626, "label": "TEST", "properties": {"name": "bar"}}::vertex - {"id": 1125899906842626, "label": "TEST", "properties": {"name": "bar"}}::vertex - {"id": 1125899906842626, "label": "TEST", "properties": {"name": "bar"}}::vertex + v +------------------------------------------------------------------------------------ + {"id": 1125899906842626, "label": ["TEST"], "properties": {"name": "bar"}}::vertex + {"id": 1125899906842626, "label": ["TEST"], "properties": {"name": "bar"}}::vertex + {"id": 1125899906842626, "label": ["TEST"], "properties": {"name": "bar"}}::vertex + {"id": 1125899906842626, "label": ["TEST"], "properties": {"name": "bar"}}::vertex + {"id": 1125899906842626, "label": ["TEST"], "properties": {"name": "bar"}}::vertex (5 rows) SELECT * FROM cypher('issue_1691', $$ MATCH (u) RETURN (u) $$) AS (u agtype); - u ----------------------------------------------------------------------------------- - {"id": 1125899906842625, "label": "TEST", "properties": {"name": "foo"}}::vertex - {"id": 1125899906842626, "label": "TEST", "properties": {"name": "bar"}}::vertex + u +------------------------------------------------------------------------------------ + {"id": 1125899906842625, "label": ["TEST"], "properties": {"name": "foo"}}::vertex + {"id": 1125899906842626, "label": ["TEST"], "properties": {"name": "bar"}}::vertex (2 rows) SELECT * FROM cypher('issue_1691', $$MATCH (u) DELETE u $$) AS (a agtype); @@ -1511,11 +1511,11 @@ SELECT * FROM cypher('issue_1691', $$ UNWIND ["foo", "bar", "foo", "foo", "bar"] RETURN u, e1, v, e2, w $$) AS (u agtype, e1 agtype, v agtype, e2 agtype, w agtype); u | e1 | v | e2 | w -----------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------- - {"id": 281474976710661, "label": "", "properties": {"name": "foo"}}::vertex | {"id": 844424930131972, "label": "knows", "end_id": 281474976710662, "start_id": 281474976710661, "properties": {}}::edge | {"id": 281474976710662, "label": "", "properties": {"name": "bar"}}::vertex | {"id": 844424930131971, "label": "knows", "end_id": 281474976710663, "start_id": 281474976710662, "properties": {}}::edge | {"id": 281474976710663, "label": "", "properties": {}}::vertex - {"id": 281474976710664, "label": "", "properties": {"name": "bar"}}::vertex | {"id": 844424930131974, "label": "knows", "end_id": 281474976710665, "start_id": 281474976710664, "properties": {}}::edge | {"id": 281474976710665, "label": "", "properties": {"name": "bar"}}::vertex | {"id": 844424930131973, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710665, "properties": {}}::edge | {"id": 281474976710666, "label": "", "properties": {}}::vertex - {"id": 281474976710661, "label": "", "properties": {"name": "foo"}}::vertex | {"id": 844424930131972, "label": "knows", "end_id": 281474976710662, "start_id": 281474976710661, "properties": {}}::edge | {"id": 281474976710662, "label": "", "properties": {"name": "bar"}}::vertex | {"id": 844424930131971, "label": "knows", "end_id": 281474976710663, "start_id": 281474976710662, "properties": {}}::edge | {"id": 281474976710663, "label": "", "properties": {}}::vertex - {"id": 281474976710661, "label": "", "properties": {"name": "foo"}}::vertex | {"id": 844424930131972, "label": "knows", "end_id": 281474976710662, "start_id": 281474976710661, "properties": {}}::edge | {"id": 281474976710662, "label": "", "properties": {"name": "bar"}}::vertex | {"id": 844424930131971, "label": "knows", "end_id": 281474976710663, "start_id": 281474976710662, "properties": {}}::edge | {"id": 281474976710663, "label": "", "properties": {}}::vertex - {"id": 281474976710664, "label": "", "properties": {"name": "bar"}}::vertex | {"id": 844424930131974, "label": "knows", "end_id": 281474976710665, "start_id": 281474976710664, "properties": {}}::edge | {"id": 281474976710665, "label": "", "properties": {"name": "bar"}}::vertex | {"id": 844424930131973, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710665, "properties": {}}::edge | {"id": 281474976710666, "label": "", "properties": {}}::vertex + {"id": 281474976710661, "label": [], "properties": {"name": "foo"}}::vertex | {"id": 844424930131972, "label": "knows", "end_id": 281474976710662, "start_id": 281474976710661, "properties": {}}::edge | {"id": 281474976710662, "label": [], "properties": {"name": "bar"}}::vertex | {"id": 844424930131971, "label": "knows", "end_id": 281474976710663, "start_id": 281474976710662, "properties": {}}::edge | {"id": 281474976710663, "label": [], "properties": {}}::vertex + {"id": 281474976710664, "label": [], "properties": {"name": "bar"}}::vertex | {"id": 844424930131974, "label": "knows", "end_id": 281474976710665, "start_id": 281474976710664, "properties": {}}::edge | {"id": 281474976710665, "label": [], "properties": {"name": "bar"}}::vertex | {"id": 844424930131973, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710665, "properties": {}}::edge | {"id": 281474976710666, "label": [], "properties": {}}::vertex + {"id": 281474976710661, "label": [], "properties": {"name": "foo"}}::vertex | {"id": 844424930131972, "label": "knows", "end_id": 281474976710662, "start_id": 281474976710661, "properties": {}}::edge | {"id": 281474976710662, "label": [], "properties": {"name": "bar"}}::vertex | {"id": 844424930131971, "label": "knows", "end_id": 281474976710663, "start_id": 281474976710662, "properties": {}}::edge | {"id": 281474976710663, "label": [], "properties": {}}::vertex + {"id": 281474976710661, "label": [], "properties": {"name": "foo"}}::vertex | {"id": 844424930131972, "label": "knows", "end_id": 281474976710662, "start_id": 281474976710661, "properties": {}}::edge | {"id": 281474976710662, "label": [], "properties": {"name": "bar"}}::vertex | {"id": 844424930131971, "label": "knows", "end_id": 281474976710663, "start_id": 281474976710662, "properties": {}}::edge | {"id": 281474976710663, "label": [], "properties": {}}::vertex + {"id": 281474976710664, "label": [], "properties": {"name": "bar"}}::vertex | {"id": 844424930131974, "label": "knows", "end_id": 281474976710665, "start_id": 281474976710664, "properties": {}}::edge | {"id": 281474976710665, "label": [], "properties": {"name": "bar"}}::vertex | {"id": 844424930131973, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710665, "properties": {}}::edge | {"id": 281474976710666, "label": [], "properties": {}}::vertex (5 rows) -- clean up @@ -1549,17 +1549,17 @@ SELECT * FROM cypher('issue_1709', $$ UNWIND [{first: 'jon', last: 'snow'}, {fir MERGE (v:PERSON {first: map.first}) SET v=map RETURN v $$) AS (v agtype); - v ------------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "PERSON", "properties": {"last": "snow", "first": "jon"}}::vertex - {"id": 844424930131970, "label": "PERSON", "properties": {"last": "stark", "first": "ned"}}::vertex + v +------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["PERSON"], "properties": {"last": "snow", "first": "jon"}}::vertex + {"id": 844424930131970, "label": ["PERSON"], "properties": {"last": "stark", "first": "ned"}}::vertex (2 rows) SELECT * FROM cypher('issue_1709', $$ MATCH (u) RETURN u $$) AS (u agtype); - u ------------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "PERSON", "properties": {"last": "snow", "first": "jon"}}::vertex - {"id": 844424930131970, "label": "PERSON", "properties": {"last": "stark", "first": "ned"}}::vertex + u +------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["PERSON"], "properties": {"last": "snow", "first": "jon"}}::vertex + {"id": 844424930131970, "label": ["PERSON"], "properties": {"last": "stark", "first": "ned"}}::vertex (2 rows) SELECT * FROM cypher('issue_1709', $$ MATCH (u) DELETE u $$) AS (a agtype); @@ -1571,22 +1571,22 @@ SELECT * FROM cypher('issue_1709', $$ UNWIND [{first: 'jon', last: 'snow'}, {fir MERGE (v:PERSON {first: map.first}) SET v=map RETURN v $$) AS (v agtype); - v ----------------------------------------------------------------------------------------------------------------------- - {"id": 844424930131971, "label": "PERSON", "properties": {"last": "snow", "first": "jon"}}::vertex - {"id": 844424930131972, "label": "PERSON", "properties": {"last": "stark", "first": "ned", "middle": "jim"}}::vertex - {"id": 844424930131973, "label": "PERSON", "properties": {"last": "doe", "first": "jane"}}::vertex - {"id": 844424930131972, "label": "PERSON", "properties": {"last": "flanders", "first": "ned"}}::vertex - {"id": 844424930131974, "label": "PERSON", "properties": {"last": "cosmo", "first": "wanda"}}::vertex + v +------------------------------------------------------------------------------------------------------------------------ + {"id": 844424930131971, "label": ["PERSON"], "properties": {"last": "snow", "first": "jon"}}::vertex + {"id": 844424930131972, "label": ["PERSON"], "properties": {"last": "stark", "first": "ned", "middle": "jim"}}::vertex + {"id": 844424930131973, "label": ["PERSON"], "properties": {"last": "doe", "first": "jane"}}::vertex + {"id": 844424930131972, "label": ["PERSON"], "properties": {"last": "flanders", "first": "ned"}}::vertex + {"id": 844424930131974, "label": ["PERSON"], "properties": {"last": "cosmo", "first": "wanda"}}::vertex (5 rows) SELECT * FROM cypher('issue_1709', $$ MATCH (u) RETURN u $$) AS (u agtype); - u --------------------------------------------------------------------------------------------------------- - {"id": 844424930131971, "label": "PERSON", "properties": {"last": "snow", "first": "jon"}}::vertex - {"id": 844424930131973, "label": "PERSON", "properties": {"last": "doe", "first": "jane"}}::vertex - {"id": 844424930131972, "label": "PERSON", "properties": {"last": "flanders", "first": "ned"}}::vertex - {"id": 844424930131974, "label": "PERSON", "properties": {"last": "cosmo", "first": "wanda"}}::vertex + u +---------------------------------------------------------------------------------------------------------- + {"id": 844424930131971, "label": ["PERSON"], "properties": {"last": "snow", "first": "jon"}}::vertex + {"id": 844424930131973, "label": ["PERSON"], "properties": {"last": "doe", "first": "jane"}}::vertex + {"id": 844424930131972, "label": ["PERSON"], "properties": {"last": "flanders", "first": "ned"}}::vertex + {"id": 844424930131974, "label": ["PERSON"], "properties": {"last": "cosmo", "first": "wanda"}}::vertex (4 rows) SELECT * FROM cypher('issue_1709', $$ MATCH (u) DELETE u $$) AS (a agtype); @@ -1598,17 +1598,17 @@ SELECT * FROM cypher('issue_1709', $$ UNWIND [{first: 'jon', last: 'snow'}, {fir MERGE (u: PERSON {last: map.last})-[e:KNOWS]->(v:PERSON {first: map.first}) SET v=map RETURN u,e,v $$) AS (u agtype, e agtype, v agtype); - u | e | v --------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------- - {"id": 844424930131975, "label": "PERSON", "properties": {"last": "snow"}}::vertex | {"id": 1125899906842625, "label": "KNOWS", "end_id": 844424930131976, "start_id": 844424930131975, "properties": {}}::edge | {"id": 844424930131976, "label": "PERSON", "properties": {"last": "snow", "first": "jon"}}::vertex - {"id": 844424930131977, "label": "PERSON", "properties": {"last": "stark"}}::vertex | {"id": 1125899906842626, "label": "KNOWS", "end_id": 844424930131978, "start_id": 844424930131977, "properties": {}}::edge | {"id": 844424930131978, "label": "PERSON", "properties": {"last": "stark", "first": "ned"}}::vertex + u | e | v +---------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------- + {"id": 844424930131975, "label": ["PERSON"], "properties": {"last": "snow"}}::vertex | {"id": 1125899906842625, "label": "KNOWS", "end_id": 844424930131976, "start_id": 844424930131975, "properties": {}}::edge | {"id": 844424930131976, "label": ["PERSON"], "properties": {"last": "snow", "first": "jon"}}::vertex + {"id": 844424930131977, "label": ["PERSON"], "properties": {"last": "stark"}}::vertex | {"id": 1125899906842626, "label": "KNOWS", "end_id": 844424930131978, "start_id": 844424930131977, "properties": {}}::edge | {"id": 844424930131978, "label": ["PERSON"], "properties": {"last": "stark", "first": "ned"}}::vertex (2 rows) SELECT * FROM cypher('issue_1709', $$ MATCH (u)-[e]->(v) RETURN u,e,v $$) AS (u agtype, e agtype, v agtype); - u | e | v --------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------- - {"id": 844424930131975, "label": "PERSON", "properties": {"last": "snow"}}::vertex | {"id": 1125899906842625, "label": "KNOWS", "end_id": 844424930131976, "start_id": 844424930131975, "properties": {}}::edge | {"id": 844424930131976, "label": "PERSON", "properties": {"last": "snow", "first": "jon"}}::vertex - {"id": 844424930131977, "label": "PERSON", "properties": {"last": "stark"}}::vertex | {"id": 1125899906842626, "label": "KNOWS", "end_id": 844424930131978, "start_id": 844424930131977, "properties": {}}::edge | {"id": 844424930131978, "label": "PERSON", "properties": {"last": "stark", "first": "ned"}}::vertex + u | e | v +---------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------- + {"id": 844424930131975, "label": ["PERSON"], "properties": {"last": "snow"}}::vertex | {"id": 1125899906842625, "label": "KNOWS", "end_id": 844424930131976, "start_id": 844424930131975, "properties": {}}::edge | {"id": 844424930131976, "label": ["PERSON"], "properties": {"last": "snow", "first": "jon"}}::vertex + {"id": 844424930131977, "label": ["PERSON"], "properties": {"last": "stark"}}::vertex | {"id": 1125899906842626, "label": "KNOWS", "end_id": 844424930131978, "start_id": 844424930131977, "properties": {}}::edge | {"id": 844424930131978, "label": ["PERSON"], "properties": {"last": "stark", "first": "ned"}}::vertex (2 rows) SELECT * FROM cypher('issue_1709', $$ MATCH ()-[e]->() DELETE e $$) AS (a agtype); @@ -1625,17 +1625,17 @@ SELECT * FROM cypher('issue_1709', $$ UNWIND [{first: 'jon', last: 'snow'}, {fir MERGE (u: PERSON {last: map.last})-[e:KNOWS]->(v:PERSON {first: map.first}) SET u=map SET v=map RETURN u,e,v $$) AS (u agtype, e agtype, v agtype); - u | e | v ------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------- - {"id": 844424930131979, "label": "PERSON", "properties": {"last": "snow", "first": "jon"}}::vertex | {"id": 1125899906842627, "label": "KNOWS", "end_id": 844424930131980, "start_id": 844424930131979, "properties": {}}::edge | {"id": 844424930131980, "label": "PERSON", "properties": {"last": "snow", "first": "jon"}}::vertex - {"id": 844424930131981, "label": "PERSON", "properties": {"last": "stark", "first": "ned"}}::vertex | {"id": 1125899906842628, "label": "KNOWS", "end_id": 844424930131982, "start_id": 844424930131981, "properties": {}}::edge | {"id": 844424930131982, "label": "PERSON", "properties": {"last": "stark", "first": "ned"}}::vertex + u | e | v +-------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------- + {"id": 844424930131979, "label": ["PERSON"], "properties": {"last": "snow", "first": "jon"}}::vertex | {"id": 1125899906842627, "label": "KNOWS", "end_id": 844424930131980, "start_id": 844424930131979, "properties": {}}::edge | {"id": 844424930131980, "label": ["PERSON"], "properties": {"last": "snow", "first": "jon"}}::vertex + {"id": 844424930131981, "label": ["PERSON"], "properties": {"last": "stark", "first": "ned"}}::vertex | {"id": 1125899906842628, "label": "KNOWS", "end_id": 844424930131982, "start_id": 844424930131981, "properties": {}}::edge | {"id": 844424930131982, "label": ["PERSON"], "properties": {"last": "stark", "first": "ned"}}::vertex (2 rows) SELECT * FROM cypher('issue_1709', $$ MATCH (u)-[e]->(v) RETURN u,e,v $$) AS (u agtype, e agtype, v agtype); - u | e | v ------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------- - {"id": 844424930131979, "label": "PERSON", "properties": {"last": "snow", "first": "jon"}}::vertex | {"id": 1125899906842627, "label": "KNOWS", "end_id": 844424930131980, "start_id": 844424930131979, "properties": {}}::edge | {"id": 844424930131980, "label": "PERSON", "properties": {"last": "snow", "first": "jon"}}::vertex - {"id": 844424930131981, "label": "PERSON", "properties": {"last": "stark", "first": "ned"}}::vertex | {"id": 1125899906842628, "label": "KNOWS", "end_id": 844424930131982, "start_id": 844424930131981, "properties": {}}::edge | {"id": 844424930131982, "label": "PERSON", "properties": {"last": "stark", "first": "ned"}}::vertex + u | e | v +-------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------- + {"id": 844424930131979, "label": ["PERSON"], "properties": {"last": "snow", "first": "jon"}}::vertex | {"id": 1125899906842627, "label": "KNOWS", "end_id": 844424930131980, "start_id": 844424930131979, "properties": {}}::edge | {"id": 844424930131980, "label": ["PERSON"], "properties": {"last": "snow", "first": "jon"}}::vertex + {"id": 844424930131981, "label": ["PERSON"], "properties": {"last": "stark", "first": "ned"}}::vertex | {"id": 1125899906842628, "label": "KNOWS", "end_id": 844424930131982, "start_id": 844424930131981, "properties": {}}::edge | {"id": 844424930131982, "label": ["PERSON"], "properties": {"last": "stark", "first": "ned"}}::vertex (2 rows) SELECT * FROM cypher('issue_1709', $$ MATCH ()-[e]->() DELETE e $$) AS (a agtype); diff --git a/regress/expected/cypher_set.out b/regress/expected/cypher_set.out index 9586a9b1d..da457f9ec 100644 --- a/regress/expected/cypher_set.out +++ b/regress/expected/cypher_set.out @@ -950,9 +950,9 @@ SELECT * FROM cypher('issue_1634', $$ WITH {first: 'jon', last: 'snow'} AS map MERGE (v:PERSION {id: '1'}) SET v=map RETURN v,map $$) as (v agtype, map agtype); - v | map ------------------------------------------------------------------------------------------------------+---------------------------------- - {"id": 844424930131969, "label": "PERSION", "properties": {"last": "snow", "first": "jon"}}::vertex | {"last": "snow", "first": "jon"} + v | map +-------------------------------------------------------------------------------------------------------+---------------------------------- + {"id": 844424930131969, "label": ["PERSION"], "properties": {"last": "snow", "first": "jon"}}::vertex | {"last": "snow", "first": "jon"} (1 row) -- these 2 did work and are added as extra tests @@ -965,9 +965,9 @@ SELECT * FROM cypher('issue_1634', $$ WITH {first: 'jon', last: 'snow'} AS map MERGE (v:PERSION {id: '1'}) SET v.first=map.first, v.last=map.last RETURN v,map $$) as (v agtype, map agtype); - v | map -----------------------------------------------------------------------------------------------------------------+---------------------------------- - {"id": 844424930131970, "label": "PERSION", "properties": {"id": "1", "last": "snow", "first": "jon"}}::vertex | {"last": "snow", "first": "jon"} + v | map +------------------------------------------------------------------------------------------------------------------+---------------------------------- + {"id": 844424930131970, "label": ["PERSION"], "properties": {"id": "1", "last": "snow", "first": "jon"}}::vertex | {"last": "snow", "first": "jon"} (1 row) SELECT * FROM cypher('issue_1634', $$ MATCH (u) DELETE (u) $$) AS (u agtype); @@ -978,9 +978,9 @@ SELECT * FROM cypher('issue_1634', $$ MATCH (u) DELETE (u) $$) AS (u agtype); SELECT * FROM cypher('issue_1634', $$ MERGE (v:PERSION {id: '1'}) SET v={first: 'jon', last: 'snow'} RETURN v $$) as (v agtype); - v ------------------------------------------------------------------------------------------------------ - {"id": 844424930131971, "label": "PERSION", "properties": {"last": "snow", "first": "jon"}}::vertex + v +------------------------------------------------------------------------------------------------------- + {"id": 844424930131971, "label": ["PERSION"], "properties": {"last": "snow", "first": "jon"}}::vertex (1 row) SELECT * FROM cypher('issue_1634', $$ MATCH (u) DELETE (u) $$) AS (u agtype); diff --git a/regress/expected/cypher_subquery.out b/regress/expected/cypher_subquery.out index ff5672bca..6741f1be3 100644 --- a/regress/expected/cypher_subquery.out +++ b/regress/expected/cypher_subquery.out @@ -20,54 +20,53 @@ SELECT * FROM cypher('subquery', $$ (0 rows) SELECT * FROM cypher('subquery', $$ MATCH (a) RETURN (a) $$) AS (result agtype); - result ---------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "person", "properties": {"age": 32, "name": "Briggite"}}::vertex - {"id": 844424930131970, "label": "person", "properties": {"age": 28, "name": "Takeshi"}}::vertex - {"id": 844424930131971, "label": "person", "properties": {"age": 45, "name": "Chan"}}::vertex - {"id": 844424930131972, "label": "person", "properties": {"age": 25, "name": "Faye"}}::vertex - {"id": 844424930131973, "label": "person", "properties": {"age": 34, "name": "Tony"}}::vertex - {"id": 844424930131974, "label": "person", "properties": {"age": 33, "name": "Valerie"}}::vertex - {"id": 844424930131975, "label": "person", "properties": {"age": 6, "name": "Calvin"}}::vertex - {"id": 844424930131976, "label": "person", "properties": {"age": 8, "name": "Lucy"}}::vertex - {"id": 844424930131977, "label": "person", "properties": {"age": 8, "name": "Charlie"}}::vertex - {"id": 844424930131978, "label": "person", "properties": {"age": 29, "name": "Jon"}}::vertex - {"id": 1688849860263937, "label": "pet", "properties": {"name": "Hobbes"}}::vertex - {"id": 1688849860263938, "label": "pet", "properties": {"name": "Snoopy"}}::vertex - {"id": 1688849860263939, "label": "pet", "properties": {"name": "Odie"}}::vertex - {"id": 1688849860263940, "label": "pet", "properties": {"name": "Garfield"}}::vertex -(14 rows) + result +----------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["person"], "properties": {"age": 32, "name": "Briggite"}}::vertex + {"id": 844424930131970, "label": ["person"], "properties": {"age": 28, "name": "Takeshi"}}::vertex + {"id": 844424930131971, "label": ["person"], "properties": {"age": 45, "name": "Chan"}}::vertex + {"id": 844424930131972, "label": ["person"], "properties": {"age": 25, "name": "Faye"}}::vertex + {"id": 844424930131973, "label": ["person"], "properties": {"age": 34, "name": "Tony"}}::vertex + {"id": 844424930131974, "label": ["person"], "properties": {"age": 33, "name": "Valerie"}}::vertex + {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex + {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex + {"id": 1688849860263937, "label": ["pet"], "properties": {"name": "Hobbes"}}::vertex + {"id": 1688849860263938, "label": ["pet"], "properties": {"name": "Snoopy"}}::vertex + {"id": 1688849860263939, "label": ["pet"], "properties": {"name": "Odie"}}::vertex + {"id": 1688849860263940, "label": ["pet"], "properties": {"name": "Garfield"}}::vertex +(13 rows) SELECT * FROM cypher('subquery', $$ MATCH (a:person) WHERE EXISTS {(a:person)-[]->(:pet)} RETURN (a) $$) AS (result agtype); - result -------------------------------------------------------------------------------------------------- - {"id": 844424930131975, "label": "person", "properties": {"age": 6, "name": "Calvin"}}::vertex - {"id": 844424930131977, "label": "person", "properties": {"age": 8, "name": "Charlie"}}::vertex - {"id": 844424930131978, "label": "person", "properties": {"age": 29, "name": "Jon"}}::vertex + result +--------------------------------------------------------------------------------------------------- + {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex + {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex (3 rows) --trying to use b when not defined, should create pattern SELECT * FROM cypher('subquery', $$ MATCH (a:person) WHERE EXISTS {(a:person)-[]->(b:pet)} RETURN (a) $$) AS (result agtype); - result -------------------------------------------------------------------------------------------------- - {"id": 844424930131975, "label": "person", "properties": {"age": 6, "name": "Calvin"}}::vertex - {"id": 844424930131977, "label": "person", "properties": {"age": 8, "name": "Charlie"}}::vertex - {"id": 844424930131978, "label": "person", "properties": {"age": 29, "name": "Jon"}}::vertex + result +--------------------------------------------------------------------------------------------------- + {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex + {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex (3 rows) --query inside SELECT * FROM cypher('subquery', $$ MATCH (a:person) WHERE EXISTS {MATCH (a:person)-[]->(b:pet) RETURN b} RETURN (a) $$) AS (result agtype); - result -------------------------------------------------------------------------------------------------- - {"id": 844424930131975, "label": "person", "properties": {"age": 6, "name": "Calvin"}}::vertex - {"id": 844424930131977, "label": "person", "properties": {"age": 8, "name": "Charlie"}}::vertex - {"id": 844424930131978, "label": "person", "properties": {"age": 29, "name": "Jon"}}::vertex + result +--------------------------------------------------------------------------------------------------- + {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex + {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex (3 rows) --repeat variable in match @@ -78,9 +77,9 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person) RETURN a } RETURN (a) $$) AS (result agtype); - result --------------------------------------------------------------------------------------------------- - {"id": 844424930131970, "label": "person", "properties": {"age": 28, "name": "Takeshi"}}::vertex + result +---------------------------------------------------------------------------------------------------- + {"id": 844424930131970, "label": ["person"], "properties": {"age": 28, "name": "Takeshi"}}::vertex (1 row) --query inside, with WHERE @@ -98,9 +97,9 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person) WHERE EXISTS {MATCH (a:person)-[]->(b:pet) WHERE a.name = 'Calvin'} RETURN (a) $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------- - {"id": 844424930131975, "label": "person", "properties": {"age": 6, "name": "Calvin"}}::vertex + result +-------------------------------------------------------------------------------------------------- + {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex (1 row) --union @@ -115,10 +114,10 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person) RETURN c } RETURN (a) $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------- - {"id": 844424930131972, "label": "person", "properties": {"age": 25, "name": "Faye"}}::vertex - {"id": 844424930131975, "label": "person", "properties": {"age": 6, "name": "Calvin"}}::vertex + result +-------------------------------------------------------------------------------------------------- + {"id": 844424930131972, "label": ["person"], "properties": {"age": 25, "name": "Faye"}}::vertex + {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex (2 rows) -- union, mismatched var, should fail @@ -190,19 +189,18 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person) RETURN b } RETURN (a) $$) AS (result agtype); - result ---------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "person", "properties": {"age": 32, "name": "Briggite"}}::vertex - {"id": 844424930131970, "label": "person", "properties": {"age": 28, "name": "Takeshi"}}::vertex - {"id": 844424930131971, "label": "person", "properties": {"age": 45, "name": "Chan"}}::vertex - {"id": 844424930131972, "label": "person", "properties": {"age": 25, "name": "Faye"}}::vertex - {"id": 844424930131973, "label": "person", "properties": {"age": 34, "name": "Tony"}}::vertex - {"id": 844424930131974, "label": "person", "properties": {"age": 33, "name": "Valerie"}}::vertex - {"id": 844424930131975, "label": "person", "properties": {"age": 6, "name": "Calvin"}}::vertex - {"id": 844424930131976, "label": "person", "properties": {"age": 8, "name": "Lucy"}}::vertex - {"id": 844424930131977, "label": "person", "properties": {"age": 8, "name": "Charlie"}}::vertex - {"id": 844424930131978, "label": "person", "properties": {"age": 29, "name": "Jon"}}::vertex -(10 rows) + result +----------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["person"], "properties": {"age": 32, "name": "Briggite"}}::vertex + {"id": 844424930131970, "label": ["person"], "properties": {"age": 28, "name": "Takeshi"}}::vertex + {"id": 844424930131971, "label": ["person"], "properties": {"age": 45, "name": "Chan"}}::vertex + {"id": 844424930131972, "label": ["person"], "properties": {"age": 25, "name": "Faye"}}::vertex + {"id": 844424930131973, "label": ["person"], "properties": {"age": 34, "name": "Tony"}}::vertex + {"id": 844424930131974, "label": ["person"], "properties": {"age": 33, "name": "Valerie"}}::vertex + {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex + {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex +(9 rows) --nesting same var multiple layers SELECT * FROM cypher('subquery', $$ MATCH (a:person) @@ -214,9 +212,9 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person) } } RETURN (a) $$) AS (result agtype); - result --------------------------------------------------------------------------------------------------- - {"id": 844424930131970, "label": "person", "properties": {"age": 28, "name": "Takeshi"}}::vertex + result +---------------------------------------------------------------------------------------------------- + {"id": 844424930131970, "label": ["person"], "properties": {"age": 28, "name": "Takeshi"}}::vertex (1 row) --nesting, accessing var in outer scope @@ -229,23 +227,22 @@ SELECT * FROM cypher('subquery', $$ MATCH (a) } } RETURN (a) $$) AS (result agtype); - result ---------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "person", "properties": {"age": 32, "name": "Briggite"}}::vertex - {"id": 844424930131970, "label": "person", "properties": {"age": 28, "name": "Takeshi"}}::vertex - {"id": 844424930131971, "label": "person", "properties": {"age": 45, "name": "Chan"}}::vertex - {"id": 844424930131972, "label": "person", "properties": {"age": 25, "name": "Faye"}}::vertex - {"id": 844424930131973, "label": "person", "properties": {"age": 34, "name": "Tony"}}::vertex - {"id": 844424930131974, "label": "person", "properties": {"age": 33, "name": "Valerie"}}::vertex - {"id": 844424930131975, "label": "person", "properties": {"age": 6, "name": "Calvin"}}::vertex - {"id": 844424930131976, "label": "person", "properties": {"age": 8, "name": "Lucy"}}::vertex - {"id": 844424930131977, "label": "person", "properties": {"age": 8, "name": "Charlie"}}::vertex - {"id": 844424930131978, "label": "person", "properties": {"age": 29, "name": "Jon"}}::vertex - {"id": 1688849860263937, "label": "pet", "properties": {"name": "Hobbes"}}::vertex - {"id": 1688849860263938, "label": "pet", "properties": {"name": "Snoopy"}}::vertex - {"id": 1688849860263939, "label": "pet", "properties": {"name": "Odie"}}::vertex - {"id": 1688849860263940, "label": "pet", "properties": {"name": "Garfield"}}::vertex -(14 rows) + result +----------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["person"], "properties": {"age": 32, "name": "Briggite"}}::vertex + {"id": 844424930131970, "label": ["person"], "properties": {"age": 28, "name": "Takeshi"}}::vertex + {"id": 844424930131971, "label": ["person"], "properties": {"age": 45, "name": "Chan"}}::vertex + {"id": 844424930131972, "label": ["person"], "properties": {"age": 25, "name": "Faye"}}::vertex + {"id": 844424930131973, "label": ["person"], "properties": {"age": 34, "name": "Tony"}}::vertex + {"id": 844424930131974, "label": ["person"], "properties": {"age": 33, "name": "Valerie"}}::vertex + {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex + {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex + {"id": 1688849860263937, "label": ["pet"], "properties": {"name": "Hobbes"}}::vertex + {"id": 1688849860263938, "label": ["pet"], "properties": {"name": "Snoopy"}}::vertex + {"id": 1688849860263939, "label": ["pet"], "properties": {"name": "Odie"}}::vertex + {"id": 1688849860263940, "label": ["pet"], "properties": {"name": "Garfield"}}::vertex +(13 rows) --nesting, accessing indirection in outer scope SELECT * FROM cypher('subquery', $$ MATCH (a:person) @@ -258,19 +255,18 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person) } } RETURN (a) $$) AS (result agtype); - result ---------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "person", "properties": {"age": 32, "name": "Briggite"}}::vertex - {"id": 844424930131970, "label": "person", "properties": {"age": 28, "name": "Takeshi"}}::vertex - {"id": 844424930131971, "label": "person", "properties": {"age": 45, "name": "Chan"}}::vertex - {"id": 844424930131972, "label": "person", "properties": {"age": 25, "name": "Faye"}}::vertex - {"id": 844424930131973, "label": "person", "properties": {"age": 34, "name": "Tony"}}::vertex - {"id": 844424930131974, "label": "person", "properties": {"age": 33, "name": "Valerie"}}::vertex - {"id": 844424930131975, "label": "person", "properties": {"age": 6, "name": "Calvin"}}::vertex - {"id": 844424930131976, "label": "person", "properties": {"age": 8, "name": "Lucy"}}::vertex - {"id": 844424930131977, "label": "person", "properties": {"age": 8, "name": "Charlie"}}::vertex - {"id": 844424930131978, "label": "person", "properties": {"age": 29, "name": "Jon"}}::vertex -(10 rows) + result +----------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["person"], "properties": {"age": 32, "name": "Briggite"}}::vertex + {"id": 844424930131970, "label": ["person"], "properties": {"age": 28, "name": "Takeshi"}}::vertex + {"id": 844424930131971, "label": ["person"], "properties": {"age": 45, "name": "Chan"}}::vertex + {"id": 844424930131972, "label": ["person"], "properties": {"age": 25, "name": "Faye"}}::vertex + {"id": 844424930131973, "label": ["person"], "properties": {"age": 34, "name": "Tony"}}::vertex + {"id": 844424930131974, "label": ["person"], "properties": {"age": 33, "name": "Valerie"}}::vertex + {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex + {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex +(9 rows) --nesting, accessing var 2+ levels up SELECT * FROM cypher('subquery', $$ MATCH (a:person) @@ -283,9 +279,9 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person) } } RETURN (a) $$) AS (result agtype); - result --------------------------------------------------------------------------------------------------- - {"id": 844424930131970, "label": "person", "properties": {"age": 28, "name": "Takeshi"}}::vertex + result +---------------------------------------------------------------------------------------------------- + {"id": 844424930131970, "label": ["person"], "properties": {"age": 28, "name": "Takeshi"}}::vertex (1 row) --nesting, accessing indirection 2+ levels up @@ -299,37 +295,35 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person) } } RETURN (a) $$) AS (result agtype); - result ---------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "person", "properties": {"age": 32, "name": "Briggite"}}::vertex - {"id": 844424930131970, "label": "person", "properties": {"age": 28, "name": "Takeshi"}}::vertex - {"id": 844424930131971, "label": "person", "properties": {"age": 45, "name": "Chan"}}::vertex - {"id": 844424930131972, "label": "person", "properties": {"age": 25, "name": "Faye"}}::vertex - {"id": 844424930131973, "label": "person", "properties": {"age": 34, "name": "Tony"}}::vertex - {"id": 844424930131974, "label": "person", "properties": {"age": 33, "name": "Valerie"}}::vertex - {"id": 844424930131975, "label": "person", "properties": {"age": 6, "name": "Calvin"}}::vertex - {"id": 844424930131976, "label": "person", "properties": {"age": 8, "name": "Lucy"}}::vertex - {"id": 844424930131977, "label": "person", "properties": {"age": 8, "name": "Charlie"}}::vertex - {"id": 844424930131978, "label": "person", "properties": {"age": 29, "name": "Jon"}}::vertex -(10 rows) + result +----------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["person"], "properties": {"age": 32, "name": "Briggite"}}::vertex + {"id": 844424930131970, "label": ["person"], "properties": {"age": 28, "name": "Takeshi"}}::vertex + {"id": 844424930131971, "label": ["person"], "properties": {"age": 45, "name": "Chan"}}::vertex + {"id": 844424930131972, "label": ["person"], "properties": {"age": 25, "name": "Faye"}}::vertex + {"id": 844424930131973, "label": ["person"], "properties": {"age": 34, "name": "Tony"}}::vertex + {"id": 844424930131974, "label": ["person"], "properties": {"age": 33, "name": "Valerie"}}::vertex + {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex + {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex +(9 rows) --EXISTS outside of WHERE SELECT * FROM cypher('subquery', $$ MATCH (a:person) RETURN a, EXISTS {(a:person)-[]->(:pet)} $$) AS (a agtype, exists agtype); - a | exists ----------------------------------------------------------------------------------------------------+-------- - {"id": 844424930131969, "label": "person", "properties": {"age": 32, "name": "Briggite"}}::vertex | false - {"id": 844424930131970, "label": "person", "properties": {"age": 28, "name": "Takeshi"}}::vertex | false - {"id": 844424930131971, "label": "person", "properties": {"age": 45, "name": "Chan"}}::vertex | false - {"id": 844424930131972, "label": "person", "properties": {"age": 25, "name": "Faye"}}::vertex | false - {"id": 844424930131973, "label": "person", "properties": {"age": 34, "name": "Tony"}}::vertex | false - {"id": 844424930131974, "label": "person", "properties": {"age": 33, "name": "Valerie"}}::vertex | false - {"id": 844424930131975, "label": "person", "properties": {"age": 6, "name": "Calvin"}}::vertex | true - {"id": 844424930131976, "label": "person", "properties": {"age": 8, "name": "Lucy"}}::vertex | false - {"id": 844424930131977, "label": "person", "properties": {"age": 8, "name": "Charlie"}}::vertex | true - {"id": 844424930131978, "label": "person", "properties": {"age": 29, "name": "Jon"}}::vertex | true -(10 rows) + a | exists +-----------------------------------------------------------------------------------------------------+-------- + {"id": 844424930131969, "label": ["person"], "properties": {"age": 32, "name": "Briggite"}}::vertex | false + {"id": 844424930131970, "label": ["person"], "properties": {"age": 28, "name": "Takeshi"}}::vertex | false + {"id": 844424930131971, "label": ["person"], "properties": {"age": 45, "name": "Chan"}}::vertex | false + {"id": 844424930131972, "label": ["person"], "properties": {"age": 25, "name": "Faye"}}::vertex | false + {"id": 844424930131973, "label": ["person"], "properties": {"age": 34, "name": "Tony"}}::vertex | false + {"id": 844424930131974, "label": ["person"], "properties": {"age": 33, "name": "Valerie"}}::vertex | false + {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex | true + {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex | true + {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex | true +(9 rows) --Var doesnt exist in outside scope, should fail SELECT * FROM cypher('subquery', $$ RETURN 1, @@ -392,19 +386,18 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person) RETURN a $$) AS (result agtype); result ------------------------------------------------------------------------------------------------- - {"id": 844424930131972, "label": "person", "properties": {"age": 25, "name": "Faye"}}::vertex - {"id": 844424930131973, "label": "person", "properties": {"age": 34, "name": "Tony"}}::vertex - {"id": 844424930131977, "label": "person", "properties": {"age": 8, "name": "Charlie"}}::vertex - {"id": 844424930131978, "label": "person", "properties": {"age": 29, "name": "Jon"}}::vertex -(4 rows) + {"id": 844424930131972, "label": ["person"], "properties": {"age": 25, "name": "Faye"}}::vertex + {"id": 844424930131973, "label": ["person"], "properties": {"age": 34, "name": "Tony"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex +(3 rows) --match where person has more than one pet SELECT * FROM cypher('subquery', $$ MATCH (a:person) WHERE COUNT{MATCH (a:person)-[]-(:pet)} > 1 RETURN a $$) AS (result agtype); - result ----------------------------------------------------------------------------------------------- - {"id": 844424930131978, "label": "person", "properties": {"age": 29, "name": "Jon"}}::vertex + result +------------------------------------------------------------------------------------------------ + {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex (1 row) --match on labels @@ -413,25 +406,24 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person) RETURN a $$) AS (result agtype); result ------------------------------------------------------------------------------------------------- - {"id": 844424930131972, "label": "person", "properties": {"age": 25, "name": "Faye"}}::vertex - {"id": 844424930131977, "label": "person", "properties": {"age": 8, "name": "Charlie"}}::vertex - {"id": 844424930131978, "label": "person", "properties": {"age": 29, "name": "Jon"}}::vertex -(3 rows) + {"id": 844424930131972, "label": ["person"], "properties": {"age": 25, "name": "Faye"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex +(2 rows) SELECT * FROM cypher('subquery', $$ MATCH (a:person) WHERE COUNT{MATCH (a:person)-[:knows]-(:pet)} > 1 RETURN a $$) AS (result agtype); - result ----------------------------------------------------------------------------------------------- - {"id": 844424930131978, "label": "person", "properties": {"age": 29, "name": "Jon"}}::vertex + result +------------------------------------------------------------------------------------------------ + {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex (1 row) SELECT * FROM cypher('subquery', $$ MATCH (a:person) WHERE COUNT{MATCH (a:person)-[:knows]-(:person)} > 1 RETURN a $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------ - {"id": 844424930131972, "label": "person", "properties": {"age": 25, "name": "Faye"}}::vertex + result +------------------------------------------------------------------------------------------------- + {"id": 844424930131972, "label": ["person"], "properties": {"age": 25, "name": "Faye"}}::vertex (1 row) --solo match in return @@ -587,14 +579,14 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person) WHERE EXISTS {(a:person)-[]->(:pet)} OR EXISTS {(a:person)-[]->(:person)} RETURN (a) $$) AS (result agtype); - result ---------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "person", "properties": {"age": 32, "name": "Briggite"}}::vertex - {"id": 844424930131972, "label": "person", "properties": {"age": 25, "name": "Faye"}}::vertex - {"id": 844424930131973, "label": "person", "properties": {"age": 34, "name": "Tony"}}::vertex - {"id": 844424930131975, "label": "person", "properties": {"age": 6, "name": "Calvin"}}::vertex - {"id": 844424930131977, "label": "person", "properties": {"age": 8, "name": "Charlie"}}::vertex - {"id": 844424930131978, "label": "person", "properties": {"age": 29, "name": "Jon"}}::vertex + result +----------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["person"], "properties": {"age": 32, "name": "Briggite"}}::vertex + {"id": 844424930131972, "label": ["person"], "properties": {"age": 25, "name": "Faye"}}::vertex + {"id": 844424930131973, "label": ["person"], "properties": {"age": 34, "name": "Tony"}}::vertex + {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex + {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex (6 rows) -- Nested BoolExpr @@ -640,11 +632,11 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person)-[]->(b) WHEN "Tony" THEN EXISTS { MATCH (a)-[:loved]->(b) } ELSE False END = true RETURN a $$) AS (result agtype); - result ------------------------------------------------------------------------------------------------ - {"id": 844424930131973, "label": "person", "properties": {"age": 34, "name": "Tony"}}::vertex - {"id": 844424930131978, "label": "person", "properties": {"age": 29, "name": "Jon"}}::vertex - {"id": 844424930131978, "label": "person", "properties": {"age": 29, "name": "Jon"}}::vertex + result +------------------------------------------------------------------------------------------------- + {"id": 844424930131973, "label": ["person"], "properties": {"age": 34, "name": "Tony"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex (3 rows) -- nested in another exists @@ -666,12 +658,11 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person)-[]->(b) WHERE a.name = "Calvin" OR a.name = "Charlie"})}) RETURN a $$) AS (result agtype); - result -------------------------------------------------------------------------------------------------- - {"id": 844424930131975, "label": "person", "properties": {"age": 6, "name": "Calvin"}}::vertex - {"id": 844424930131977, "label": "person", "properties": {"age": 8, "name": "Charlie"}}::vertex - {"id": 844424930131977, "label": "person", "properties": {"age": 8, "name": "Charlie"}}::vertex -(3 rows) + result +--------------------------------------------------------------------------------------------------- + {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex + {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex +(2 rows) --coalesce, nested in return SELECT * FROM cypher('subquery', $$ MATCH (a:person)-[]->(b) @@ -689,12 +680,12 @@ SELECT * FROM cypher('subquery', $$MATCH (a) WHERE {cond : true} = { cond : EXISTS {(a) WHERE {age: a.age } = {age: a.age > 22}}} RETURN a $$ ) AS (a agtype); - a --------------------------------------------------------------------------------------- - {"id": 1688849860263937, "label": "pet", "properties": {"name": "Hobbes"}}::vertex - {"id": 1688849860263938, "label": "pet", "properties": {"name": "Snoopy"}}::vertex - {"id": 1688849860263939, "label": "pet", "properties": {"name": "Odie"}}::vertex - {"id": 1688849860263940, "label": "pet", "properties": {"name": "Garfield"}}::vertex + a +---------------------------------------------------------------------------------------- + {"id": 1688849860263937, "label": ["pet"], "properties": {"name": "Hobbes"}}::vertex + {"id": 1688849860263938, "label": ["pet"], "properties": {"name": "Snoopy"}}::vertex + {"id": 1688849860263939, "label": ["pet"], "properties": {"name": "Odie"}}::vertex + {"id": 1688849860263940, "label": ["pet"], "properties": {"name": "Garfield"}}::vertex (4 rows) --nested exists in return @@ -702,23 +693,22 @@ SELECT * FROM cypher('subquery', $$MATCH (a) RETURN a, {cond : true} = { cond : EXISTS {(a) WHERE {age: a.age } = {age: a.age > 22}}} $$ ) AS (a agtype, cond agtype); - a | cond ----------------------------------------------------------------------------------------------------+------- - {"id": 844424930131969, "label": "person", "properties": {"age": 32, "name": "Briggite"}}::vertex | false - {"id": 844424930131970, "label": "person", "properties": {"age": 28, "name": "Takeshi"}}::vertex | false - {"id": 844424930131971, "label": "person", "properties": {"age": 45, "name": "Chan"}}::vertex | false - {"id": 844424930131972, "label": "person", "properties": {"age": 25, "name": "Faye"}}::vertex | false - {"id": 844424930131973, "label": "person", "properties": {"age": 34, "name": "Tony"}}::vertex | false - {"id": 844424930131974, "label": "person", "properties": {"age": 33, "name": "Valerie"}}::vertex | false - {"id": 844424930131975, "label": "person", "properties": {"age": 6, "name": "Calvin"}}::vertex | false - {"id": 844424930131976, "label": "person", "properties": {"age": 8, "name": "Lucy"}}::vertex | false - {"id": 844424930131977, "label": "person", "properties": {"age": 8, "name": "Charlie"}}::vertex | false - {"id": 844424930131978, "label": "person", "properties": {"age": 29, "name": "Jon"}}::vertex | false - {"id": 1688849860263937, "label": "pet", "properties": {"name": "Hobbes"}}::vertex | true - {"id": 1688849860263938, "label": "pet", "properties": {"name": "Snoopy"}}::vertex | true - {"id": 1688849860263939, "label": "pet", "properties": {"name": "Odie"}}::vertex | true - {"id": 1688849860263940, "label": "pet", "properties": {"name": "Garfield"}}::vertex | true -(14 rows) + a | cond +-----------------------------------------------------------------------------------------------------+------- + {"id": 844424930131969, "label": ["person"], "properties": {"age": 32, "name": "Briggite"}}::vertex | false + {"id": 844424930131970, "label": ["person"], "properties": {"age": 28, "name": "Takeshi"}}::vertex | false + {"id": 844424930131971, "label": ["person"], "properties": {"age": 45, "name": "Chan"}}::vertex | false + {"id": 844424930131972, "label": ["person"], "properties": {"age": 25, "name": "Faye"}}::vertex | false + {"id": 844424930131973, "label": ["person"], "properties": {"age": 34, "name": "Tony"}}::vertex | false + {"id": 844424930131974, "label": ["person"], "properties": {"age": 33, "name": "Valerie"}}::vertex | false + {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex | false + {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex | false + {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex | false + {"id": 1688849860263937, "label": ["pet"], "properties": {"name": "Hobbes"}}::vertex | true + {"id": 1688849860263938, "label": ["pet"], "properties": {"name": "Snoopy"}}::vertex | true + {"id": 1688849860263939, "label": ["pet"], "properties": {"name": "Odie"}}::vertex | true + {"id": 1688849860263940, "label": ["pet"], "properties": {"name": "Garfield"}}::vertex | true +(13 rows) -- map projection --where @@ -726,9 +716,9 @@ SELECT * FROM cypher('subquery', $$MATCH (a) WITH { a : EXISTS {(a) WHERE a.name = 'Chan'}} as matchmap, a WHERE true = matchmap.a RETURN a $$ ) AS (a agtype); - a ------------------------------------------------------------------------------------------------ - {"id": 844424930131971, "label": "person", "properties": {"age": 45, "name": "Chan"}}::vertex + a +------------------------------------------------------------------------------------------------- + {"id": 844424930131971, "label": ["person"], "properties": {"age": 45, "name": "Chan"}}::vertex (1 row) --return @@ -757,28 +747,28 @@ SELECT * FROM cypher('subquery', $$MATCH (a) --list SELECT * FROM cypher('subquery', $$ MATCH (a:pet) WHERE true IN [EXISTS { MATCH (a) WHERE a.name = 'Hobbes' RETURN a}] RETURN a $$) AS (result agtype); - result ------------------------------------------------------------------------------------- - {"id": 1688849860263937, "label": "pet", "properties": {"name": "Hobbes"}}::vertex + result +-------------------------------------------------------------------------------------- + {"id": 1688849860263937, "label": ["pet"], "properties": {"name": "Hobbes"}}::vertex (1 row) --nested in list SELECT * FROM cypher('subquery', $$ MATCH (a:pet) WHERE [true] IN [[EXISTS { MATCH (a) WHERE a.name = 'Hobbes' RETURN a}]] RETURN a $$) AS (result agtype); - result ------------------------------------------------------------------------------------- - {"id": 1688849860263937, "label": "pet", "properties": {"name": "Hobbes"}}::vertex + result +-------------------------------------------------------------------------------------- + {"id": 1688849860263937, "label": ["pet"], "properties": {"name": "Hobbes"}}::vertex (1 row) --exist nested in list nested in list SELECT * FROM cypher('subquery', $$ MATCH (a:pet) WHERE [true] IN [[EXISTS { MATCH (a) WHERE EXISTS {MATCH (a)-[]-()} RETURN a}]] RETURN a $$) AS (result agtype); - result --------------------------------------------------------------------------------------- - {"id": 1688849860263937, "label": "pet", "properties": {"name": "Hobbes"}}::vertex - {"id": 1688849860263938, "label": "pet", "properties": {"name": "Snoopy"}}::vertex - {"id": 1688849860263939, "label": "pet", "properties": {"name": "Odie"}}::vertex - {"id": 1688849860263940, "label": "pet", "properties": {"name": "Garfield"}}::vertex + result +---------------------------------------------------------------------------------------- + {"id": 1688849860263937, "label": ["pet"], "properties": {"name": "Hobbes"}}::vertex + {"id": 1688849860263938, "label": ["pet"], "properties": {"name": "Snoopy"}}::vertex + {"id": 1688849860263939, "label": ["pet"], "properties": {"name": "Odie"}}::vertex + {"id": 1688849860263940, "label": ["pet"], "properties": {"name": "Garfield"}}::vertex (4 rows) -- diff --git a/regress/expected/list_comprehension.out b/regress/expected/list_comprehension.out index 0260fa5ef..50fd65542 100644 --- a/regress/expected/list_comprehension.out +++ b/regress/expected/list_comprehension.out @@ -28,19 +28,19 @@ NOTICE: graph "list_comprehension" has been created SELECT * from cypher('list_comprehension', $$ CREATE (u {list: [0, 2, 4, 6, 8, 10, 12]}) RETURN u $$) AS (result agtype); result ----------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex + {"id": 281474976710657, "label": [], "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex (1 row) SELECT * from cypher('list_comprehension', $$ CREATE (u {list: [1, 3, 5, 7, 9, 11, 13]}) RETURN u $$) AS (result agtype); result ----------------------------------------------------------------------------------------------- - {"id": 281474976710658, "label": "", "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex + {"id": 281474976710658, "label": [], "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex (1 row) SELECT * from cypher('list_comprehension', $$ CREATE (u {list: []}) RETURN u $$) AS (result agtype); result -------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"list": []}}::vertex + {"id": 281474976710659, "label": [], "properties": {"list": []}}::vertex (1 row) SELECT * FROM cypher('list_comprehension', $$ RETURN [u IN range(1, 30, 2)] $$) AS (result agtype); @@ -118,9 +118,9 @@ SELECT * FROM cypher('list_comprehension', $$ RETURN [u IN range(1, 30, 2) | u^2 SELECT * FROM cypher('list_comprehension', $$ MATCH (u) RETURN (u) $$) AS (result agtype); result ----------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex - {"id": 281474976710658, "label": "", "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex - {"id": 281474976710659, "label": "", "properties": {"list": []}}::vertex + {"id": 281474976710657, "label": [], "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex + {"id": 281474976710658, "label": [], "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex + {"id": 281474976710659, "label": [], "properties": {"list": []}}::vertex (3 rows) SELECT * FROM cypher('list_comprehension', $$ MATCH () RETURN [i IN range(0, 20, 2) WHERE i % 3 = 0 ] $$) AS (result agtype); @@ -271,13 +271,13 @@ SELECT * FROM cypher('list_comprehension', $$ RETURN [i IN [i IN [1,2,3] WHERE i SELECT * FROM cypher('list_comprehension', $$ MATCH (u) WHERE u.list=[i IN range(0,12,2)] RETURN u $$) AS (result agtype); result ----------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex + {"id": 281474976710657, "label": [], "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex (1 row) SELECT * FROM cypher('list_comprehension', $$ MATCH (u) WHERE u.list=[i IN range(1,13,2)] RETURN u $$) AS (result agtype); result ----------------------------------------------------------------------------------------------- - {"id": 281474976710658, "label": "", "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex + {"id": 281474976710658, "label": [], "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex (1 row) SELECT * FROM cypher('list_comprehension', $$ MATCH (u) WHERE u.list=[i IN range(0,12,2) WHERE i>4] RETURN u $$) AS (result agtype); @@ -293,33 +293,33 @@ SELECT * FROM cypher('list_comprehension', $$ MATCH (u) WHERE u.list=[i IN range SELECT * FROM cypher('list_comprehension', $$ MATCH (u) WHERE u.list@>[i IN range(0,6,2)] RETURN u $$) AS (result agtype); result ----------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex + {"id": 281474976710657, "label": [], "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex (1 row) SELECT * FROM cypher('list_comprehension', $$ MATCH (u) MATCH (v) WHERE v.list=[i IN u.list] RETURN v $$) AS (result agtype); result ----------------------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"list": []}}::vertex - {"id": 281474976710657, "label": "", "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex - {"id": 281474976710658, "label": "", "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex + {"id": 281474976710659, "label": [], "properties": {"list": []}}::vertex + {"id": 281474976710657, "label": [], "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex + {"id": 281474976710658, "label": [], "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex (3 rows) SELECT * FROM cypher('list_comprehension', $$ MATCH (u {list:[i IN range(0,12,2)]}) RETURN u $$) AS (result agtype); result ----------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex + {"id": 281474976710657, "label": [], "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex (1 row) SELECT * FROM cypher('list_comprehension', $$ MATCH (u {list:[i IN range(1,13,2)]}) RETURN u $$) AS (result agtype); result ----------------------------------------------------------------------------------------------- - {"id": 281474976710658, "label": "", "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex + {"id": 281474976710658, "label": [], "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex (1 row) SELECT * FROM cypher('list_comprehension', $$ MATCH (u {list:[i IN range(0,12,2) WHERE i>4]}) RETURN u $$) AS (result agtype); result ----------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex + {"id": 281474976710657, "label": [], "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex (1 row) SELECT * FROM cypher('list_comprehension', $$ MATCH (u {list:[i IN range(1,13,2) WHERE i>4 | i^1]}) RETURN u $$) AS (result agtype); @@ -330,67 +330,67 @@ SELECT * FROM cypher('list_comprehension', $$ MATCH (u {list:[i IN range(1,13,2) SELECT * FROM cypher('list_comprehension', $$ MATCH (u) MATCH (v {list:[i IN u.list]}) RETURN v $$) AS (result agtype); result ----------------------------------------------------------------------------------------------- - {"id": 281474976710658, "label": "", "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex - {"id": 281474976710657, "label": "", "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex - {"id": 281474976710659, "label": "", "properties": {"list": []}}::vertex - {"id": 281474976710657, "label": "", "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex - {"id": 281474976710658, "label": "", "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex + {"id": 281474976710658, "label": [], "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex + {"id": 281474976710657, "label": [], "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex + {"id": 281474976710659, "label": [], "properties": {"list": []}}::vertex + {"id": 281474976710657, "label": [], "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex + {"id": 281474976710658, "label": [], "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex (5 rows) SELECT * FROM cypher('list_comprehension', $$ CREATE (u {list:[i IN range(12,24,2)]}) RETURN u $$) AS (result agtype); result ---------------------------------------------------------------------------------------------------- - {"id": 281474976710660, "label": "", "properties": {"list": [12, 14, 16, 18, 20, 22, 24]}}::vertex + {"id": 281474976710660, "label": [], "properties": {"list": [12, 14, 16, 18, 20, 22, 24]}}::vertex (1 row) SELECT * FROM cypher('list_comprehension', $$ CREATE (u {list:[i IN range(0,12,2) WHERE i>4]}) RETURN u $$) AS (result agtype); result -------------------------------------------------------------------------------------- - {"id": 281474976710661, "label": "", "properties": {"list": [6, 8, 10, 12]}}::vertex + {"id": 281474976710661, "label": [], "properties": {"list": [6, 8, 10, 12]}}::vertex (1 row) SELECT * FROM cypher('list_comprehension', $$ CREATE (u {list:[i IN range(1,13,2) WHERE i>4 | i^2]}) RETURN u $$) AS (result agtype); result -------------------------------------------------------------------------------------------------------- - {"id": 281474976710662, "label": "", "properties": {"list": [25.0, 49.0, 81.0, 121.0, 169.0]}}::vertex + {"id": 281474976710662, "label": [], "properties": {"list": [25.0, 49.0, 81.0, 121.0, 169.0]}}::vertex (1 row) SELECT * FROM cypher('list_comprehension', $$ WITH [u IN [1,2,3]] AS a CREATE (u {list:a}) RETURN u $$) AS (result agtype); result --------------------------------------------------------------------------------- - {"id": 281474976710663, "label": "", "properties": {"list": [1, 2, 3]}}::vertex + {"id": 281474976710663, "label": [], "properties": {"list": [1, 2, 3]}}::vertex (1 row) -- List comprehension in the WITH WHERE clause SELECT * FROM cypher('list_comprehension', $$ MATCH(u) WITH u WHERE u.list = [u IN [0, 2, 4, 6, 8, 10, 12]] RETURN u $$) AS (u agtype); u ----------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex + {"id": 281474976710657, "label": [], "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex (1 row) SELECT * FROM cypher('list_comprehension', $$ MATCH(u) WITH u WHERE u.list = [u IN [0, 2, 4, 6, 8, 10, 12]] OR size(u.list) = 0 RETURN u $$) AS (u agtype); u ----------------------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"list": []}}::vertex - {"id": 281474976710657, "label": "", "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex + {"id": 281474976710659, "label": [], "properties": {"list": []}}::vertex + {"id": 281474976710657, "label": [], "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex (2 rows) SELECT * FROM cypher('list_comprehension', $$ MATCH(u) WITH u WHERE u.list = [u IN [0, 2, 4, 6, 8, 10, 12]] OR size(u.list)::bool RETURN u $$) AS (u agtype); u -------------------------------------------------------------------------------------------------------- - {"id": 281474976710658, "label": "", "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex - {"id": 281474976710661, "label": "", "properties": {"list": [6, 8, 10, 12]}}::vertex - {"id": 281474976710660, "label": "", "properties": {"list": [12, 14, 16, 18, 20, 22, 24]}}::vertex - {"id": 281474976710662, "label": "", "properties": {"list": [25.0, 49.0, 81.0, 121.0, 169.0]}}::vertex - {"id": 281474976710657, "label": "", "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex - {"id": 281474976710663, "label": "", "properties": {"list": [1, 2, 3]}}::vertex + {"id": 281474976710658, "label": [], "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex + {"id": 281474976710661, "label": [], "properties": {"list": [6, 8, 10, 12]}}::vertex + {"id": 281474976710660, "label": [], "properties": {"list": [12, 14, 16, 18, 20, 22, 24]}}::vertex + {"id": 281474976710662, "label": [], "properties": {"list": [25.0, 49.0, 81.0, 121.0, 169.0]}}::vertex + {"id": 281474976710657, "label": [], "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex + {"id": 281474976710663, "label": [], "properties": {"list": [1, 2, 3]}}::vertex (6 rows) SELECT * FROM cypher('list_comprehension', $$ MATCH(u) WITH u WHERE u.list = [u IN [0, 2, 4, 6, 8, 10, 12]] OR NOT size(u.list)::bool RETURN u $$) AS (u agtype); u ----------------------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"list": []}}::vertex - {"id": 281474976710657, "label": "", "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex + {"id": 281474976710659, "label": [], "properties": {"list": []}}::vertex + {"id": 281474976710657, "label": [], "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex (2 rows) SELECT * FROM cypher('list_comprehension', $$ CREATE(u:csm_match {list: ['abc', 'def', 'ghi']}) $$) AS (u agtype); @@ -399,9 +399,9 @@ SELECT * FROM cypher('list_comprehension', $$ CREATE(u:csm_match {list: ['abc', (0 rows) SELECT * FROM cypher('list_comprehension', $$ MATCH(u: csm_match) WITH u WHERE [u IN u.list][0] STARTS WITH "ab" RETURN u $$) AS (u agtype); - u ------------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "csm_match", "properties": {"list": ["abc", "def", "ghi"]}}::vertex + u +-------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["csm_match"], "properties": {"list": ["abc", "def", "ghi"]}}::vertex (1 row) SELECT * FROM cypher('list_comprehension', $$ WITH [1, 2, 3] AS u WHERE u = [u IN [1, 2, 3]] RETURN u $$) AS (u agtype); @@ -447,25 +447,25 @@ LINE 1: ...ist_comprehension', $$ WITH [1, 2, 3] AS u UNWIND collect(u)... SELECT * FROM cypher('list_comprehension', $$ MATCH(u {list: [0, 2, 4, 6, 8, 10, 12]}) SET u.a = [u IN range(0, 5)] RETURN u $$) AS (u agtype); u ------------------------------------------------------------------------------------------------------------------------ - {"id": 281474976710657, "label": "", "properties": {"a": [0, 1, 2, 3, 4, 5], "list": [0, 2, 4, 6, 8, 10, 12]}}::vertex + {"id": 281474976710657, "label": [], "properties": {"a": [0, 1, 2, 3, 4, 5], "list": [0, 2, 4, 6, 8, 10, 12]}}::vertex (1 row) SELECT * FROM cypher('list_comprehension', $$ MATCH(u {list: [0, 2, 4, 6, 8, 10, 12]}) SET u.a = [u IN []] RETURN u $$) AS (u agtype); u -------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"a": [], "list": [0, 2, 4, 6, 8, 10, 12]}}::vertex + {"id": 281474976710657, "label": [], "properties": {"a": [], "list": [0, 2, 4, 6, 8, 10, 12]}}::vertex (1 row) SELECT * FROM cypher('list_comprehension', $$ MATCH(u {list: [0, 2, 4, 6, 8, 10, 12]}) SET u += {b: [u IN range(0, 5)]} RETURN u $$) AS (u agtype); u --------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"a": [], "b": [0, 1, 2, 3, 4, 5], "list": [0, 2, 4, 6, 8, 10, 12]}}::vertex + {"id": 281474976710657, "label": [], "properties": {"a": [], "b": [0, 1, 2, 3, 4, 5], "list": [0, 2, 4, 6, 8, 10, 12]}}::vertex (1 row) SELECT * FROM cypher('list_comprehension', $$ MATCH(u {list: [0, 2, 4, 6, 8, 10, 12]}) WITh u, collect(u.list) AS v SET u += {b: [u IN range(0, 5)]} SET u.c = [u IN v[0]] RETURN u $$) AS (u agtype); u --------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"a": [], "b": [0, 1, 2, 3, 4, 5], "c": [0, 2, 4, 6, 8, 10, 12], "list": [0, 2, 4, 6, 8, 10, 12]}}::vertex + {"id": 281474976710657, "label": [], "properties": {"a": [], "b": [0, 1, 2, 3, 4, 5], "c": [0, 2, 4, 6, 8, 10, 12], "list": [0, 2, 4, 6, 8, 10, 12]}}::vertex (1 row) -- invalid use of aggregation in SET @@ -498,7 +498,7 @@ SELECT * FROM cypher('list_comprehension', $$ WITH [m IN [1,2,3]] AS m RETURN [m SELECT * FROM cypher('list_comprehension', $$ CREATE n=()-[:edge]->() RETURN [n IN nodes(n)] $$) AS (u agtype); u ---------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710664, "label": "", "properties": {}}::vertex, {"id": 281474976710665, "label": "", "properties": {}}::vertex] + [{"id": 281474976710664, "label": [], "properties": {}}::vertex, {"id": 281474976710665, "label": [], "properties": {}}::vertex] (1 row) -- Multiple list comprehensions in RETURN and WITH clause diff --git a/src/backend/parser/cypher_clause.c b/src/backend/parser/cypher_clause.c index a2073bb19..8b75f58b3 100644 --- a/src/backend/parser/cypher_clause.c +++ b/src/backend/parser/cypher_clause.c @@ -54,6 +54,7 @@ #include "utils/ag_cache.h" #include "utils/ag_func.h" #include "utils/ag_guc.h" +#include "utils/lsyscache.h" /* * Variable string names for makeTargetEntry. As they are going to be variable diff --git a/src/backend/parser/cypher_gram.y b/src/backend/parser/cypher_gram.y index 92f170a07..e4f15f6e9 100644 --- a/src/backend/parser/cypher_gram.y +++ b/src/backend/parser/cypher_gram.y @@ -1393,16 +1393,13 @@ path_node: n->name = $2; n->parsed_name = $2; n->label_expr = (cypher_label_expr *) $3; - n->label_expr->kind = LABEL_KIND_VERTEX; - n->label = NULL; // TODO: to be deprecated - n->parsed_label = NULL; // TODO; to be deprecated n->use_equals = false; n->props = $4; n->location = @2; $$ = (Node *)n; } - | '(' var_name_opt label_opt '='properties_opt ')' + | '(' var_name_opt label_expr '='properties_opt ')' { cypher_node *n; @@ -1410,9 +1407,6 @@ path_node: n->name = $2; n->parsed_name = $2; n->label_expr = (cypher_label_expr *) $3; - n->label_expr->kind = LABEL_KIND_VERTEX; - n->label = NULL; // TODO: to be deprecated - n->parsed_label = NULL; // TODO; to be deprecated n->use_equals = true; n->props = $5; n->location = @2; @@ -1474,9 +1468,6 @@ path_relationship_body: n->name = $2; n->parsed_name = $2; n->label_expr = (cypher_label_expr *) $3; - n->label_expr->kind = LABEL_KIND_EDGE; - n->label = NULL; // TODO: to be deprecated - n->parsed_label = NULL; // TODO; to be deprecated n->varlen = $4; n->use_equals = true; n->props = $6; diff --git a/src/backend/parser/cypher_label_expr.c b/src/backend/parser/cypher_label_expr.c index 716eb23a2..9a0fa7bbe 100644 --- a/src/backend/parser/cypher_label_expr.c +++ b/src/backend/parser/cypher_label_expr.c @@ -13,6 +13,7 @@ #include "parser/cypher_label_expr.h" #include "parser/cypher_transform_entity.h" #include "utils/ag_cache.h" +#include "utils/array.h" static void append_to_allrelations(Relation ag_label, char *label_name, char *intr_relname, Oid graphoid); diff --git a/src/backend/utils/adt/agtype.c b/src/backend/utils/adt/agtype.c index de1bdb7ea..0e131c0a9 100644 --- a/src/backend/utils/adt/agtype.c +++ b/src/backend/utils/adt/agtype.c @@ -2371,7 +2371,7 @@ Datum _agtype_build_vertex_cstringlabel(PG_FUNCTION_ARGS) if (fcinfo->args[2].isnull) { - agtype_build_state *bstate = init_agtype_build_state(0, AGT_FOBJECT); + bstate = init_agtype_build_state(0, AGT_FOBJECT); properties = build_agtype(bstate); pfree_agtype_build_state(bstate); } diff --git a/src/backend/utils/cache/ag_cache.c b/src/backend/utils/cache/ag_cache.c index ff3f3f0d5..87d2dd2ba 100644 --- a/src/backend/utils/cache/ag_cache.c +++ b/src/backend/utils/cache/ag_cache.c @@ -1237,7 +1237,7 @@ List *search_label_allrelations_cache(Oid relation) label_allrelations_cache_entry *entry; bool found; - AssertArg(relation); + Assert(relation); initialize_caches(); diff --git a/src/include/catalog/ag_label.h b/src/include/catalog/ag_label.h index 2f8ad2f03..9db86eefe 100644 --- a/src/include/catalog/ag_label.h +++ b/src/include/catalog/ag_label.h @@ -21,6 +21,8 @@ #define AG_AG_LABEL_H #include "nodes/execnodes.h" +#include "utils/graphid.h" +#include "catalog/ag_catalog.h" #define Anum_ag_label_vertex_table_id 1 #define Anum_ag_label_vertex_table_properties 2 From c025fdf598c6ebde6e0061f27151e2d42e136de6 Mon Sep 17 00:00:00 2001 From: Rafsun Masud Date: Wed, 24 Apr 2024 12:45:39 -0700 Subject: [PATCH 11/13] Reapply clean up #include files PRs Following PRs are reapplied: 1465, 1509, 1514, and 1518. --- src/backend/catalog/ag_label.c | 1 - src/backend/executor/cypher_create.c | 3 --- src/backend/executor/cypher_merge.c | 3 --- src/backend/executor/cypher_set.c | 3 --- 4 files changed, 10 deletions(-) diff --git a/src/backend/catalog/ag_label.c b/src/backend/catalog/ag_label.c index 2f6876b9d..14f93dbad 100644 --- a/src/backend/catalog/ag_label.c +++ b/src/backend/catalog/ag_label.c @@ -30,7 +30,6 @@ #include "commands/label_commands.h" #include "executor/cypher_utils.h" #include "utils/ag_cache.h" -#include "utils/graphid.h" #include "utils/agtype_raw.h" static label_cache_data *get_entity_lcd(graphid entity_id, Oid graph_oid); diff --git a/src/backend/executor/cypher_create.c b/src/backend/executor/cypher_create.c index 1c57e5b12..a2aef67ec 100644 --- a/src/backend/executor/cypher_create.c +++ b/src/backend/executor/cypher_create.c @@ -22,9 +22,6 @@ #include "catalog/ag_label.h" #include "executor/cypher_executor.h" #include "executor/cypher_utils.h" -#include "nodes/cypher_nodes.h" -#include "utils/agtype.h" -#include "utils/graphid.h" #include "parser/cypher_label_expr.h" static void begin_cypher_create(CustomScanState *node, EState *estate, diff --git a/src/backend/executor/cypher_merge.c b/src/backend/executor/cypher_merge.c index 706f1a0d6..025f21938 100644 --- a/src/backend/executor/cypher_merge.c +++ b/src/backend/executor/cypher_merge.c @@ -23,9 +23,6 @@ #include "executor/cypher_executor.h" #include "executor/cypher_utils.h" #include "utils/datum.h" -#include "nodes/cypher_nodes.h" -#include "utils/agtype.h" -#include "utils/graphid.h" #include "parser/cypher_label_expr.h" /* diff --git a/src/backend/executor/cypher_set.c b/src/backend/executor/cypher_set.c index 819cbcc08..76838f201 100644 --- a/src/backend/executor/cypher_set.c +++ b/src/backend/executor/cypher_set.c @@ -23,9 +23,6 @@ #include "executor/cypher_executor.h" #include "executor/cypher_utils.h" -#include "nodes/cypher_nodes.h" -#include "utils/agtype.h" -#include "utils/graphid.h" #include "utils/ag_cache.h" #include "catalog/ag_label.h" From 23ce51147e6f4c256ceead00027cf7f2f92d983e Mon Sep 17 00:00:00 2001 From: Rafsun Masud Date: Mon, 26 Aug 2024 14:02:21 -0700 Subject: [PATCH 12/13] Update after rebase * Regression tests * Comments * Minor overlook during rebasing --- regress/expected/age_load.out | 6 +- regress/expected/cypher.out | 30 +++--- regress/expected/cypher_match.out | 2 +- regress/expected/cypher_merge.out | 12 +-- regress/expected/cypher_subquery.out | 114 +++++++++++--------- regress/expected/expr.out | 136 ++++++++++++------------ regress/expected/list_comprehension.out | 4 +- src/backend/commands/label_commands.c | 3 + src/backend/parser/cypher_label_expr.c | 19 ++++ src/backend/utils/adt/agtype.c | 2 +- src/backend/utils/load/age_load.c | 3 +- 11 files changed, 182 insertions(+), 149 deletions(-) diff --git a/regress/expected/age_load.out b/regress/expected/age_load.out index b638e636b..83134aff2 100644 --- a/regress/expected/age_load.out +++ b/regress/expected/age_load.out @@ -28,9 +28,9 @@ NOTICE: graph "agload_test_graph" has been created (1 row) SELECT * FROM cypher('agload_test_graph', $$CREATE (n:Country {__id__:1}) RETURN n$$) as (n agtype); - n ----------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "Country", "properties": {"__id__": 1}}::vertex + n +------------------------------------------------------------------------------------ + {"id": 844424930131969, "label": ["Country"], "properties": {"__id__": 1}}::vertex (1 row) -- diff --git a/regress/expected/cypher.out b/regress/expected/cypher.out index 31bafc6cf..af54f503c 100644 --- a/regress/expected/cypher.out +++ b/regress/expected/cypher.out @@ -173,16 +173,16 @@ CREATE TABLE my_detailed_paths AS SELECT * FROM my_vertices; u ---------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex - {"id": 281474976710658, "label": "", "properties": {}}::vertex - {"id": 281474976710659, "label": "", "properties": {}}::vertex - {"id": 281474976710660, "label": "", "properties": {}}::vertex - {"id": 281474976710661, "label": "", "properties": {}}::vertex - {"id": 281474976710662, "label": "", "properties": {}}::vertex - {"id": 281474976710663, "label": "", "properties": {}}::vertex - {"id": 281474976710664, "label": "", "properties": {}}::vertex - {"id": 281474976710665, "label": "", "properties": {}}::vertex - {"id": 281474976710666, "label": "", "properties": {}}::vertex + {"id": 281474976710657, "label": [], "properties": {}}::vertex + {"id": 281474976710658, "label": [], "properties": {}}::vertex + {"id": 281474976710659, "label": [], "properties": {}}::vertex + {"id": 281474976710660, "label": [], "properties": {}}::vertex + {"id": 281474976710661, "label": [], "properties": {}}::vertex + {"id": 281474976710662, "label": [], "properties": {}}::vertex + {"id": 281474976710663, "label": [], "properties": {}}::vertex + {"id": 281474976710664, "label": [], "properties": {}}::vertex + {"id": 281474976710665, "label": [], "properties": {}}::vertex + {"id": 281474976710666, "label": [], "properties": {}}::vertex (10 rows) SELECT * FROM my_edges; @@ -198,11 +198,11 @@ SELECT * FROM my_edges; SELECT * FROM my_detailed_paths; u | e | v | p ----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}}::vertex | {"id": 844424930131969, "label": "knows", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge | {"id": 281474976710658, "label": "", "properties": {}}::vertex | [{"id": 281474976710657, "label": "", "properties": {}}::vertex, {"id": 844424930131969, "label": "knows", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge, {"id": 281474976710658, "label": "", "properties": {}}::vertex]::path - {"id": 281474976710659, "label": "", "properties": {}}::vertex | {"id": 844424930131970, "label": "knows", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge | {"id": 281474976710660, "label": "", "properties": {}}::vertex | [{"id": 281474976710659, "label": "", "properties": {}}::vertex, {"id": 844424930131970, "label": "knows", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge, {"id": 281474976710660, "label": "", "properties": {}}::vertex]::path - {"id": 281474976710661, "label": "", "properties": {}}::vertex | {"id": 844424930131971, "label": "knows", "end_id": 281474976710662, "start_id": 281474976710661, "properties": {}}::edge | {"id": 281474976710662, "label": "", "properties": {}}::vertex | [{"id": 281474976710661, "label": "", "properties": {}}::vertex, {"id": 844424930131971, "label": "knows", "end_id": 281474976710662, "start_id": 281474976710661, "properties": {}}::edge, {"id": 281474976710662, "label": "", "properties": {}}::vertex]::path - {"id": 281474976710663, "label": "", "properties": {}}::vertex | {"id": 844424930131972, "label": "knows", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {}}::edge | {"id": 281474976710664, "label": "", "properties": {}}::vertex | [{"id": 281474976710663, "label": "", "properties": {}}::vertex, {"id": 844424930131972, "label": "knows", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {}}::edge, {"id": 281474976710664, "label": "", "properties": {}}::vertex]::path - {"id": 281474976710665, "label": "", "properties": {}}::vertex | {"id": 844424930131973, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710665, "properties": {}}::edge | {"id": 281474976710666, "label": "", "properties": {}}::vertex | [{"id": 281474976710665, "label": "", "properties": {}}::vertex, {"id": 844424930131973, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710665, "properties": {}}::edge, {"id": 281474976710666, "label": "", "properties": {}}::vertex]::path + {"id": 281474976710657, "label": [], "properties": {}}::vertex | {"id": 844424930131969, "label": "knows", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge | {"id": 281474976710658, "label": [], "properties": {}}::vertex | [{"id": 281474976710657, "label": [], "properties": {}}::vertex, {"id": 844424930131969, "label": "knows", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}::edge, {"id": 281474976710658, "label": [], "properties": {}}::vertex]::path + {"id": 281474976710659, "label": [], "properties": {}}::vertex | {"id": 844424930131970, "label": "knows", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge | {"id": 281474976710660, "label": [], "properties": {}}::vertex | [{"id": 281474976710659, "label": [], "properties": {}}::vertex, {"id": 844424930131970, "label": "knows", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge, {"id": 281474976710660, "label": [], "properties": {}}::vertex]::path + {"id": 281474976710661, "label": [], "properties": {}}::vertex | {"id": 844424930131971, "label": "knows", "end_id": 281474976710662, "start_id": 281474976710661, "properties": {}}::edge | {"id": 281474976710662, "label": [], "properties": {}}::vertex | [{"id": 281474976710661, "label": [], "properties": {}}::vertex, {"id": 844424930131971, "label": "knows", "end_id": 281474976710662, "start_id": 281474976710661, "properties": {}}::edge, {"id": 281474976710662, "label": [], "properties": {}}::vertex]::path + {"id": 281474976710663, "label": [], "properties": {}}::vertex | {"id": 844424930131972, "label": "knows", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {}}::edge | {"id": 281474976710664, "label": [], "properties": {}}::vertex | [{"id": 281474976710663, "label": [], "properties": {}}::vertex, {"id": 844424930131972, "label": "knows", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {}}::edge, {"id": 281474976710664, "label": [], "properties": {}}::vertex]::path + {"id": 281474976710665, "label": [], "properties": {}}::vertex | {"id": 844424930131973, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710665, "properties": {}}::edge | {"id": 281474976710666, "label": [], "properties": {}}::vertex | [{"id": 281474976710665, "label": [], "properties": {}}::vertex, {"id": 844424930131973, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710665, "properties": {}}::edge, {"id": 281474976710666, "label": [], "properties": {}}::vertex]::path (5 rows) -- cleanup diff --git a/regress/expected/cypher_match.out b/regress/expected/cypher_match.out index 577d2527b..68f0ab271 100644 --- a/regress/expected/cypher_match.out +++ b/regress/expected/cypher_match.out @@ -1556,7 +1556,7 @@ $$) AS (i agtype); SELECT * FROM cypher('cypher_match', $$ MATCH p=(:duplicate)-[]-(:other_v) RETURN DISTINCT p -$$) AS (i agtype); +$$) AS (i agtype) ORDER BY i; i ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ [{"id": 3377699720527873, "label": ["duplicate"], "properties": {}}::vertex, {"id": 3659174697238529, "label": "dup_edge", "end_id": 3940649673949185, "start_id": 3377699720527873, "properties": {"id": 1}}::edge, {"id": 3940649673949185, "label": ["other_v"], "properties": {}}::vertex]::path diff --git a/regress/expected/cypher_merge.out b/regress/expected/cypher_merge.out index b64860135..aa6476300 100644 --- a/regress/expected/cypher_merge.out +++ b/regress/expected/cypher_merge.out @@ -1662,16 +1662,16 @@ NOTICE: graph "issue_1907" has been created SELECT * from cypher('issue_1907', $$ CREATE (n:Testnode {name: 'Test Node A'}) RETURN n $$) as (n agtype); - n ---------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "Testnode", "properties": {"name": "Test Node A"}}::vertex + n +----------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["Testnode"], "properties": {"name": "Test Node A"}}::vertex (1 row) SELECT * from cypher('issue_1907', $$ CREATE (n:Testnode {name: 'Test Node B'}) RETURN n $$) as (n agtype); - n ---------------------------------------------------------------------------------------------- - {"id": 844424930131970, "label": "Testnode", "properties": {"name": "Test Node B"}}::vertex + n +----------------------------------------------------------------------------------------------- + {"id": 844424930131970, "label": ["Testnode"], "properties": {"name": "Test Node B"}}::vertex (1 row) SELECT * FROM cypher('issue_1907', $$ MATCH ()-[r]->() RETURN r $$) AS (r agtype); diff --git a/regress/expected/cypher_subquery.out b/regress/expected/cypher_subquery.out index 6741f1be3..aa661c230 100644 --- a/regress/expected/cypher_subquery.out +++ b/regress/expected/cypher_subquery.out @@ -29,13 +29,14 @@ SELECT * FROM cypher('subquery', $$ MATCH (a) RETURN (a) $$) AS (result agtype); {"id": 844424930131973, "label": ["person"], "properties": {"age": 34, "name": "Tony"}}::vertex {"id": 844424930131974, "label": ["person"], "properties": {"age": 33, "name": "Valerie"}}::vertex {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex - {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex - {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex + {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Lucy"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex + {"id": 844424930131978, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex {"id": 1688849860263937, "label": ["pet"], "properties": {"name": "Hobbes"}}::vertex {"id": 1688849860263938, "label": ["pet"], "properties": {"name": "Snoopy"}}::vertex {"id": 1688849860263939, "label": ["pet"], "properties": {"name": "Odie"}}::vertex {"id": 1688849860263940, "label": ["pet"], "properties": {"name": "Garfield"}}::vertex -(13 rows) +(14 rows) SELECT * FROM cypher('subquery', $$ MATCH (a:person) WHERE EXISTS {(a:person)-[]->(:pet)} @@ -43,8 +44,8 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person) result --------------------------------------------------------------------------------------------------- {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex - {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex - {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex + {"id": 844424930131978, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex (3 rows) --trying to use b when not defined, should create pattern @@ -54,8 +55,8 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person) result --------------------------------------------------------------------------------------------------- {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex - {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex - {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex + {"id": 844424930131978, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex (3 rows) --query inside @@ -65,8 +66,8 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person) result --------------------------------------------------------------------------------------------------- {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex - {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex - {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex + {"id": 844424930131978, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex (3 rows) --repeat variable in match @@ -143,12 +144,12 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person) MATCH (a:person)-[]->(c:person) } RETURN (a) $$) AS (result agtype); - result ---------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "person", "properties": {"age": 32, "name": "Briggite"}}::vertex - {"id": 844424930131972, "label": "person", "properties": {"age": 25, "name": "Faye"}}::vertex - {"id": 844424930131973, "label": "person", "properties": {"age": 34, "name": "Tony"}}::vertex - {"id": 844424930131977, "label": "person", "properties": {"age": 8, "name": "Charlie"}}::vertex + result +----------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["person"], "properties": {"age": 32, "name": "Briggite"}}::vertex + {"id": 844424930131972, "label": ["person"], "properties": {"age": 25, "name": "Faye"}}::vertex + {"id": 844424930131973, "label": ["person"], "properties": {"age": 34, "name": "Tony"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex (4 rows) --union, mismatched number of return columns for returns @@ -198,9 +199,10 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person) {"id": 844424930131973, "label": ["person"], "properties": {"age": 34, "name": "Tony"}}::vertex {"id": 844424930131974, "label": ["person"], "properties": {"age": 33, "name": "Valerie"}}::vertex {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex - {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex - {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex -(9 rows) + {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Lucy"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex + {"id": 844424930131978, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex +(10 rows) --nesting same var multiple layers SELECT * FROM cypher('subquery', $$ MATCH (a:person) @@ -236,13 +238,14 @@ SELECT * FROM cypher('subquery', $$ MATCH (a) {"id": 844424930131973, "label": ["person"], "properties": {"age": 34, "name": "Tony"}}::vertex {"id": 844424930131974, "label": ["person"], "properties": {"age": 33, "name": "Valerie"}}::vertex {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex - {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex - {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex + {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Lucy"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex + {"id": 844424930131978, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex {"id": 1688849860263937, "label": ["pet"], "properties": {"name": "Hobbes"}}::vertex {"id": 1688849860263938, "label": ["pet"], "properties": {"name": "Snoopy"}}::vertex {"id": 1688849860263939, "label": ["pet"], "properties": {"name": "Odie"}}::vertex {"id": 1688849860263940, "label": ["pet"], "properties": {"name": "Garfield"}}::vertex -(13 rows) +(14 rows) --nesting, accessing indirection in outer scope SELECT * FROM cypher('subquery', $$ MATCH (a:person) @@ -264,9 +267,10 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person) {"id": 844424930131973, "label": ["person"], "properties": {"age": 34, "name": "Tony"}}::vertex {"id": 844424930131974, "label": ["person"], "properties": {"age": 33, "name": "Valerie"}}::vertex {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex - {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex - {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex -(9 rows) + {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Lucy"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex + {"id": 844424930131978, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex +(10 rows) --nesting, accessing var 2+ levels up SELECT * FROM cypher('subquery', $$ MATCH (a:person) @@ -304,9 +308,10 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person) {"id": 844424930131973, "label": ["person"], "properties": {"age": 34, "name": "Tony"}}::vertex {"id": 844424930131974, "label": ["person"], "properties": {"age": 33, "name": "Valerie"}}::vertex {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex - {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex - {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex -(9 rows) + {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Lucy"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex + {"id": 844424930131978, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex +(10 rows) --EXISTS outside of WHERE SELECT * FROM cypher('subquery', $$ MATCH (a:person) @@ -321,9 +326,10 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person) {"id": 844424930131973, "label": ["person"], "properties": {"age": 34, "name": "Tony"}}::vertex | false {"id": 844424930131974, "label": ["person"], "properties": {"age": 33, "name": "Valerie"}}::vertex | false {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex | true - {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex | true - {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex | true -(9 rows) + {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Lucy"}}::vertex | false + {"id": 844424930131977, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex | true + {"id": 844424930131978, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex | true +(10 rows) --Var doesnt exist in outside scope, should fail SELECT * FROM cypher('subquery', $$ RETURN 1, @@ -384,12 +390,13 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person) SELECT * FROM cypher('subquery', $$ MATCH (a:person) WHERE COUNT{MATCH (a:person)-[]-()} > 1 RETURN a $$) AS (result agtype); - result -------------------------------------------------------------------------------------------------- + result +--------------------------------------------------------------------------------------------------- {"id": 844424930131972, "label": ["person"], "properties": {"age": 25, "name": "Faye"}}::vertex {"id": 844424930131973, "label": ["person"], "properties": {"age": 34, "name": "Tony"}}::vertex - {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex -(3 rows) + {"id": 844424930131977, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex + {"id": 844424930131978, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex +(4 rows) --match where person has more than one pet SELECT * FROM cypher('subquery', $$ MATCH (a:person) @@ -397,25 +404,26 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person) RETURN a $$) AS (result agtype); result ------------------------------------------------------------------------------------------------ - {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex + {"id": 844424930131978, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex (1 row) --match on labels SELECT * FROM cypher('subquery', $$ MATCH (a:person) WHERE COUNT{MATCH (a:person)-[:knows]-()} > 1 RETURN a $$) AS (result agtype); - result -------------------------------------------------------------------------------------------------- + result +--------------------------------------------------------------------------------------------------- {"id": 844424930131972, "label": ["person"], "properties": {"age": 25, "name": "Faye"}}::vertex - {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex -(2 rows) + {"id": 844424930131977, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex + {"id": 844424930131978, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex +(3 rows) SELECT * FROM cypher('subquery', $$ MATCH (a:person) WHERE COUNT{MATCH (a:person)-[:knows]-(:pet)} > 1 RETURN a $$) AS (result agtype); result ------------------------------------------------------------------------------------------------ - {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex + {"id": 844424930131978, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex (1 row) SELECT * FROM cypher('subquery', $$ MATCH (a:person) @@ -585,8 +593,8 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person) {"id": 844424930131972, "label": ["person"], "properties": {"age": 25, "name": "Faye"}}::vertex {"id": 844424930131973, "label": ["person"], "properties": {"age": 34, "name": "Tony"}}::vertex {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex - {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex - {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex + {"id": 844424930131978, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex (6 rows) -- Nested BoolExpr @@ -595,9 +603,9 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person) WHERE a.name = 'Charlie'} AND EXISTS {(a:person)-[]->(:person)} RETURN (a) $$) AS (result agtype); - result -------------------------------------------------------------------------------------------------- - {"id": 844424930131977, "label": "person", "properties": {"age": 8, "name": "Charlie"}}::vertex + result +--------------------------------------------------------------------------------------------------- + {"id": 844424930131977, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex (1 row) -- CaseExpr @@ -635,8 +643,8 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person)-[]->(b) result ------------------------------------------------------------------------------------------------- {"id": 844424930131973, "label": ["person"], "properties": {"age": 34, "name": "Tony"}}::vertex - {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex - {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex + {"id": 844424930131978, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex + {"id": 844424930131978, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex (3 rows) -- nested in another exists @@ -661,8 +669,9 @@ SELECT * FROM cypher('subquery', $$ MATCH (a:person)-[]->(b) result --------------------------------------------------------------------------------------------------- {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex - {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex -(2 rows) + {"id": 844424930131977, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex + {"id": 844424930131977, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex +(3 rows) --coalesce, nested in return SELECT * FROM cypher('subquery', $$ MATCH (a:person)-[]->(b) @@ -702,13 +711,14 @@ SELECT * FROM cypher('subquery', $$MATCH (a) {"id": 844424930131973, "label": ["person"], "properties": {"age": 34, "name": "Tony"}}::vertex | false {"id": 844424930131974, "label": ["person"], "properties": {"age": 33, "name": "Valerie"}}::vertex | false {"id": 844424930131975, "label": ["person"], "properties": {"age": 6, "name": "Calvin"}}::vertex | false - {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex | false - {"id": 844424930131977, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex | false + {"id": 844424930131976, "label": ["person"], "properties": {"age": 8, "name": "Lucy"}}::vertex | false + {"id": 844424930131977, "label": ["person"], "properties": {"age": 8, "name": "Charlie"}}::vertex | false + {"id": 844424930131978, "label": ["person"], "properties": {"age": 29, "name": "Jon"}}::vertex | false {"id": 1688849860263937, "label": ["pet"], "properties": {"name": "Hobbes"}}::vertex | true {"id": 1688849860263938, "label": ["pet"], "properties": {"name": "Snoopy"}}::vertex | true {"id": 1688849860263939, "label": ["pet"], "properties": {"name": "Odie"}}::vertex | true {"id": 1688849860263940, "label": ["pet"], "properties": {"name": "Garfield"}}::vertex | true -(13 rows) +(14 rows) -- map projection --where diff --git a/regress/expected/expr.out b/regress/expected/expr.out index ee46c77a8..ce77f5056 100644 --- a/regress/expected/expr.out +++ b/regress/expected/expr.out @@ -2511,8 +2511,8 @@ SELECT cast(null::agtype as json); SELECT vertex_in_json, vertex_in_json->'id' as id, pg_typeof(vertex_in_json) FROM cypher('type_coercion', $$ MATCH (a) RETURN a $$) AS (vertex_in_json json); vertex_in_json | id | pg_typeof --------------------------------------------------------+-----------------+----------- - {"id": 281474976710657, "label": "", "properties": {}} | 281474976710657 | json - {"id": 281474976710658, "label": "", "properties": {}} | 281474976710658 | json + {"id": 281474976710657, "label": [], "properties": {}} | 281474976710657 | json + {"id": 281474976710658, "label": [], "properties": {}} | 281474976710658 | json (2 rows) SELECT edge_in_json, edge_in_json->'id' as id, pg_typeof(edge_in_json) FROM cypher('type_coercion', $$ MATCH ()-[e]->() RETURN e $$) AS (edge_in_json json); @@ -2537,13 +2537,13 @@ SELECT *, pg_typeof(props_in_json) FROM cypher('type_coercion', $$ MATCH (a) RET SELECT path_in_json, path_in_json->0 as first_node FROM cypher('type_coercion', $$ MATCH p=()-[]->() RETURN p $$) AS (path_in_json json); path_in_json | first_node --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------- - [{"id": 281474976710657, "label": "", "properties": {}}, {"id": 844424930131969, "label": "edge", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}, {"id": 281474976710658, "label": "", "properties": {}}] | {"id": 281474976710657, "label": "", "properties": {}} + [{"id": 281474976710657, "label": [], "properties": {}}, {"id": 844424930131969, "label": "edge", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}, {"id": 281474976710658, "label": [], "properties": {}}] | {"id": 281474976710657, "label": [], "properties": {}} (1 row) SELECT *, pg_typeof(nodes_in_json) FROM cypher('type_coercion', $$ MATCH p=()-[]->() RETURN nodes(p) $$) AS (nodes_in_json json); nodes_in_json | pg_typeof ------------------------------------------------------------------------------------------------------------------+----------- - [{"id": 281474976710657, "label": "", "properties": {}}, {"id": 281474976710658, "label": "", "properties": {}}] | json + [{"id": 281474976710657, "label": [], "properties": {}}, {"id": 281474976710658, "label": [], "properties": {}}] | json (1 row) SELECT *, pg_typeof(rels_in_json) FROM cypher('type_coercion', $$ MATCH p=()-[]->() RETURN relationships(p) $$) AS (rels_in_json json); @@ -2555,8 +2555,8 @@ SELECT *, pg_typeof(rels_in_json) FROM cypher('type_coercion', $$ MATCH p=()-[]- SELECT cast(result as json) FROM cypher('type_coercion', $$ MATCH (a) RETURN a $$) AS (result agtype); result -------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {}} - {"id": 281474976710658, "label": "", "properties": {}} + {"id": 281474976710657, "label": [], "properties": {}} + {"id": 281474976710658, "label": [], "properties": {}} (2 rows) SELECT cast(result as json) FROM cypher('type_coercion', $$ MATCH ()-[e]-() RETURN e $$) AS (result agtype); @@ -2575,7 +2575,7 @@ SELECT cast(result as json) FROM cypher('type_coercion', $$ MATCH ()-[e *]->() R SELECT cast(result as json) FROM cypher('type_coercion', $$ MATCH p=()-[]->() RETURN p $$) AS (result agtype); result -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - [{"id": 281474976710657, "label": "", "properties": {}}, {"id": 844424930131969, "label": "edge", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}, {"id": 281474976710658, "label": "", "properties": {}}] + [{"id": 281474976710657, "label": [], "properties": {}}, {"id": 844424930131969, "label": "edge", "end_id": 281474976710658, "start_id": 281474976710657, "properties": {}}, {"id": 281474976710658, "label": [], "properties": {}}] (1 row) SELECT pg_typeof(cast(result as json)) FROM cypher('type_coercion', $$ MATCH p=()-[]->() RETURN p $$) AS (result agtype); @@ -8537,62 +8537,62 @@ NOTICE: graph "expanded_map" has been created SELECT * FROM cypher('expanded_map', $$ CREATE (u {n0: 0, n1: 1, n2: 2, n3: 3, n4: 4, n5: 5, n6: 6, n7: 7, n8: 8, n9: 9, n10: 10, n11: 11, n12: 12, n13: 13, n14: 14, n15: 15, n16: 16, n17: 17, n18: 18, n19: 19, n20: 20, n21: 21, n22: 22, n23: 23, n24: 24, n25: 25, n26: 26, n27: 27, n28: 28, n29: 29, n30: 30, n31: 31, n32: 32, n33: 33, n34: 34, n35: 35, n36: 36, n37: 37, n38: 38, n39: 39, n40: 40, n41: 41, n42: 42, n43: 43, n44: 44, n45: 45, n46: 46, n47: 47, n48: 48} ) RETURN u $$) as (result agtype); result ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48}}::vertex + {"id": 281474976710657, "label": [], "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48}}::vertex (1 row) SELECT * FROM cypher('expanded_map', $$ CREATE (u {n0: 0, n1: 1, n2: 2, n3: 3, n4: 4, n5: 5, n6: 6, n7: 7, n8: 8, n9: 9, n10: 10, n11: 11, n12: 12, n13: 13, n14: 14, n15: 15, n16: 16, n17: 17, n18: 18, n19: 19, n20: 20, n21: 21, n22: 22, n23: 23, n24: 24, n25: 25, n26: 26, n27: 27, n28: 28, n29: 29, n30: 30, n31: 31, n32: 32, n33: 33, n34: 34, n35: 35, n36: 36, n37: 37, n38: 38, n39: 39, n40: 40, n41: 41, n42: 42, n43: 43, n44: 44, n45: 45, n46: 46, n47: 47, n48: 48, n49: 49} ) RETURN u $$) as (result agtype); result ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710658, "label": "", "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49}}::vertex + {"id": 281474976710658, "label": [], "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49}}::vertex (1 row) SELECT * FROM cypher('expanded_map', $$ CREATE (u {n0: 0, n1: 1, n2: 2, n3: 3, n4: 4, n5: 5, n6: 6, n7: 7, n8: 8, n9: 9, n10: 10, n11: 11, n12: 12, n13: 13, n14: 14, n15: 15, n16: 16, n17: 17, n18: 18, n19: 19, n20: 20, n21: 21, n22: 22, n23: 23, n24: 24, n25: 25, n26: 26, n27: 27, n28: 28, n29: 29, n30: 30, n31: 31, n32: 32, n33: 33, n34: 34, n35: 35, n36: 36, n37: 37, n38: 38, n39: 39, n40: 40, n41: 41, n42: 42, n43: 43, n44: 44, n45: 45, n46: 46, n47: 47, n48: 48, n49: 49, n50: 50} ) RETURN u $$) as (result agtype); result --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710659, "label": "", "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50}}::vertex + {"id": 281474976710659, "label": [], "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50}}::vertex (1 row) SELECT * FROM cypher('expanded_map', $$ CREATE (u {n0: 0, n1: 1, n2: 2, n3: 3, n4: 4, n5: 5, n6: 6, n7: 7, n8: 8, n9: 9, n10: 10, n11: 11, n12: 12, n13: 13, n14: 14, n15: 15, n16: 16, n17: 17, n18: 18, n19: 19, n20: 20, n21: 21, n22: 22, n23: 23, n24: 24, n25: 25, n26: 26, n27: 27, n28: 28, n29: 29, n30: 30, n31: 31, n32: 32, n33: 33, n34: 34, n35: 35, n36: 36, n37: 37, n38: 38, n39: 39, n40: 40, n41: 41, n42: 42, n43: 43, n44: 44, n45: 45, n46: 46, n47: 47, n48: 48, n49: 49, n50: 50, n51: 51} ) RETURN u $$) as (result agtype); result -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710660, "label": "", "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50, "n51": 51}}::vertex + {"id": 281474976710660, "label": [], "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50, "n51": 51}}::vertex (1 row) SELECT * FROM cypher('expanded_map', $$ CREATE (u {n0: 0, n1: 1, n2: 2, n3: 3, n4: 4, n5: 5, n6: 6, n7: 7, n8: 8, n9: 9, n10: 10, n11: 11, n12: 12, n13: 13, n14: 14, n15: 15, n16: 16, n17: 17, n18: 18, n19: 19, n20: 20, n21: 21, n22: 22, n23: 23, n24: 24, n25: 25, n26: 26, n27: 27, n28: 28, n29: 29, n30: 30, n31: 31, n32: 32, n33: 33, n34: 34, n35: 35, n36: 36, n37: 37, n38: 38, n39: 39, n40: 40, n41: 41, n42: 42, n43: 43, n44: 44, n45: 45, n46: 46, n47: 47, n48: 48, n49: 49, n50: 50, n51: 51, n52: 52, n53: 53, n54: 54, n55: 55, n56: 56, n57: 57, n58: 58, n59: 59, n60: 60, n61: 61, n62: 62, n63: 63, n64: 64, n65: 65, n66: 66, n67: 67, n68: 68, n69: 69, n70: 70, n71: 71, n72: 72, n73: 73, n74: 74, n75: 75, n76: 76, n77: 77, n78: 78, n79: 79, n80: 80, n81: 81, n82: 82, n83: 83, n84: 84, n85: 85, n86: 86, n87: 87, n88: 88, n89: 89, n90: 90, n91: 91, n92: 92, n93: 93, n94: 94, n95: 95, n96: 96, n97: 97, n98: 98} ) RETURN u $$) as (result agtype); result --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710661, "label": "", "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50, "n51": 51, "n52": 52, "n53": 53, "n54": 54, "n55": 55, "n56": 56, "n57": 57, "n58": 58, "n59": 59, "n60": 60, "n61": 61, "n62": 62, "n63": 63, "n64": 64, "n65": 65, "n66": 66, "n67": 67, "n68": 68, "n69": 69, "n70": 70, "n71": 71, "n72": 72, "n73": 73, "n74": 74, "n75": 75, "n76": 76, "n77": 77, "n78": 78, "n79": 79, "n80": 80, "n81": 81, "n82": 82, "n83": 83, "n84": 84, "n85": 85, "n86": 86, "n87": 87, "n88": 88, "n89": 89, "n90": 90, "n91": 91, "n92": 92, "n93": 93, "n94": 94, "n95": 95, "n96": 96, "n97": 97, "n98": 98}}::vertex + {"id": 281474976710661, "label": [], "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50, "n51": 51, "n52": 52, "n53": 53, "n54": 54, "n55": 55, "n56": 56, "n57": 57, "n58": 58, "n59": 59, "n60": 60, "n61": 61, "n62": 62, "n63": 63, "n64": 64, "n65": 65, "n66": 66, "n67": 67, "n68": 68, "n69": 69, "n70": 70, "n71": 71, "n72": 72, "n73": 73, "n74": 74, "n75": 75, "n76": 76, "n77": 77, "n78": 78, "n79": 79, "n80": 80, "n81": 81, "n82": 82, "n83": 83, "n84": 84, "n85": 85, "n86": 86, "n87": 87, "n88": 88, "n89": 89, "n90": 90, "n91": 91, "n92": 92, "n93": 93, "n94": 94, "n95": 95, "n96": 96, "n97": 97, "n98": 98}}::vertex (1 row) SELECT * FROM cypher('expanded_map', $$ CREATE (u {n0: 0, n1: 1, n2: 2, n3: 3, n4: 4, n5: 5, n6: 6, n7: 7, n8: 8, n9: 9, n10: 10, n11: 11, n12: 12, n13: 13, n14: 14, n15: 15, n16: 16, n17: 17, n18: 18, n19: 19, n20: 20, n21: 21, n22: 22, n23: 23, n24: 24, n25: 25, n26: 26, n27: 27, n28: 28, n29: 29, n30: 30, n31: 31, n32: 32, n33: 33, n34: 34, n35: 35, n36: 36, n37: 37, n38: 38, n39: 39, n40: 40, n41: 41, n42: 42, n43: 43, n44: 44, n45: 45, n46: 46, n47: 47, n48: 48, n49: 49, n50: 50, n51: 51, n52: 52, n53: 53, n54: 54, n55: 55, n56: 56, n57: 57, n58: 58, n59: 59, n60: 60, n61: 61, n62: 62, n63: 63, n64: 64, n65: 65, n66: 66, n67: 67, n68: 68, n69: 69, n70: 70, n71: 71, n72: 72, n73: 73, n74: 74, n75: 75, n76: 76, n77: 77, n78: 78, n79: 79, n80: 80, n81: 81, n82: 82, n83: 83, n84: 84, n85: 85, n86: 86, n87: 87, n88: 88, n89: 89, n90: 90, n91: 91, n92: 92, n93: 93, n94: 94, n95: 95, n96: 96, n97: 97, n98: 98, n99: 99} ) RETURN u $$) as (result agtype); result -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710662, "label": "", "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50, "n51": 51, "n52": 52, "n53": 53, "n54": 54, "n55": 55, "n56": 56, "n57": 57, "n58": 58, "n59": 59, "n60": 60, "n61": 61, "n62": 62, "n63": 63, "n64": 64, "n65": 65, "n66": 66, "n67": 67, "n68": 68, "n69": 69, "n70": 70, "n71": 71, "n72": 72, "n73": 73, "n74": 74, "n75": 75, "n76": 76, "n77": 77, "n78": 78, "n79": 79, "n80": 80, "n81": 81, "n82": 82, "n83": 83, "n84": 84, "n85": 85, "n86": 86, "n87": 87, "n88": 88, "n89": 89, "n90": 90, "n91": 91, "n92": 92, "n93": 93, "n94": 94, "n95": 95, "n96": 96, "n97": 97, "n98": 98, "n99": 99}}::vertex + {"id": 281474976710662, "label": [], "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50, "n51": 51, "n52": 52, "n53": 53, "n54": 54, "n55": 55, "n56": 56, "n57": 57, "n58": 58, "n59": 59, "n60": 60, "n61": 61, "n62": 62, "n63": 63, "n64": 64, "n65": 65, "n66": 66, "n67": 67, "n68": 68, "n69": 69, "n70": 70, "n71": 71, "n72": 72, "n73": 73, "n74": 74, "n75": 75, "n76": 76, "n77": 77, "n78": 78, "n79": 79, "n80": 80, "n81": 81, "n82": 82, "n83": 83, "n84": 84, "n85": 85, "n86": 86, "n87": 87, "n88": 88, "n89": 89, "n90": 90, "n91": 91, "n92": 92, "n93": 93, "n94": 94, "n95": 95, "n96": 96, "n97": 97, "n98": 98, "n99": 99}}::vertex (1 row) SELECT * FROM cypher('expanded_map', $$ CREATE (u {n0: 0, n1: 1, n2: 2, n3: 3, n4: 4, n5: 5, n6: 6, n7: 7, n8: 8, n9: 9, n10: 10, n11: 11, n12: 12, n13: 13, n14: 14, n15: 15, n16: 16, n17: 17, n18: 18, n19: 19, n20: 20, n21: 21, n22: 22, n23: 23, n24: 24, n25: 25, n26: 26, n27: 27, n28: 28, n29: 29, n30: 30, n31: 31, n32: 32, n33: 33, n34: 34, n35: 35, n36: 36, n37: 37, n38: 38, n39: 39, n40: 40, n41: 41, n42: 42, n43: 43, n44: 44, n45: 45, n46: 46, n47: 47, n48: 48, n49: 49, n50: 50, n51: 51, n52: 52, n53: 53, n54: 54, n55: 55, n56: 56, n57: 57, n58: 58, n59: 59, n60: 60, n61: 61, n62: 62, n63: 63, n64: 64, n65: 65, n66: 66, n67: 67, n68: 68, n69: 69, n70: 70, n71: 71, n72: 72, n73: 73, n74: 74, n75: 75, n76: 76, n77: 77, n78: 78, n79: 79, n80: 80, n81: 81, n82: 82, n83: 83, n84: 84, n85: 85, n86: 86, n87: 87, n88: 88, n89: 89, n90: 90, n91: 91, n92: 92, n93: 93, n94: 94, n95: 95, n96: 96, n97: 97, n98: 98, n99: 99, n100: 100} ) RETURN u $$) as (result agtype); result --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710663, "label": "", "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50, "n51": 51, "n52": 52, "n53": 53, "n54": 54, "n55": 55, "n56": 56, "n57": 57, "n58": 58, "n59": 59, "n60": 60, "n61": 61, "n62": 62, "n63": 63, "n64": 64, "n65": 65, "n66": 66, "n67": 67, "n68": 68, "n69": 69, "n70": 70, "n71": 71, "n72": 72, "n73": 73, "n74": 74, "n75": 75, "n76": 76, "n77": 77, "n78": 78, "n79": 79, "n80": 80, "n81": 81, "n82": 82, "n83": 83, "n84": 84, "n85": 85, "n86": 86, "n87": 87, "n88": 88, "n89": 89, "n90": 90, "n91": 91, "n92": 92, "n93": 93, "n94": 94, "n95": 95, "n96": 96, "n97": 97, "n98": 98, "n99": 99, "n100": 100}}::vertex + {"id": 281474976710663, "label": [], "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50, "n51": 51, "n52": 52, "n53": 53, "n54": 54, "n55": 55, "n56": 56, "n57": 57, "n58": 58, "n59": 59, "n60": 60, "n61": 61, "n62": 62, "n63": 63, "n64": 64, "n65": 65, "n66": 66, "n67": 67, "n68": 68, "n69": 69, "n70": 70, "n71": 71, "n72": 72, "n73": 73, "n74": 74, "n75": 75, "n76": 76, "n77": 77, "n78": 78, "n79": 79, "n80": 80, "n81": 81, "n82": 82, "n83": 83, "n84": 84, "n85": 85, "n86": 86, "n87": 87, "n88": 88, "n89": 89, "n90": 90, "n91": 91, "n92": 92, "n93": 93, "n94": 94, "n95": 95, "n96": 96, "n97": 97, "n98": 98, "n99": 99, "n100": 100}}::vertex (1 row) SELECT * FROM cypher('expanded_map', $$ CREATE (u {n0: 0, n1: 1, n2: 2, n3: 3, n4: 4, n5: 5, n6: 6, n7: 7, n8: 8, n9: 9, n10: 10, n11: 11, n12: 12, n13: 13, n14: 14, n15: 15, n16: 16, n17: 17, n18: 18, n19: 19, n20: 20, n21: 21, n22: 22, n23: 23, n24: 24, n25: 25, n26: 26, n27: 27, n28: 28, n29: 29, n30: 30, n31: 31, n32: 32, n33: 33, n34: 34, n35: 35, n36: 36, n37: 37, n38: 38, n39: 39, n40: 40, n41: 41, n42: 42, n43: 43, n44: 44, n45: 45, n46: 46, n47: 47, n48: 48, n49: 49, n50: 50, n51: 51, n52: 52, n53: 53, n54: 54, n55: 55, n56: 56, n57: 57, n58: 58, n59: 59, n60: 60, n61: 61, n62: 62, n63: 63, n64: 64, n65: 65, n66: 66, n67: 67, n68: 68, n69: 69, n70: 70, n71: 71, n72: 72, n73: 73, n74: 74, n75: 75, n76: 76, n77: 77, n78: 78, n79: 79, n80: 80, n81: 81, n82: 82, n83: 83, n84: 84, n85: 85, n86: 86, n87: 87, n88: 88, n89: 89, n90: 90, n91: 91, n92: 92, n93: 93, n94: 94, n95: 95, n96: 96, n97: 97, n98: 98, n99: 99, n100: 100, n101: 101} ) RETURN u $$) as (result agtype); result ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710664, "label": "", "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50, "n51": 51, "n52": 52, "n53": 53, "n54": 54, "n55": 55, "n56": 56, "n57": 57, "n58": 58, "n59": 59, "n60": 60, "n61": 61, "n62": 62, "n63": 63, "n64": 64, "n65": 65, "n66": 66, "n67": 67, "n68": 68, "n69": 69, "n70": 70, "n71": 71, "n72": 72, "n73": 73, "n74": 74, "n75": 75, "n76": 76, "n77": 77, "n78": 78, "n79": 79, "n80": 80, "n81": 81, "n82": 82, "n83": 83, "n84": 84, "n85": 85, "n86": 86, "n87": 87, "n88": 88, "n89": 89, "n90": 90, "n91": 91, "n92": 92, "n93": 93, "n94": 94, "n95": 95, "n96": 96, "n97": 97, "n98": 98, "n99": 99, "n100": 100, "n101": 101}}::vertex + {"id": 281474976710664, "label": [], "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50, "n51": 51, "n52": 52, "n53": 53, "n54": 54, "n55": 55, "n56": 56, "n57": 57, "n58": 58, "n59": 59, "n60": 60, "n61": 61, "n62": 62, "n63": 63, "n64": 64, "n65": 65, "n66": 66, "n67": 67, "n68": 68, "n69": 69, "n70": 70, "n71": 71, "n72": 72, "n73": 73, "n74": 74, "n75": 75, "n76": 76, "n77": 77, "n78": 78, "n79": 79, "n80": 80, "n81": 81, "n82": 82, "n83": 83, "n84": 84, "n85": 85, "n86": 86, "n87": 87, "n88": 88, "n89": 89, "n90": 90, "n91": 91, "n92": 92, "n93": 93, "n94": 94, "n95": 95, "n96": 96, "n97": 97, "n98": 98, "n99": 99, "n100": 100, "n101": 101}}::vertex (1 row) SELECT * FROM cypher('expanded_map', $$ MATCH (u) RETURN u $$) as (result agtype); result ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48}}::vertex - {"id": 281474976710658, "label": "", "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49}}::vertex - {"id": 281474976710659, "label": "", "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50}}::vertex - {"id": 281474976710660, "label": "", "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50, "n51": 51}}::vertex - {"id": 281474976710661, "label": "", "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50, "n51": 51, "n52": 52, "n53": 53, "n54": 54, "n55": 55, "n56": 56, "n57": 57, "n58": 58, "n59": 59, "n60": 60, "n61": 61, "n62": 62, "n63": 63, "n64": 64, "n65": 65, "n66": 66, "n67": 67, "n68": 68, "n69": 69, "n70": 70, "n71": 71, "n72": 72, "n73": 73, "n74": 74, "n75": 75, "n76": 76, "n77": 77, "n78": 78, "n79": 79, "n80": 80, "n81": 81, "n82": 82, "n83": 83, "n84": 84, "n85": 85, "n86": 86, "n87": 87, "n88": 88, "n89": 89, "n90": 90, "n91": 91, "n92": 92, "n93": 93, "n94": 94, "n95": 95, "n96": 96, "n97": 97, "n98": 98}}::vertex - {"id": 281474976710662, "label": "", "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50, "n51": 51, "n52": 52, "n53": 53, "n54": 54, "n55": 55, "n56": 56, "n57": 57, "n58": 58, "n59": 59, "n60": 60, "n61": 61, "n62": 62, "n63": 63, "n64": 64, "n65": 65, "n66": 66, "n67": 67, "n68": 68, "n69": 69, "n70": 70, "n71": 71, "n72": 72, "n73": 73, "n74": 74, "n75": 75, "n76": 76, "n77": 77, "n78": 78, "n79": 79, "n80": 80, "n81": 81, "n82": 82, "n83": 83, "n84": 84, "n85": 85, "n86": 86, "n87": 87, "n88": 88, "n89": 89, "n90": 90, "n91": 91, "n92": 92, "n93": 93, "n94": 94, "n95": 95, "n96": 96, "n97": 97, "n98": 98, "n99": 99}}::vertex - {"id": 281474976710663, "label": "", "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50, "n51": 51, "n52": 52, "n53": 53, "n54": 54, "n55": 55, "n56": 56, "n57": 57, "n58": 58, "n59": 59, "n60": 60, "n61": 61, "n62": 62, "n63": 63, "n64": 64, "n65": 65, "n66": 66, "n67": 67, "n68": 68, "n69": 69, "n70": 70, "n71": 71, "n72": 72, "n73": 73, "n74": 74, "n75": 75, "n76": 76, "n77": 77, "n78": 78, "n79": 79, "n80": 80, "n81": 81, "n82": 82, "n83": 83, "n84": 84, "n85": 85, "n86": 86, "n87": 87, "n88": 88, "n89": 89, "n90": 90, "n91": 91, "n92": 92, "n93": 93, "n94": 94, "n95": 95, "n96": 96, "n97": 97, "n98": 98, "n99": 99, "n100": 100}}::vertex - {"id": 281474976710664, "label": "", "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50, "n51": 51, "n52": 52, "n53": 53, "n54": 54, "n55": 55, "n56": 56, "n57": 57, "n58": 58, "n59": 59, "n60": 60, "n61": 61, "n62": 62, "n63": 63, "n64": 64, "n65": 65, "n66": 66, "n67": 67, "n68": 68, "n69": 69, "n70": 70, "n71": 71, "n72": 72, "n73": 73, "n74": 74, "n75": 75, "n76": 76, "n77": 77, "n78": 78, "n79": 79, "n80": 80, "n81": 81, "n82": 82, "n83": 83, "n84": 84, "n85": 85, "n86": 86, "n87": 87, "n88": 88, "n89": 89, "n90": 90, "n91": 91, "n92": 92, "n93": 93, "n94": 94, "n95": 95, "n96": 96, "n97": 97, "n98": 98, "n99": 99, "n100": 100, "n101": 101}}::vertex + {"id": 281474976710657, "label": [], "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48}}::vertex + {"id": 281474976710658, "label": [], "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49}}::vertex + {"id": 281474976710659, "label": [], "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50}}::vertex + {"id": 281474976710660, "label": [], "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50, "n51": 51}}::vertex + {"id": 281474976710661, "label": [], "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50, "n51": 51, "n52": 52, "n53": 53, "n54": 54, "n55": 55, "n56": 56, "n57": 57, "n58": 58, "n59": 59, "n60": 60, "n61": 61, "n62": 62, "n63": 63, "n64": 64, "n65": 65, "n66": 66, "n67": 67, "n68": 68, "n69": 69, "n70": 70, "n71": 71, "n72": 72, "n73": 73, "n74": 74, "n75": 75, "n76": 76, "n77": 77, "n78": 78, "n79": 79, "n80": 80, "n81": 81, "n82": 82, "n83": 83, "n84": 84, "n85": 85, "n86": 86, "n87": 87, "n88": 88, "n89": 89, "n90": 90, "n91": 91, "n92": 92, "n93": 93, "n94": 94, "n95": 95, "n96": 96, "n97": 97, "n98": 98}}::vertex + {"id": 281474976710662, "label": [], "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50, "n51": 51, "n52": 52, "n53": 53, "n54": 54, "n55": 55, "n56": 56, "n57": 57, "n58": 58, "n59": 59, "n60": 60, "n61": 61, "n62": 62, "n63": 63, "n64": 64, "n65": 65, "n66": 66, "n67": 67, "n68": 68, "n69": 69, "n70": 70, "n71": 71, "n72": 72, "n73": 73, "n74": 74, "n75": 75, "n76": 76, "n77": 77, "n78": 78, "n79": 79, "n80": 80, "n81": 81, "n82": 82, "n83": 83, "n84": 84, "n85": 85, "n86": 86, "n87": 87, "n88": 88, "n89": 89, "n90": 90, "n91": 91, "n92": 92, "n93": 93, "n94": 94, "n95": 95, "n96": 96, "n97": 97, "n98": 98, "n99": 99}}::vertex + {"id": 281474976710663, "label": [], "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50, "n51": 51, "n52": 52, "n53": 53, "n54": 54, "n55": 55, "n56": 56, "n57": 57, "n58": 58, "n59": 59, "n60": 60, "n61": 61, "n62": 62, "n63": 63, "n64": 64, "n65": 65, "n66": 66, "n67": 67, "n68": 68, "n69": 69, "n70": 70, "n71": 71, "n72": 72, "n73": 73, "n74": 74, "n75": 75, "n76": 76, "n77": 77, "n78": 78, "n79": 79, "n80": 80, "n81": 81, "n82": 82, "n83": 83, "n84": 84, "n85": 85, "n86": 86, "n87": 87, "n88": 88, "n89": 89, "n90": 90, "n91": 91, "n92": 92, "n93": 93, "n94": 94, "n95": 95, "n96": 96, "n97": 97, "n98": 98, "n99": 99, "n100": 100}}::vertex + {"id": 281474976710664, "label": [], "properties": {"n0": 0, "n1": 1, "n2": 2, "n3": 3, "n4": 4, "n5": 5, "n6": 6, "n7": 7, "n8": 8, "n9": 9, "n10": 10, "n11": 11, "n12": 12, "n13": 13, "n14": 14, "n15": 15, "n16": 16, "n17": 17, "n18": 18, "n19": 19, "n20": 20, "n21": 21, "n22": 22, "n23": 23, "n24": 24, "n25": 25, "n26": 26, "n27": 27, "n28": 28, "n29": 29, "n30": 30, "n31": 31, "n32": 32, "n33": 33, "n34": 34, "n35": 35, "n36": 36, "n37": 37, "n38": 38, "n39": 39, "n40": 40, "n41": 41, "n42": 42, "n43": 43, "n44": 44, "n45": 45, "n46": 46, "n47": 47, "n48": 48, "n49": 49, "n50": 50, "n51": 51, "n52": 52, "n53": 53, "n54": 54, "n55": 55, "n56": 56, "n57": 57, "n58": 58, "n59": 59, "n60": 60, "n61": 61, "n62": 62, "n63": 63, "n64": 64, "n65": 65, "n66": 66, "n67": 67, "n68": 68, "n69": 69, "n70": 70, "n71": 71, "n72": 72, "n73": 73, "n74": 74, "n75": 75, "n76": 76, "n77": 77, "n78": 78, "n79": 79, "n80": 80, "n81": 81, "n82": 82, "n83": 83, "n84": 84, "n85": 85, "n86": 86, "n87": 87, "n88": 88, "n89": 89, "n90": 90, "n91": 91, "n92": 92, "n93": 93, "n94": 94, "n95": 95, "n96": 96, "n97": 97, "n98": 98, "n99": 99, "n100": 100, "n101": 101}}::vertex (8 rows) -- @@ -8663,20 +8663,20 @@ SELECT * from cypher('issue_1988', $$ SELECT * FROM cypher('issue_1988', $$ MATCH (p) RETURN p $$) as (p agtype); - p ------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "Part", "properties": {"part_num": 123}}::vertex - {"id": 844424930131970, "label": "Part", "properties": {"part_num": 345}}::vertex - {"id": 844424930131971, "label": "Part", "properties": {"part_num": 456}}::vertex - {"id": 844424930131972, "label": "Part", "properties": {"part_num": 789}}::vertex + p +------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["Part"], "properties": {"part_num": 123}}::vertex + {"id": 844424930131970, "label": ["Part"], "properties": {"part_num": 345}}::vertex + {"id": 844424930131971, "label": ["Part"], "properties": {"part_num": 456}}::vertex + {"id": 844424930131972, "label": ["Part"], "properties": {"part_num": 789}}::vertex (4 rows) SELECT * from cypher('issue_1988', $$ MATCH (p1:Part {part_num: 123}), (p2:Part {part_num: 345}) CREATE (p1)-[u:used_by { quantity: 1 }]->(p2) RETURN p1, u, p2 $$) as (p1 agtype, u agtype, p2 agtype); - p1 | u | p2 ------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "Part", "properties": {"part_num": 123}}::vertex | {"id": 1125899906842625, "label": "used_by", "end_id": 844424930131970, "start_id": 844424930131969, "properties": {"quantity": 1}}::edge | {"id": 844424930131970, "label": "Part", "properties": {"part_num": 345}}::vertex + p1 | u | p2 +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["Part"], "properties": {"part_num": 123}}::vertex | {"id": 1125899906842625, "label": "used_by", "end_id": 844424930131970, "start_id": 844424930131969, "properties": {"quantity": 1}}::edge | {"id": 844424930131970, "label": ["Part"], "properties": {"part_num": 345}}::vertex (1 row) -- should fail @@ -8688,83 +8688,83 @@ LINE 2: MATCH (p:Part { part_num: 123 }) SET p.match = 'xyz' RET... -- should succeed SELECT * FROM cypher('issue_1988', $$ MATCH (p:Part { part_num: 123 }) SET p.`match` = 'xyz' RETURN p $$) as (p agtype); - p ---------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "Part", "properties": {"match": "xyz", "part_num": 123}}::vertex + p +----------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["Part"], "properties": {"match": "xyz", "part_num": 123}}::vertex (1 row) SELECT * FROM cypher('issue_1988', $$ MATCH (p:Part { part_num: 123 }) SET p.`set` = 'xyz' RETURN p $$) as (p agtype); - p ------------------------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "Part", "properties": {"set": "xyz", "match": "xyz", "part_num": 123}}::vertex + p +------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["Part"], "properties": {"set": "xyz", "match": "xyz", "part_num": 123}}::vertex (1 row) SELECT * FROM cypher('issue_1988', $$ MATCH (p:Part { part_num: 123 }) SET p.`delete` = 'xyz' RETURN p $$) as (p agtype); - p ----------------------------------------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "Part", "properties": {"set": "xyz", "match": "xyz", "delete": "xyz", "part_num": 123}}::vertex + p +------------------------------------------------------------------------------------------------------------------------------------ + {"id": 844424930131969, "label": ["Part"], "properties": {"set": "xyz", "match": "xyz", "delete": "xyz", "part_num": 123}}::vertex (1 row) SELECT * FROM cypher('issue_1988', $$ MATCH (p:Part { part_num: 123 }) SET p.`merge` = 'xyz' RETURN p $$) as (p agtype); - p --------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "Part", "properties": {"set": "xyz", "match": "xyz", "merge": "xyz", "delete": "xyz", "part_num": 123}}::vertex + p +---------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["Part"], "properties": {"set": "xyz", "match": "xyz", "merge": "xyz", "delete": "xyz", "part_num": 123}}::vertex (1 row) SELECT * FROM cypher('issue_1988', $$ MATCH (p:Part { part_num: 123 }) SET p.`create` = 'xyz' RETURN p $$) as (p agtype); - p -------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "Part", "properties": {"set": "xyz", "match": "xyz", "merge": "xyz", "create": "xyz", "delete": "xyz", "part_num": 123}}::vertex + p +--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["Part"], "properties": {"set": "xyz", "match": "xyz", "merge": "xyz", "create": "xyz", "delete": "xyz", "part_num": 123}}::vertex (1 row) -- should succeed SELECT * FROM cypher('issue_1988', $$ MATCH (p:Part { part_num: 123 }) SET p.`match` = 'match' RETURN p $$) as (p agtype); - p ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "Part", "properties": {"set": "xyz", "match": "match", "merge": "xyz", "create": "xyz", "delete": "xyz", "part_num": 123}}::vertex + p +----------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["Part"], "properties": {"set": "xyz", "match": "match", "merge": "xyz", "create": "xyz", "delete": "xyz", "part_num": 123}}::vertex (1 row) SELECT * FROM cypher('issue_1988', $$ MATCH (p:Part { part_num: 123 }) SET p.`set` = 'set' RETURN p $$) as (p agtype); - p ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "Part", "properties": {"set": "set", "match": "match", "merge": "xyz", "create": "xyz", "delete": "xyz", "part_num": 123}}::vertex + p +----------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["Part"], "properties": {"set": "set", "match": "match", "merge": "xyz", "create": "xyz", "delete": "xyz", "part_num": 123}}::vertex (1 row) SELECT * FROM cypher('issue_1988', $$ MATCH (p:Part { part_num: 123 }) SET p.`delete` = 'delete' RETURN p $$) as (p agtype); - p ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "Part", "properties": {"set": "set", "match": "match", "merge": "xyz", "create": "xyz", "delete": "delete", "part_num": 123}}::vertex + p +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["Part"], "properties": {"set": "set", "match": "match", "merge": "xyz", "create": "xyz", "delete": "delete", "part_num": 123}}::vertex (1 row) SELECT * FROM cypher('issue_1988', $$ MATCH (p:Part { part_num: 123 }) SET p.`merge` = 'merge' RETURN p $$) as (p agtype); - p --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 844424930131969, "label": "Part", "properties": {"set": "set", "match": "match", "merge": "merge", "create": "xyz", "delete": "delete", "part_num": 123}}::vertex + p +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["Part"], "properties": {"set": "set", "match": "match", "merge": "merge", "create": "xyz", "delete": "delete", "part_num": 123}}::vertex (1 row) SELECT * FROM cypher('issue_1988', $$ MATCH (p:Part { part_num: 123 }) SET p.`create` = 'create' RETURN p $$) as (p agtype); - p ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - {"id": 844424930131969, "label": "Part", "properties": {"set": "set", "match": "match", "merge": "merge", "create": "create", "delete": "delete", "part_num": 123}}::vertex + p +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131969, "label": ["Part"], "properties": {"set": "set", "match": "match", "merge": "merge", "create": "create", "delete": "delete", "part_num": 123}}::vertex (1 row) SELECT * FROM cypher('issue_1988', $$ MATCH (p) RETURN p $$) as (p agtype); - p ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - {"id": 844424930131970, "label": "Part", "properties": {"part_num": 345}}::vertex - {"id": 844424930131971, "label": "Part", "properties": {"part_num": 456}}::vertex - {"id": 844424930131972, "label": "Part", "properties": {"part_num": 789}}::vertex - {"id": 844424930131969, "label": "Part", "properties": {"set": "set", "match": "match", "merge": "merge", "create": "create", "delete": "delete", "part_num": 123}}::vertex + p +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + {"id": 844424930131970, "label": ["Part"], "properties": {"part_num": 345}}::vertex + {"id": 844424930131971, "label": ["Part"], "properties": {"part_num": 456}}::vertex + {"id": 844424930131972, "label": ["Part"], "properties": {"part_num": 789}}::vertex + {"id": 844424930131969, "label": ["Part"], "properties": {"set": "set", "match": "match", "merge": "merge", "create": "create", "delete": "delete", "part_num": 123}}::vertex (4 rows) -- diff --git a/regress/expected/list_comprehension.out b/regress/expected/list_comprehension.out index 50fd65542..a00904afe 100644 --- a/regress/expected/list_comprehension.out +++ b/regress/expected/list_comprehension.out @@ -596,13 +596,13 @@ SELECT * FROM cypher('list_comprehension', $$ MATCH (u) WITH *, [i in [1,2,3]] a SELECT * FROM cypher('list_comprehension', $$ MATCH (u) WITH * WHERE u.list=[i IN range(0,12,2)] RETURN u $$) AS (result agtype); result --------------------------------------------------------------------------------------------------------------------------------------------------------------- - {"id": 281474976710657, "label": "", "properties": {"a": [], "b": [0, 1, 2, 3, 4, 5], "c": [0, 2, 4, 6, 8, 10, 12], "list": [0, 2, 4, 6, 8, 10, 12]}}::vertex + {"id": 281474976710657, "label": [], "properties": {"a": [], "b": [0, 1, 2, 3, 4, 5], "c": [0, 2, 4, 6, 8, 10, 12], "list": [0, 2, 4, 6, 8, 10, 12]}}::vertex (1 row) SELECT * FROM cypher('list_comprehension', $$ MATCH (u) WITH * WHERE u.list=[i IN u.list] RETURN u LIMIT 1 $$) AS (result agtype); result ----------------------------------------------------------------------------------------------- - {"id": 281474976710658, "label": "", "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex + {"id": 281474976710658, "label": [], "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex (1 row) SELECT * FROM cypher('list_comprehension', $$ MATCH (u) WITH * WITH *, [i in [1,2,3]] as list RETURN list LIMIT 1 $$) AS (result agtype); diff --git a/src/backend/commands/label_commands.c b/src/backend/commands/label_commands.c index 1fb4e26f8..b7fb99fcc 100644 --- a/src/backend/commands/label_commands.c +++ b/src/backend/commands/label_commands.c @@ -299,6 +299,9 @@ Datum create_elabel(PG_FUNCTION_ARGS) * For the new label, create an entry in ag_catalog.ag_label, create a * new table and sequence. Returns the oid from the new tuple in * ag_catalog.ag_label. + * + * Note: parameter label_type accepts macros LABEL_TYPE_*, rel_kind + * accepts macros LABEL_REL_KIND_*. */ void create_label(char *graph_name, char *label_name, char label_type, char rel_kind, List *parents) diff --git a/src/backend/parser/cypher_label_expr.c b/src/backend/parser/cypher_label_expr.c index 9a0fa7bbe..0f15f2798 100644 --- a/src/backend/parser/cypher_label_expr.c +++ b/src/backend/parser/cypher_label_expr.c @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + #include "postgres.h" #include "access/genam.h" diff --git a/src/backend/utils/adt/agtype.c b/src/backend/utils/adt/agtype.c index 0e131c0a9..8141011e3 100644 --- a/src/backend/utils/adt/agtype.c +++ b/src/backend/utils/adt/agtype.c @@ -2402,7 +2402,7 @@ Datum _agtype_build_vertex_cstringlabel(PG_FUNCTION_ARGS) rawscalar = build_agtype(bstate); pfree_agtype_build_state(bstate); - PG_FREE_IF_COPY(label, 1); + PG_FREE_IF_COPY(label_name, 1); PG_FREE_IF_COPY(properties, 2); PG_RETURN_POINTER(rawscalar); diff --git a/src/backend/utils/load/age_load.c b/src/backend/utils/load/age_load.c index 815a53bac..c741886aa 100644 --- a/src/backend/utils/load/age_load.c +++ b/src/backend/utils/load/age_load.c @@ -466,7 +466,8 @@ static int32 get_or_create_label(Oid graph_oid, char *graph_name, rv = get_label_range_var(graph_name, graph_oid, default_label); parent = list_make1(rv); - create_label(graph_name, label_name, label_kind, parent); + create_label(graph_name, label_name, label_kind, + LABEL_REL_KIND_SINGLE, parent); label_id = get_label_id(label_name, graph_oid); ereport(NOTICE, From 0a37397ce6c958a4deb7c9d710b64bfcf1af0876 Mon Sep 17 00:00:00 2001 From: Rafsun Masud Date: Tue, 17 Sep 2024 23:45:31 -0700 Subject: [PATCH 13/13] Add seperators in the generated intersection relation names This will create a distinction in intersection relation names between the following combinations: (MN:P) and (M:N:P). The credit for finding out this edge case goes to Muhammad Taha Naveed. Additionally, a parameter is added to the create_label function to skip checking valid label names. This is useful when creating intersection relations (the name can be invalid due to containing the separator symbol). Co-authored-by: Muhammad Taha Naveed --- regress/expected/multiple_label.out | 113 ++++++++++++++++--------- regress/sql/multiple_label.sql | 5 ++ src/backend/commands/graph_commands.c | 4 +- src/backend/commands/label_commands.c | 10 +-- src/backend/parser/cypher_label_expr.c | 34 +++++++- src/backend/utils/load/age_load.c | 2 +- src/include/commands/label_commands.h | 2 +- src/include/parser/cypher_label_expr.h | 1 + 8 files changed, 117 insertions(+), 54 deletions(-) diff --git a/regress/expected/multiple_label.out b/regress/expected/multiple_label.out index cc04443da..4ca418c07 100644 --- a/regress/expected/multiple_label.out +++ b/regress/expected/multiple_label.out @@ -272,8 +272,8 @@ drop cascades to table mlabels1._ag_label_edge drop cascades to table mlabels1.a drop cascades to table mlabels1.b drop cascades to table mlabels1.c -drop cascades to table mlabels1._agr_ab -drop cascades to table mlabels1._agr_abc +drop cascades to table mlabels1."_agr_a-b" +drop cascades to table mlabels1."_agr_a-b-c" drop cascades to table mlabels1.p drop cascades to table mlabels1.q drop cascades to table mlabels1.r @@ -409,14 +409,14 @@ SElECT drop_graph('mlabels5', true); NOTICE: drop cascades to 11 other objects DETAIL: drop cascades to table mlabels5._ag_label_vertex drop cascades to table mlabels5._ag_label_edge -drop cascades to table mlabels5._agr_employeeengineer +drop cascades to table mlabels5."_agr_employee-engineer" drop cascades to table mlabels5.employee drop cascades to table mlabels5.engineer -drop cascades to table mlabels5._agr_employeemanager +drop cascades to table mlabels5."_agr_employee-manager" drop cascades to table mlabels5.manager -drop cascades to table mlabels5._agr_employeeengineermanagertechlead +drop cascades to table mlabels5."_agr_employee-engineer-manager-techlead" drop cascades to table mlabels5.techlead -drop cascades to table mlabels5._agr_accountantemployee +drop cascades to table mlabels5."_agr_accountant-employee" drop cascades to table mlabels5.accountant NOTICE: graph "mlabels5" has been dropped drop_graph @@ -458,9 +458,32 @@ SELECT * FROM cypher('mlabels6', $$ CREATE ()-[:b]->() $$) as (a agtype); ERROR: label b is for vertices, not edges LINE 1: SELECT * FROM cypher('mlabels6', $$ CREATE ()-[:b]->() $$) a... ^ +-- check intersection relation separator +SELECT * FROM cypher('mlabels6', $$ MATCH (x) DETACH DELETE x $$) as (a agtype); + a +--- +(0 rows) + +SELECT * FROM cypher('mlabels6', $$ CREATE (:M:N:P) $$) as (a agtype); + a +--- +(0 rows) + +SELECT * FROM cypher('mlabels6', $$ CREATE (:MN:P) $$) as (a agtype); + a +--- +(0 rows) + +SELECT * FROM cypher('mlabels6', $$ MATCH (x) RETURN x $$) as (a agtype); + a +------------------------------------------------------------------------------ + {"id": 2533274790395905, "label": ["M", "N", "P"], "properties": {}}::vertex + {"id": 3659174697238529, "label": ["MN", "P"], "properties": {}}::vertex +(2 rows) + -- cleanup SElECT drop_graph('mlabels6', true); -NOTICE: drop cascades to 8 other objects +NOTICE: drop cascades to 14 other objects DETAIL: drop cascades to table mlabels6._ag_label_vertex drop cascades to table mlabels6._ag_label_edge drop cascades to table mlabels6.a @@ -469,6 +492,12 @@ drop cascades to table mlabels6.b drop cascades to table mlabels6.y drop cascades to table mlabels6.c drop cascades to table mlabels6.z +drop cascades to table mlabels6."_agr_M-N-P" +drop cascades to table mlabels6."M" +drop cascades to table mlabels6."N" +drop cascades to table mlabels6."P" +drop cascades to table mlabels6."_agr_MN-P" +drop cascades to table mlabels6."MN" NOTICE: graph "mlabels6" has been dropped drop_graph ------------ @@ -544,13 +573,13 @@ SELECT * FROM cypher('mlabels8', $$ CREATE (:a:b) $$) as (":a:b" agtype); (0 rows) SELECT * FROM mlabels8.catalog; - name | relation | allrelations | rel_kind -------------------+---------------------------+-------------------------------+---------- - _ag_label_edge | mlabels8._ag_label_edge | {mlabels8._ag_label_edge} | d - _ag_label_vertex | mlabels8._ag_label_vertex | {mlabels8._ag_label_vertex} | d - _agr_ab | mlabels8._agr_ab | {mlabels8._agr_ab} | i - a | mlabels8.a | {mlabels8.a,mlabels8._agr_ab} | s - b | mlabels8.b | {mlabels8.b,mlabels8._agr_ab} | s + name | relation | allrelations | rel_kind +------------------+---------------------------+--------------------------------------+---------- + _ag_label_edge | mlabels8._ag_label_edge | {mlabels8._ag_label_edge} | d + _ag_label_vertex | mlabels8._ag_label_vertex | {mlabels8._ag_label_vertex} | d + _agr_a-b | mlabels8."_agr_a-b" | {"mlabels8.\"_agr_a-b\""} | i + a | mlabels8.a | {mlabels8.a,"mlabels8.\"_agr_a-b\""} | s + b | mlabels8.b | {mlabels8.b,"mlabels8.\"_agr_a-b\""} | s (5 rows) -- creates :c and :bc @@ -560,15 +589,15 @@ SELECT * FROM cypher('mlabels8', $$ CREATE (:b:c) $$) as (":b:c" agtype); (0 rows) SELECT * FROM mlabels8.catalog; - name | relation | allrelations | rel_kind -------------------+---------------------------+------------------------------------------------+---------- - _ag_label_edge | mlabels8._ag_label_edge | {mlabels8._ag_label_edge} | d - _ag_label_vertex | mlabels8._ag_label_vertex | {mlabels8._ag_label_vertex} | d - _agr_ab | mlabels8._agr_ab | {mlabels8._agr_ab} | i - _agr_bc | mlabels8._agr_bc | {mlabels8._agr_bc} | i - a | mlabels8.a | {mlabels8.a,mlabels8._agr_ab} | s - b | mlabels8.b | {mlabels8.b,mlabels8._agr_ab,mlabels8._agr_bc} | s - c | mlabels8.c | {mlabels8.c,mlabels8._agr_bc} | s + name | relation | allrelations | rel_kind +------------------+---------------------------+--------------------------------------------------------------+---------- + _ag_label_edge | mlabels8._ag_label_edge | {mlabels8._ag_label_edge} | d + _ag_label_vertex | mlabels8._ag_label_vertex | {mlabels8._ag_label_vertex} | d + _agr_a-b | mlabels8."_agr_a-b" | {"mlabels8.\"_agr_a-b\""} | i + _agr_b-c | mlabels8."_agr_b-c" | {"mlabels8.\"_agr_b-c\""} | i + a | mlabels8.a | {mlabels8.a,"mlabels8.\"_agr_a-b\""} | s + b | mlabels8.b | {mlabels8.b,"mlabels8.\"_agr_a-b\"","mlabels8.\"_agr_b-c\""} | s + c | mlabels8.c | {mlabels8.c,"mlabels8.\"_agr_b-c\""} | s (7 rows) -- :a:b:c inserted in other labels' allrelations column @@ -578,16 +607,16 @@ SELECT * FROM cypher('mlabels8', $$ CREATE (:a:b:c) $$) as (":a:b:c" agtype); (0 rows) SELECT * FROM mlabels8.catalog; - name | relation | allrelations | rel_kind -------------------+---------------------------+------------------------------------------------------------------+---------- - _ag_label_edge | mlabels8._ag_label_edge | {mlabels8._ag_label_edge} | d - _ag_label_vertex | mlabels8._ag_label_vertex | {mlabels8._ag_label_vertex} | d - _agr_ab | mlabels8._agr_ab | {mlabels8._agr_ab} | i - _agr_abc | mlabels8._agr_abc | {mlabels8._agr_abc} | i - _agr_bc | mlabels8._agr_bc | {mlabels8._agr_bc} | i - a | mlabels8.a | {mlabels8.a,mlabels8._agr_ab,mlabels8._agr_abc} | s - b | mlabels8.b | {mlabels8.b,mlabels8._agr_ab,mlabels8._agr_bc,mlabels8._agr_abc} | s - c | mlabels8.c | {mlabels8.c,mlabels8._agr_bc,mlabels8._agr_abc} | s + name | relation | allrelations | rel_kind +------------------+---------------------------+----------------------------------------------------------------------------------------+---------- + _ag_label_edge | mlabels8._ag_label_edge | {mlabels8._ag_label_edge} | d + _ag_label_vertex | mlabels8._ag_label_vertex | {mlabels8._ag_label_vertex} | d + _agr_a-b | mlabels8."_agr_a-b" | {"mlabels8.\"_agr_a-b\""} | i + _agr_a-b-c | mlabels8."_agr_a-b-c" | {"mlabels8.\"_agr_a-b-c\""} | i + _agr_b-c | mlabels8."_agr_b-c" | {"mlabels8.\"_agr_b-c\""} | i + a | mlabels8.a | {mlabels8.a,"mlabels8.\"_agr_a-b\"","mlabels8.\"_agr_a-b-c\""} | s + b | mlabels8.b | {mlabels8.b,"mlabels8.\"_agr_a-b\"","mlabels8.\"_agr_b-c\"","mlabels8.\"_agr_a-b-c\""} | s + c | mlabels8.c | {mlabels8.c,"mlabels8.\"_agr_b-c\"","mlabels8.\"_agr_a-b-c\""} | s (8 rows) -- cleanup @@ -596,12 +625,12 @@ NOTICE: drop cascades to 9 other objects DETAIL: drop cascades to table mlabels8._ag_label_vertex drop cascades to table mlabels8._ag_label_edge drop cascades to view mlabels8.catalog -drop cascades to table mlabels8._agr_ab +drop cascades to table mlabels8."_agr_a-b" drop cascades to table mlabels8.a drop cascades to table mlabels8.b -drop cascades to table mlabels8._agr_bc +drop cascades to table mlabels8."_agr_b-c" drop cascades to table mlabels8.c -drop cascades to table mlabels8._agr_abc +drop cascades to table mlabels8."_agr_a-b-c" NOTICE: graph "mlabels8" has been dropped drop_graph ------------ @@ -936,7 +965,7 @@ drop cascades to table mlabels10._ag_label_edge drop cascades to table mlabels10.rel drop cascades to table mlabels10.x drop cascades to table mlabels10.a -drop cascades to table mlabels10._agr_ab +drop cascades to table mlabels10."_agr_a-b" drop cascades to table mlabels10.b drop cascades to table mlabels10.c drop cascades to table mlabels10.d @@ -981,7 +1010,7 @@ SElECT drop_graph('mlabels11', true); NOTICE: drop cascades to 5 other objects DETAIL: drop cascades to table mlabels11._ag_label_vertex drop cascades to table mlabels11._ag_label_edge -drop cascades to table mlabels11._agr_ab +drop cascades to table mlabels11."_agr_a-b" drop cascades to table mlabels11.a drop cascades to table mlabels11.b NOTICE: graph "mlabels11" has been dropped @@ -1168,17 +1197,17 @@ SElECT drop_graph('mlabels12', true); NOTICE: drop cascades to 15 other objects DETAIL: drop cascades to table mlabels12._ag_label_vertex drop cascades to table mlabels12._ag_label_edge -drop cascades to table mlabels12."_agr_PersonStudent" +drop cascades to table mlabels12."_agr_Person-Student" drop cascades to table mlabels12."Person" drop cascades to table mlabels12."Student" -drop cascades to table mlabels12."_agr_PersonTeacher" +drop cascades to table mlabels12."_agr_Person-Teacher" drop cascades to table mlabels12."Teacher" -drop cascades to table mlabels12._agr_ab +drop cascades to table mlabels12."_agr_a-b" drop cascades to table mlabels12.a drop cascades to table mlabels12.b drop cascades to table mlabels12.r drop cascades to table mlabels12.k -drop cascades to table mlabels12._agr_mn +drop cascades to table mlabels12."_agr_m-n" drop cascades to table mlabels12.m drop cascades to table mlabels12.n NOTICE: graph "mlabels12" has been dropped diff --git a/regress/sql/multiple_label.sql b/regress/sql/multiple_label.sql index 571089296..3e21b6b04 100644 --- a/regress/sql/multiple_label.sql +++ b/regress/sql/multiple_label.sql @@ -121,6 +121,11 @@ SELECT * FROM cypher('mlabels6', $$ CREATE (:c)-[:z]->() $$) as (a agtype); -- following fails SELECT * FROM cypher('mlabels6', $$ CREATE (:a:y:c) $$) as (a agtype); SELECT * FROM cypher('mlabels6', $$ CREATE ()-[:b]->() $$) as (a agtype); +-- check intersection relation separator +SELECT * FROM cypher('mlabels6', $$ MATCH (x) DETACH DELETE x $$) as (a agtype); +SELECT * FROM cypher('mlabels6', $$ CREATE (:M:N:P) $$) as (a agtype); +SELECT * FROM cypher('mlabels6', $$ CREATE (:MN:P) $$) as (a agtype); +SELECT * FROM cypher('mlabels6', $$ MATCH (x) RETURN x $$) as (a agtype); -- cleanup SElECT drop_graph('mlabels6', true); diff --git a/src/backend/commands/graph_commands.c b/src/backend/commands/graph_commands.c index cc863a5f1..c781efce2 100644 --- a/src/backend/commands/graph_commands.c +++ b/src/backend/commands/graph_commands.c @@ -105,9 +105,9 @@ Oid create_graph_internal(const Name graph_name) /* Create the default label tables */ create_label(graph_name_str, AG_DEFAULT_LABEL_VERTEX, LABEL_TYPE_VERTEX, - LABEL_REL_KIND_DEFAULT, NIL); + LABEL_REL_KIND_DEFAULT, NIL, true); create_label(graph_name_str, AG_DEFAULT_LABEL_EDGE, LABEL_TYPE_EDGE, - LABEL_REL_KIND_DEFAULT, NIL); + LABEL_REL_KIND_DEFAULT, NIL, true); return nsp_id; } diff --git a/src/backend/commands/label_commands.c b/src/backend/commands/label_commands.c index b7fb99fcc..68aba3b85 100644 --- a/src/backend/commands/label_commands.c +++ b/src/backend/commands/label_commands.c @@ -204,7 +204,7 @@ Datum create_vlabel(PG_FUNCTION_ARGS) parent = list_make1(rv); create_label(graph_name, label_name, LABEL_TYPE_VERTEX, - LABEL_REL_KIND_SINGLE, parent); + LABEL_REL_KIND_SINGLE, parent, true); ereport(NOTICE, (errmsg("VLabel \"%s\" has been created", label_name))); @@ -287,7 +287,7 @@ Datum create_elabel(PG_FUNCTION_ARGS) parent = list_make1(rv); create_label(graph_name, label_name, LABEL_TYPE_EDGE, - LABEL_REL_KIND_SINGLE, parent); + LABEL_REL_KIND_SINGLE, parent, true); ereport(NOTICE, (errmsg("ELabel \"%s\" has been created", label_name))); @@ -304,7 +304,7 @@ Datum create_elabel(PG_FUNCTION_ARGS) * accepts macros LABEL_REL_KIND_*. */ void create_label(char *graph_name, char *label_name, char label_type, - char rel_kind, List *parents) + char rel_kind, List *parents, bool check_valid_label) { graph_cache_data *cache_data; Oid graph_oid; @@ -316,7 +316,7 @@ void create_label(char *graph_name, char *label_name, char label_type, int32 label_id; Oid relation_id; - if (!is_valid_label_name(label_name, label_type)) + if (check_valid_label && !is_valid_label_name(label_name, label_type)) { ereport(ERROR, (errcode(ERRCODE_UNDEFINED_SCHEMA), errmsg("label name is invalid"))); @@ -362,7 +362,7 @@ void create_label(char *graph_name, char *label_name, char label_type, CommandCounterIncrement(); } -/* +/* * CREATE TABLE `schema_name`.`rel_name` ( * "id" graphid PRIMARY KEY DEFAULT "ag_catalog"."_graphid"(...), * "start_id" graphid NOT NULL note: only for edge labels diff --git a/src/backend/parser/cypher_label_expr.c b/src/backend/parser/cypher_label_expr.c index 0f15f2798..a526ac5ce 100644 --- a/src/backend/parser/cypher_label_expr.c +++ b/src/backend/parser/cypher_label_expr.c @@ -33,6 +33,7 @@ #include "parser/cypher_transform_entity.h" #include "utils/ag_cache.h" #include "utils/array.h" +#include "utils/name_validation.h" static void append_to_allrelations(Relation ag_label, char *label_name, char *intr_relname, Oid graphoid); @@ -80,6 +81,7 @@ RangeVar *create_label_expr_relations(Oid graphoid, char *graphname, char rel_kind; cypher_label_expr_type label_expr_type; RangeVar *rv; + ListCell *label_lc; label_expr_type = LABEL_EXPR_TYPE(label_expr); @@ -126,9 +128,30 @@ RangeVar *create_label_expr_relations(Oid graphoid, char *graphname, return rv; } - /* creates ag_label entry and relation */ + /* Verify if label names are valid */ + foreach (label_lc, label_expr->label_names) + { + char *label_name; + + label_name = strVal(lfirst(label_lc)); + + if (!is_valid_label_name(label_name, label_expr_kind)) + { + ereport(ERROR, (errcode(ERRCODE_UNDEFINED_SCHEMA), + errmsg("label name is invalid"))); + } + } + + /* + * Creates ag_label entry and relation. + * + * In case of LABEL_EXPR_TYPE_AND, ag_label_relation will be an invalid + * label name due to the separator (see label_expr_relname()). For this + * reason, check_valid_label parameter is set to false. Instead, + * validity of individual label names are verified here. + */ create_label(graphname, ag_label_relation, label_expr_kind, rel_kind, - parents); + parents, false); /* * For multiple labels (AND expression), processes each individual labels @@ -152,7 +175,7 @@ RangeVar *create_label_expr_relations(Oid graphoid, char *graphname, if (!label_exists(label_name, graphoid)) { create_label(graphname, label_name, label_expr_kind, - LABEL_REL_KIND_SINGLE, parents); + LABEL_REL_KIND_SINGLE, parents, false); } /* @@ -417,6 +440,11 @@ char *label_expr_relname(cypher_label_expr *label_expr, char label_expr_kind) { char *label_name = strVal(lfirst(lc)); appendStringInfoString(relname_strinfo, label_name); + + if (lnext(label_expr->label_names, lc)) + { + appendStringInfoChar(relname_strinfo, INTR_REL_SEPERATOR); + } } relname = relname_strinfo->data; diff --git a/src/backend/utils/load/age_load.c b/src/backend/utils/load/age_load.c index c741886aa..c2474265e 100644 --- a/src/backend/utils/load/age_load.c +++ b/src/backend/utils/load/age_load.c @@ -467,7 +467,7 @@ static int32 get_or_create_label(Oid graph_oid, char *graph_name, parent = list_make1(rv); create_label(graph_name, label_name, label_kind, - LABEL_REL_KIND_SINGLE, parent); + LABEL_REL_KIND_SINGLE, parent, true); label_id = get_label_id(label_name, graph_oid); ereport(NOTICE, diff --git a/src/include/commands/label_commands.h b/src/include/commands/label_commands.h index 9f51134da..197d5a035 100644 --- a/src/include/commands/label_commands.h +++ b/src/include/commands/label_commands.h @@ -53,7 +53,7 @@ (IS_DEFAULT_LABEL_EDGE(x) || IS_DEFAULT_LABEL_VERTEX(x)) void create_label(char *graph_name, char *label_name, char label_type, - char rel_kind, List *parents); + char rel_kind, List *parents, bool check_valid_label); Datum create_vlabel(PG_FUNCTION_ARGS); diff --git a/src/include/parser/cypher_label_expr.h b/src/include/parser/cypher_label_expr.h index f5f169e4d..f6d60aafd 100644 --- a/src/include/parser/cypher_label_expr.h +++ b/src/include/parser/cypher_label_expr.h @@ -36,6 +36,7 @@ /* Prefix for intersection relations. */ #define INTR_REL_PREFIX "_agr_" #define INTR_REL_PREFIX_LEN 5 +#define INTR_REL_SEPERATOR '-' #define LABEL_EXPR_LENGTH(label_expr) (list_length((label_expr)->label_names))