Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions regress/expected/agtype.out
Original file line number Diff line number Diff line change
Expand Up @@ -3779,6 +3779,31 @@ SELECT ag_catalog.agtype_volatile_wrapper(-32767::int2);
-32767
(1 row)

-- TID is packed as BlockNumber << 16 | OffsetNumber for hidden ctid transport.
SELECT ag_catalog.agtype_volatile_wrapper('(0,1)'::tid);
agtype_volatile_wrapper
-------------------------
1
(1 row)

SELECT ag_catalog.agtype_volatile_wrapper('(42,7)'::tid);
agtype_volatile_wrapper
-------------------------
2752519
(1 row)

SELECT ag_catalog.agtype_volatile_wrapper('(65535,65535)'::tid);
agtype_volatile_wrapper
-------------------------
4294967295
(1 row)

SELECT ag_catalog.agtype_volatile_wrapper('(4294967294,65535)'::tid);
agtype_volatile_wrapper
-------------------------
281474976645119
(1 row)

-- These should fail
SELECT ag_catalog.agtype_volatile_wrapper(32768::int2);
ERROR: smallint out of range
Expand Down
63 changes: 62 additions & 1 deletion regress/expected/cypher_delete.out
Original file line number Diff line number Diff line change
Expand Up @@ -812,15 +812,76 @@ SELECT id as "expected: 0 rows" FROM setdelete._ag_label_edge;
------------------
(0 rows)

-- stale ctid fallback - SET one alias, then DELETE the same entity via another alias.
SELECT * FROM cypher('setdelete', $$ CREATE (:B) $$) as ("CREATE" agtype);
CREATE
--------
(0 rows)

SELECT * FROM cypher('setdelete', $$ MATCH (n:B), (m:B) WHERE id(n) = id(m) SET n.flag = true DELETE m $$) as ("SET + DELETE alias" agtype);
SET + DELETE alias
--------------------
(0 rows)

SELECT count(*) as "expected: 0 rows" FROM setdelete."B";
expected: 0 rows
------------------
0
(1 row)

-- hidden ctid propagation through WITH.
SELECT * FROM cypher('setdelete', $$ CREATE (:C) $$) as ("CREATE" agtype);
CREATE
--------
(0 rows)

SELECT * FROM cypher('setdelete', $$ MATCH (n:C) WITH n DELETE n $$) as ("WITH DELETE" agtype);
WITH DELETE
-------------
(0 rows)

SELECT count(*) as "expected: 0 rows" FROM setdelete."C";
expected: 0 rows
------------------
0
(1 row)

-- stale edge ctid fallback with DETACH DELETE through another alias.
SELECT * FROM cypher('setdelete', $$ CREATE (:D)-[:de]->(:D) $$) AS ("CREATE" agtype);
CREATE
--------
(0 rows)

SELECT * FROM cypher('setdelete', $$ MATCH (n)-[e:de]->(m), (x)-[f:de]->(y) WHERE id(e) = id(f) SET e.i = 1 DETACH DELETE x $$) AS ("SET + DETACH alias" agtype);
SET + DETACH alias
--------------------
(0 rows)

SELECT count(*) as "expected: 1 row" FROM setdelete."D";
expected: 1 row
-----------------
1
(1 row)

SELECT count(*) as "expected: 0 rows" FROM setdelete.de;
expected: 0 rows
------------------
0
(1 row)

-- clean up
SELECT drop_graph('setdelete', true);
NOTICE: drop cascades to 6 other objects
NOTICE: drop cascades to 10 other objects
DETAIL: drop cascades to table setdelete._ag_label_vertex
drop cascades to table setdelete._ag_label_edge
drop cascades to table setdelete."A"
drop cascades to table setdelete.n
drop cascades to table setdelete.e
drop cascades to table setdelete.m
drop cascades to table setdelete."B"
drop cascades to table setdelete."C"
drop cascades to table setdelete."D"
drop cascades to table setdelete.de
NOTICE: graph "setdelete" has been dropped
drop_graph
------------
Expand Down
43 changes: 42 additions & 1 deletion regress/expected/cypher_remove.out
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,45 @@ SELECT * FROM cypher('cypher_remove', $$MATCH ()-[e:edge_multi_property]-() REMO
{"id": 3659174697238529, "label": "edge_multi_property", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {}}::edge
(2 rows)

-- Hidden ctid columns must propagate through WITH for REMOVE.
SELECT * FROM cypher('cypher_remove', $$
CREATE (:ctid_remove {drop_me: 1})
$$) AS (a agtype);
a
---
(0 rows)

SELECT * FROM cypher('cypher_remove', $$
MATCH (n:ctid_remove)
WITH n
REMOVE n.drop_me
RETURN n
$$) AS (a agtype);
a
----------------------------------------------------------------------------
{"id": 3940649673949185, "label": "ctid_remove", "properties": {}}::vertex
(1 row)

-- REMOVE must fall back from a stale ctid after an earlier SET moves the row.
SELECT * FROM cypher('cypher_remove', $$
CREATE (:ctid_remove_stale {drop_me: 1})
$$) AS (a agtype);
a
---
(0 rows)

SELECT * FROM cypher('cypher_remove', $$
MATCH (n:ctid_remove_stale), (m:ctid_remove_stale)
WHERE id(n) = id(m)
SET n.changed = true
REMOVE m.drop_me
RETURN m
$$) AS (a agtype);
a
-------------------------------------------------------------------------------------------------
{"id": 4222124650659841, "label": "ctid_remove_stale", "properties": {"changed": true}}::vertex
(1 row)

--Errors
SELECT * FROM cypher('cypher_remove', $$REMOVE n.i$$) AS (a agtype);
ERROR: REMOVE cannot be the first clause in a Cypher query
Expand All @@ -475,7 +514,7 @@ LINE 1: SELECT * FROM cypher('cypher_remove', $$MATCH (n) REMOVE wro...
--
DROP FUNCTION remove_test;
SELECT drop_graph('cypher_remove', true);
NOTICE: drop cascades to 13 other objects
NOTICE: drop cascades to 15 other objects
DETAIL: drop cascades to table cypher_remove._ag_label_vertex
drop cascades to table cypher_remove._ag_label_edge
drop cascades to table cypher_remove.test_1
Expand All @@ -489,6 +528,8 @@ drop cascades to table cypher_remove.test_6
drop cascades to table cypher_remove.e
drop cascades to table cypher_remove.test_7
drop cascades to table cypher_remove.edge_multi_property
drop cascades to table cypher_remove.ctid_remove
drop cascades to table cypher_remove.ctid_remove_stale
NOTICE: graph "cypher_remove" has been dropped
drop_graph
------------
Expand Down
Loading