Piglet,
That's an interesting question. To be honest, I thought the function did keep the time. Anyway, if you describe the function in vsql, you will see that the data type returned is DATE which in Vertica does not include time...
Code: Select all
dbadmin=> \df add_months
List of functions
procedure_name | procedure_return_type | procedure_argument_types
----------------+-----------------------+--------------------------
add_months | Date | Timestamp, Integer
(1 row)
Maybe you can try appending the time and converting the string to a timestamp? Like this?
Code: Select all
dbadmin=> SELECT now(),
dbadmin-> add_months(now(), 1),
dbadmin-> TO_CHAR(add_months(now(),1) || TO_CHAR(now(), ' HH24:MI:SS.FFTZH'))::TIMESTAMP WITH TIMEZONE with_time;
now | add_months | with_time
-------------------------------+------------+-------------------------------
2015-06-18 14:35:51.644416-04 | 2015-07-18 | 2015-07-18 14:35:51.644416-04
(1 row)