Skip to content

Commit 1251096

Browse files
Reimplement list comprehension (#2169)
* Revert "Fix issue 1955 - List comprehension in WHERE clause (#2094)" This reverts commit 0f0d9be. * Revert "Fix error using list comprehension with WITH * (#1838)" This reverts commit 5e08a2f. * Revert "Fix shift/reduce conflict in grammar (#1719)" This reverts commit fab3119. * Revert "Implement list comprehension (#1610)" This reverts commit 3b2b394. * Reimplement list comprehension - Reimplement list comprehension to use ARRAY sublinks. - Some test results were not correct. All the test results that are modified are correct and are verified with neo4j. - Also resolves the issue of using list comprehension in MERGE clause (1611) and issue 1850 * Add expression tree walkers for cypher nodes - Added cypher_raw_expr_tree_walker and cypher_expr_tree_walker, based on Postgres's raw_expression_tree_walker and expression_tree_walker. These follow the same walker API as Postgres and add support for Cypher-specific nodes. - Also added the agtype[] to agtype func and typecast to 1.5.0-y.y.y.sql - Simplifies logic for cypher_subquery handling in where clause. - Fixes a crash when list comprehension in the WHERE clause references a variable from the preceding MATCH clause.
1 parent 3f873e3 commit 1251096

21 files changed

+578
-960
lines changed

age--1.5.0--y.y.y.sql

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,15 @@ PARALLEL SAFE
137137
AS 'MODULE_PATHNAME';
138138

139139
CREATE CAST (agtype AS json)
140-
WITH FUNCTION ag_catalog.agtype_to_json(agtype);
140+
WITH FUNCTION ag_catalog.agtype_to_json(agtype);
141+
142+
CREATE FUNCTION ag_catalog.agtype_array_to_agtype(agtype[])
143+
RETURNS agtype
144+
LANGUAGE c
145+
IMMUTABLE
146+
RETURNS NULL ON NULL INPUT
147+
PARALLEL SAFE
148+
AS 'MODULE_PATHNAME';
149+
150+
CREATE CAST (agtype[] AS agtype)
151+
WITH FUNCTION ag_catalog.agtype_array_to_agtype(agtype[]);

regress/expected/list_comprehension.out

Lines changed: 79 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -166,45 +166,50 @@ SELECT * FROM cypher('list_comprehension', $$ MATCH p=(u) RETURN [i IN range(0,
166166
SELECT * FROM cypher('list_comprehension', $$ MATCH (u) RETURN [i IN u.list] $$) AS (result agtype);
167167
result
168168
-------------------------
169+
[0, 2, 4, 6, 8, 10, 12]
169170
[1, 3, 5, 7, 9, 11, 13]
170171
[]
171-
[0, 2, 4, 6, 8, 10, 12]
172172
(3 rows)
173173

174174
SELECT * FROM cypher('list_comprehension', $$ MATCH (u) RETURN [i IN u.list WHERE i % 3 = 0] $$) AS (result agtype);
175175
result
176176
------------
177177
[0, 6, 12]
178178
[3, 9]
179-
(2 rows)
179+
[]
180+
(3 rows)
180181

181182
SELECT * FROM cypher('list_comprehension', $$ MATCH (u) RETURN [i IN u.list WHERE i % 3 = 0 | i/3] $$) AS (result agtype);
182183
result
183184
-----------
184185
[0, 2, 4]
185186
[1, 3]
186-
(2 rows)
187+
[]
188+
(3 rows)
187189

188190
SELECT * FROM cypher('list_comprehension', $$ MATCH (u) RETURN [i IN u.list WHERE i % 3 = 0 | i/3][1] $$) AS (result agtype);
189191
result
190192
--------
191193
2
192194
3
193-
(2 rows)
195+
196+
(3 rows)
194197

195198
SELECT * FROM cypher('list_comprehension', $$ MATCH (u) RETURN [i IN u.list WHERE i % 3 = 0 | i/3][0..2] $$) AS (result agtype);
196199
result
197200
--------
198201
[0, 2]
199202
[1, 3]
200-
(2 rows)
203+
[]
204+
(3 rows)
201205

202206
SELECT * FROM cypher('list_comprehension', $$ MATCH (u) RETURN [i IN u.list WHERE i % 3 = 0 | i/3][0..2][1] $$) AS (result agtype);
203207
result
204208
--------
205209
2
206210
3
207-
(2 rows)
211+
212+
(3 rows)
208213

209214
-- Nested cases
210215
SELECT * FROM cypher('list_comprehension', $$ RETURN [i IN [i IN [1,2,3]]] $$) AS (result agtype);
@@ -299,9 +304,9 @@ SELECT * FROM cypher('list_comprehension', $$ MATCH (u) WHERE u.list@>[i IN rang
299304
SELECT * FROM cypher('list_comprehension', $$ MATCH (u) MATCH (v) WHERE v.list=[i IN u.list] RETURN v $$) AS (result agtype);
300305
result
301306
-----------------------------------------------------------------------------------------------
302-
{"id": 281474976710659, "label": "", "properties": {"list": []}}::vertex
303307
{"id": 281474976710657, "label": "", "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex
304308
{"id": 281474976710658, "label": "", "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex
309+
{"id": 281474976710659, "label": "", "properties": {"list": []}}::vertex
305310
(3 rows)
306311

307312
SELECT * FROM cypher('list_comprehension', $$ MATCH (u {list:[i IN range(0,12,2)]}) RETURN u $$) AS (result agtype);
@@ -330,11 +335,11 @@ SELECT * FROM cypher('list_comprehension', $$ MATCH (u {list:[i IN range(1,13,2)
330335
SELECT * FROM cypher('list_comprehension', $$ MATCH (u) MATCH (v {list:[i IN u.list]}) RETURN v $$) AS (result agtype);
331336
result
332337
-----------------------------------------------------------------------------------------------
333-
{"id": 281474976710658, "label": "", "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex
334338
{"id": 281474976710657, "label": "", "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex
335-
{"id": 281474976710659, "label": "", "properties": {"list": []}}::vertex
339+
{"id": 281474976710658, "label": "", "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex
336340
{"id": 281474976710657, "label": "", "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex
337341
{"id": 281474976710658, "label": "", "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex
342+
{"id": 281474976710659, "label": "", "properties": {"list": []}}::vertex
338343
(5 rows)
339344

340345
SELECT * FROM cypher('list_comprehension', $$ CREATE (u {list:[i IN range(12,24,2)]}) RETURN u $$) AS (result agtype);
@@ -371,26 +376,26 @@ SELECT * FROM cypher('list_comprehension', $$ MATCH(u) WITH u WHERE u.list = [u
371376
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);
372377
u
373378
-----------------------------------------------------------------------------------------------
374-
{"id": 281474976710659, "label": "", "properties": {"list": []}}::vertex
375379
{"id": 281474976710657, "label": "", "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex
380+
{"id": 281474976710659, "label": "", "properties": {"list": []}}::vertex
376381
(2 rows)
377382

378383
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);
379384
u
380385
--------------------------------------------------------------------------------------------------------
386+
{"id": 281474976710657, "label": "", "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex
381387
{"id": 281474976710658, "label": "", "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex
382-
{"id": 281474976710661, "label": "", "properties": {"list": [6, 8, 10, 12]}}::vertex
383388
{"id": 281474976710660, "label": "", "properties": {"list": [12, 14, 16, 18, 20, 22, 24]}}::vertex
389+
{"id": 281474976710661, "label": "", "properties": {"list": [6, 8, 10, 12]}}::vertex
384390
{"id": 281474976710662, "label": "", "properties": {"list": [25.0, 49.0, 81.0, 121.0, 169.0]}}::vertex
385-
{"id": 281474976710657, "label": "", "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex
386391
{"id": 281474976710663, "label": "", "properties": {"list": [1, 2, 3]}}::vertex
387392
(6 rows)
388393

389394
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);
390395
u
391396
-----------------------------------------------------------------------------------------------
392-
{"id": 281474976710659, "label": "", "properties": {"list": []}}::vertex
393397
{"id": 281474976710657, "label": "", "properties": {"list": [0, 2, 4, 6, 8, 10, 12]}}::vertex
398+
{"id": 281474976710659, "label": "", "properties": {"list": []}}::vertex
394399
(2 rows)
395400

396401
SELECT * FROM cypher('list_comprehension', $$ CREATE(u:csm_match {list: ['abc', 'def', 'ghi']}) $$) AS (u agtype);
@@ -473,9 +478,6 @@ SELECT * FROM cypher('list_comprehension', $$ MATCH(u {list: [0, 2, 4, 6, 8, 10,
473478
ERROR: Invalid use of aggregation in this context
474479
LINE 1: ..., $$ MATCH(u {list: [0, 2, 4, 6, 8, 10, 12]}) SET u.c = coll...
475480
^
476-
-- Known issue
477-
SELECT * FROM cypher('list_comprehension', $$ MERGE (u {list:[i IN [1,2,3]]}) RETURN u $$) AS (result agtype);
478-
ERROR: Aggref found in non-Agg plan node
479481
-- List comprehension variable scoping
480482
SELECT * FROM cypher('list_comprehension', $$ WITH 1 AS m, [m IN [1, 2, 3]] AS n RETURN [m IN [1, 2, 3]] $$) AS (result agtype);
481483
result
@@ -622,24 +624,25 @@ SELECT * FROM cypher('list_comprehension', $$ MATCH (u) WHERE u.list=[i IN u.lis
622624
result
623625
---------------------------------------------------------------------------------------------------------------------------------------------------------------
624626
{"id": 281474976710658, "label": "", "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex
627+
{"id": 281474976710659, "label": "", "properties": {"list": []}}::vertex
625628
{"id": 281474976710660, "label": "", "properties": {"list": [12, 14, 16, 18, 20, 22, 24]}}::vertex
629+
{"id": 281474976710661, "label": "", "properties": {"list": [6, 8, 10, 12]}}::vertex
626630
{"id": 281474976710662, "label": "", "properties": {"list": [25.0, 49.0, 81.0, 121.0, 169.0]}}::vertex
627-
{"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
628631
{"id": 281474976710663, "label": "", "properties": {"list": [1, 2, 3]}}::vertex
629-
{"id": 281474976710659, "label": "", "properties": {"list": []}}::vertex
630-
{"id": 281474976710661, "label": "", "properties": {"list": [6, 8, 10, 12]}}::vertex
632+
{"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
631633
{"id": 844424930131969, "label": "csm_match", "properties": {"list": ["abc", "def", "ghi"]}}::vertex
632634
(8 rows)
633635

634636
SELECT * FROM cypher('list_comprehension', $$ MATCH (u) WHERE u.list=[i IN u.list WHERE i>0] RETURN u $$) AS (result agtype);
635637
result
636638
--------------------------------------------------------------------------------------------------------
637639
{"id": 281474976710658, "label": "", "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex
640+
{"id": 281474976710659, "label": "", "properties": {"list": []}}::vertex
638641
{"id": 281474976710660, "label": "", "properties": {"list": [12, 14, 16, 18, 20, 22, 24]}}::vertex
642+
{"id": 281474976710661, "label": "", "properties": {"list": [6, 8, 10, 12]}}::vertex
639643
{"id": 281474976710662, "label": "", "properties": {"list": [25.0, 49.0, 81.0, 121.0, 169.0]}}::vertex
640644
{"id": 281474976710663, "label": "", "properties": {"list": [1, 2, 3]}}::vertex
641-
{"id": 281474976710661, "label": "", "properties": {"list": [6, 8, 10, 12]}}::vertex
642-
(5 rows)
645+
(6 rows)
643646

644647
SELECT * FROM cypher('list_comprehension', $$ MATCH (u) WHERE size([e in u.list where e starts with "a"])>0 RETURN u $$) AS (result agtype);
645648
result
@@ -657,11 +660,64 @@ SELECT * FROM cypher('list_comprehension', $$ MATCH (u ={list:[i IN u.list WHERE
657660
result
658661
--------------------------------------------------------------------------------------------------------
659662
{"id": 281474976710658, "label": "", "properties": {"list": [1, 3, 5, 7, 9, 11, 13]}}::vertex
663+
{"id": 281474976710659, "label": "", "properties": {"list": []}}::vertex
660664
{"id": 281474976710660, "label": "", "properties": {"list": [12, 14, 16, 18, 20, 22, 24]}}::vertex
665+
{"id": 281474976710661, "label": "", "properties": {"list": [6, 8, 10, 12]}}::vertex
661666
{"id": 281474976710662, "label": "", "properties": {"list": [25.0, 49.0, 81.0, 121.0, 169.0]}}::vertex
662667
{"id": 281474976710663, "label": "", "properties": {"list": [1, 2, 3]}}::vertex
663-
{"id": 281474976710661, "label": "", "properties": {"list": [6, 8, 10, 12]}}::vertex
664-
(5 rows)
668+
(6 rows)
669+
670+
-- List comprehension in MERGE
671+
SELECT * FROM cypher('list_comprehension', $$ MERGE (u {list:[i IN [1,2,3]]}) RETURN u $$) AS (result agtype);
672+
result
673+
---------------------------------------------------------------------------------
674+
{"id": 281474976710663, "label": "", "properties": {"list": [1, 2, 3]}}::vertex
675+
(1 row)
676+
677+
SELECT * FROM cypher('list_comprehension', $$ MERGE (u ={list:[i IN [1,2,3] WHERE i>1]}) RETURN u $$) AS (result agtype);
678+
result
679+
------------------------------------------------------------------------------
680+
{"id": 281474976710666, "label": "", "properties": {"list": [2, 3]}}::vertex
681+
(1 row)
682+
683+
SELECT * FROM cypher('list_comprehension', $$ MERGE (u ={list:[i IN [1,2,3] WHERE i>1 | i^2]}) RETURN u $$) AS (result agtype);
684+
result
685+
----------------------------------------------------------------------------------
686+
{"id": 281474976710667, "label": "", "properties": {"list": [4.0, 9.0]}}::vertex
687+
(1 row)
688+
689+
-- Issue 1850
690+
SELECT * FROM cypher('list_comprehension', $$ CREATE (u {list: [0, 2, 4, 6, 8, 10, 12]}) $$) AS (result agtype);
691+
result
692+
--------
693+
(0 rows)
694+
695+
SELECT * FROM cypher('list_comprehension', $$ WITH [1, 2, 3] AS u UNWIND collect(u) AS v RETURN v $$) AS (result agtype);
696+
ERROR: Invalid use of aggregation in this context
697+
LINE 1: ...ist_comprehension', $$ WITH [1, 2, 3] AS u UNWIND collect(u)...
698+
^
699+
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 (result agtype);
700+
result
701+
---------------------------------------------------------------------------------------------------------------------------------------------------------------
702+
{"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
703+
{"id": 281474976710668, "label": "", "properties": {"b": [0, 1, 2, 3, 4, 5], "c": [0, 2, 4, 6, 8, 10, 12], "list": [0, 2, 4, 6, 8, 10, 12]}}::vertex
704+
(2 rows)
705+
706+
SELECT * FROM cypher('list_comprehension', $$ MATCH (u {list: [0, 2, 4, 6, 8, 10, 12]}) SET u.c = collect(u.list) RETURN u $$) AS (u agtype);
707+
ERROR: Invalid use of aggregation in this context
708+
LINE 1: ... $$ MATCH (u {list: [0, 2, 4, 6, 8, 10, 12]}) SET u.c = coll...
709+
^
710+
SELECT * FROM cypher('list_comprehension', $$ MATCH (u {list: [0, 2, 4, 6, 8, 10, 12]}) WHERE u.list = [u IN [1, u]] RETURN u $$) AS (u agtype);
711+
u
712+
---
713+
(0 rows)
714+
715+
SELECT * FROM cypher('list_comprehension', $$ MATCH (u {list: [0, 2, 4, 6, 8, 10, 12]}) WHERE u.list IN [u IN [1, u.list]] RETURN u $$) AS (u agtype);
716+
u
717+
---------------------------------------------------------------------------------------------------------------------------------------------------------------
718+
{"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
719+
{"id": 281474976710668, "label": "", "properties": {"b": [0, 1, 2, 3, 4, 5], "c": [0, 2, 4, 6, 8, 10, 12], "list": [0, 2, 4, 6, 8, 10, 12]}}::vertex
720+
(2 rows)
665721

666722
-- Clean up
667723
SELECT * FROM drop_graph('list_comprehension', true);

regress/sql/list_comprehension.sql

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,6 @@ SELECT * FROM cypher('list_comprehension', $$ MATCH(u {list: [0, 2, 4, 6, 8, 10,
117117
-- invalid use of aggregation in SET
118118
SELECT * FROM cypher('list_comprehension', $$ MATCH(u {list: [0, 2, 4, 6, 8, 10, 12]}) SET u.c = collect(u.list) RETURN u $$) AS (u agtype);
119119

120-
-- Known issue
121-
SELECT * FROM cypher('list_comprehension', $$ MERGE (u {list:[i IN [1,2,3]]}) RETURN u $$) AS (result agtype);
122-
123120
-- List comprehension variable scoping
124121
SELECT * FROM cypher('list_comprehension', $$ WITH 1 AS m, [m IN [1, 2, 3]] AS n RETURN [m IN [1, 2, 3]] $$) AS (result agtype);
125122
SELECT * FROM cypher('list_comprehension', $$ WITH 1 AS m RETURN [m IN [1, 2, 3]], m $$) AS (result agtype, result2 agtype);
@@ -164,5 +161,18 @@ SELECT * FROM cypher('list_comprehension', $$ MATCH (u) WHERE size([e in u.list
164161
SELECT * FROM cypher('list_comprehension', $$ MATCH (u ={list:[i IN u.list | i+1]}) RETURN u $$) AS (result agtype);
165162
SELECT * FROM cypher('list_comprehension', $$ MATCH (u ={list:[i IN u.list WHERE i>0]}) RETURN u$$) AS (result agtype);
166163

164+
-- List comprehension in MERGE
165+
SELECT * FROM cypher('list_comprehension', $$ MERGE (u {list:[i IN [1,2,3]]}) RETURN u $$) AS (result agtype);
166+
SELECT * FROM cypher('list_comprehension', $$ MERGE (u ={list:[i IN [1,2,3] WHERE i>1]}) RETURN u $$) AS (result agtype);
167+
SELECT * FROM cypher('list_comprehension', $$ MERGE (u ={list:[i IN [1,2,3] WHERE i>1 | i^2]}) RETURN u $$) AS (result agtype);
168+
169+
-- Issue 1850
170+
SELECT * FROM cypher('list_comprehension', $$ CREATE (u {list: [0, 2, 4, 6, 8, 10, 12]}) $$) AS (result agtype);
171+
SELECT * FROM cypher('list_comprehension', $$ WITH [1, 2, 3] AS u UNWIND collect(u) AS v RETURN v $$) AS (result agtype);
172+
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 (result agtype);
173+
SELECT * FROM cypher('list_comprehension', $$ MATCH (u {list: [0, 2, 4, 6, 8, 10, 12]}) SET u.c = collect(u.list) RETURN u $$) AS (u agtype);
174+
SELECT * FROM cypher('list_comprehension', $$ MATCH (u {list: [0, 2, 4, 6, 8, 10, 12]}) WHERE u.list = [u IN [1, u]] RETURN u $$) AS (u agtype);
175+
SELECT * FROM cypher('list_comprehension', $$ MATCH (u {list: [0, 2, 4, 6, 8, 10, 12]}) WHERE u.list IN [u IN [1, u.list]] RETURN u $$) AS (u agtype);
176+
167177
-- Clean up
168178
SELECT * FROM drop_graph('list_comprehension', true);

sql/agtype_coercions.sql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,14 @@ AS 'MODULE_PATHNAME';
173173

174174
CREATE CAST (agtype AS json)
175175
WITH FUNCTION ag_catalog.agtype_to_json(agtype);
176+
177+
CREATE FUNCTION ag_catalog.agtype_array_to_agtype(agtype[])
178+
RETURNS agtype
179+
LANGUAGE c
180+
IMMUTABLE
181+
RETURNS NULL ON NULL INPUT
182+
PARALLEL SAFE
183+
AS 'MODULE_PATHNAME';
184+
185+
CREATE CAST (agtype[] AS agtype)
186+
WITH FUNCTION ag_catalog.agtype_array_to_agtype(agtype[]);

sql/agtype_typecast.sql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,7 @@ CREATE FUNCTION ag_catalog.age_range(variadic "any")
181181
PARALLEL SAFE
182182
AS 'MODULE_PATHNAME';
183183

184-
CREATE FUNCTION ag_catalog.age_unnest(agtype,
185-
list_comprehension boolean = false)
184+
CREATE FUNCTION ag_catalog.age_unnest(agtype)
186185
RETURNS SETOF agtype
187186
LANGUAGE c
188187
IMMUTABLE

src/backend/nodes/ag_nodes.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const char *node_names[] = {
4848
"cypher_map_projection",
4949
"cypher_map_projection_element",
5050
"cypher_list",
51+
"cypher_list_comprehension",
5152
"cypher_comparison_aexpr",
5253
"cypher_comparison_boolexpr",
5354
"cypher_string_match",
@@ -115,6 +116,7 @@ const ExtensibleNodeMethods node_methods[] = {
115116
DEFINE_NODE_METHODS(cypher_map),
116117
DEFINE_NODE_METHODS(cypher_map_projection),
117118
DEFINE_NODE_METHODS(cypher_list),
119+
DEFINE_NODE_METHODS(cypher_list_comprehension),
118120
DEFINE_NODE_METHODS(cypher_comparison_aexpr),
119121
DEFINE_NODE_METHODS(cypher_comparison_boolexpr),
120122
DEFINE_NODE_METHODS(cypher_string_match),

src/backend/nodes/cypher_outfuncs.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ void out_cypher_with(StringInfo str, const ExtensibleNode *node)
117117
DEFINE_AG_NODE(cypher_with);
118118

119119
WRITE_BOOL_FIELD(distinct);
120-
WRITE_BOOL_FIELD(subquery_intermediate);
121120
WRITE_NODE_FIELD(items);
122121
WRITE_NODE_FIELD(order_by);
123122
WRITE_NODE_FIELD(skip);
@@ -176,9 +175,20 @@ void out_cypher_unwind(StringInfo str, const ExtensibleNode *node)
176175
DEFINE_AG_NODE(cypher_unwind);
177176

178177
WRITE_NODE_FIELD(target);
179-
WRITE_NODE_FIELD(collect);
180178
}
181179

180+
/* serialization function for the cypher_list_comprehension ExtensibleNode. */
181+
void out_cypher_list_comprehension(StringInfo str, const ExtensibleNode *node)
182+
{
183+
DEFINE_AG_NODE(cypher_list_comprehension);
184+
185+
WRITE_STRING_FIELD(varname);
186+
WRITE_NODE_FIELD(expr);
187+
WRITE_NODE_FIELD(where);
188+
WRITE_NODE_FIELD(mapping_expr);
189+
}
190+
191+
182192
/* serialization function for the cypher_delete ExtensibleNode. */
183193
void out_cypher_merge(StringInfo str, const ExtensibleNode *node)
184194
{

0 commit comments

Comments
 (0)