crprashant commented on code in PR #2412:
URL: https://github.com/apache/age/pull/2412#discussion_r3384894643


##########
regress/sql/expr.sql:
##########
@@ -3739,3 +3739,45 @@ SELECT * FROM drop_graph('list', true);
 --
 -- End of tests
 --
+
+--
+-- Issue 2391 - map literals must preserve keys whose values are null

Review Comment:
   Good catch - I've moved the -- End of tests marker to the actual end of the 
file, after the Issue 2391 regression block, so it no longer implies the script 
terminates early. Fixed in c1a3cba9.



##########
regress/sql/expr.sql:
##########
@@ -3739,3 +3739,45 @@ SELECT * FROM drop_graph('list', true);
 --
 -- End of tests
 --
+
+--
+-- Issue 2391 - map literals must preserve keys whose values are null
+--
+SELECT create_graph('issue_2391');
+-- single-key null
+SELECT * FROM cypher('issue_2391', $$
+  RETURN {a: null} AS m
+$$) AS (m agtype);
+-- multiple null values
+SELECT * FROM cypher('issue_2391', $$
+  RETURN {companyName: null, sinceYear: null} AS m
+$$) AS (m agtype);
+-- keys() must see the null-valued key
+SELECT * FROM cypher('issue_2391', $$
+  RETURN keys({a: null}) AS ks
+$$) AS (ks agtype);
+-- coalesce passes a non-null map (map itself is not null) through
+SELECT * FROM cypher('issue_2391', $$
+  RETURN coalesce({a: null}, null) AS m
+$$) AS (m agtype);
+-- nested map values inside an expression also preserve nulls
+SELECT * FROM cypher('issue_2391', $$
+  RETURN {outer: {inner: null, kept: 1}} AS m
+$$) AS (m agtype);
+-- mixed non-null and null values are all preserved in order

Review Comment:
   Agreed - map key order isn't guaranteed and isn't what this test asserts. 
I've dropped the misleading `in order` wording from the comment (it now reads 
`mixed non-null and null values are all preserved`). Fixed in c1a3cba9.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to