I'm adding temporal Cypher functions to AGE, and I've implemented the date()
Cypher function. Currently, it works, and my result is printed in the output as a string.
SELECT * FROM cypher('graph', $$
RETURN date()
$$) as (date agtype);
date
--------------
"13-08-2023"
(1 row)
However, I'm concerned that functions like this may by used in SQL expressions.
SELECT t.name FROM employees AS t
WHERE t.created_date > (
SELECT a FROM cypher('graph_name', $$
RETURN date()
$$) as (created agtype) - 7); -- Created at least 7 days ago.
But PostgreSQL would treat them as strings instead of dates.
Will a new return type, agtype_value_type.AGTV_DATE
, need to be created? Or is it possible to work with strings which could be cast to PostgreSQL's date
type?