Implemented age_tail function#1013
Conversation
Added the age_tail() function, which returns a list containing all the elements, excluding the first one, from a list. It is essentially the same function that openCypher has: https://neo4j.com/docs/cypher-manual/current/functions/list/#functions-tail
regress/expected/expr.out
Outdated
|
|
||
| -- should throw errors | ||
| SELECT * FROM cypher('for_tail', $$ RETURN tail(123) $$) AS (tail agtype); | ||
| ERROR: graph "for_tail" does not exist |
There was a problem hiding this comment.
Is it the error we are expecting?
There was a problem hiding this comment.
It was not, because of the wrong name for the graph. Fixed with the new commit.
| agis_result.res = push_agtype_value(&agis_result.parse_state, | ||
| WAGT_END_ARRAY, NULL); | ||
|
|
||
| PG_RETURN_POINTER(agtype_value_to_agtype(agis_result.res)); |
There was a problem hiding this comment.
Should we free the agtype_value from the memory (i.e. using pfree_agtype_value), since we are not returning it?
There was a problem hiding this comment.
I believe at the time I created this PR we did not have the pfree_agtype_value() function, at least not in utils/adt/agtype_util.c. I will execute the git pull command and then git rebase so that the branch is updated and then make the necessary modifications. I hope you don't mind me asking, but pfree_agtype_value() should be called with which argument?
There was a problem hiding this comment.
I think @rafsun42 might be referring to agis_result.res but that would mean assigning a variable the return value of agtype_value_to_agtype and returning that.
There was a problem hiding this comment.
Ook! I did that and it seems to work fine, but I just had to do it on another branch because I ended up making a mess of a code after git rebase. Is it okay if I create another PR and close this one? Sorry for this.
There was a problem hiding this comment.
@MatheusFarias03 If that is the only way, then you don't have an option.
There was a problem hiding this comment.
Here's the updated PR with all the necessary fixes: #1272
|
I have added some curly braces in the if statements. |
jrgemignani
left a comment
There was a problem hiding this comment.
Pending @rafsun42 question resolution.
|
Closing this PR - There's an updated PR that fixes everything. |
Added the age_tail() function, which returns a list containing all the elements, excluding the first one, from a list. It is essentially the same function that openCypher has: https://neo4j.com/docs/cypher-manual/current/functions/list/#functions-tail