I am querying a timestamp column with datediff from current_timestamp. But it gives error.
DATEDIFF(minute, timestamp_field ,current_timestamp::TIMESTAMP)
or
DATEDIFF(minute, timestamp_field ,current_timestamp)
DataType of timestamp_field is "TIMESTAMP DEFAULT '2016-03-29 20:33:33.404256'::timestamp without time zone"
OutPut:
ERROR: Specified types or functions (one per INFO message) not supported on Redshift tables.
Warnings: Function ""timestamp"(timestamp with time zone)" not supported. Function "timestamptz(timestamp with time zone,integer)" not supported. Function "timestamptz(text)" not supported.
But following query is working if I use getdate() function
DATEDIFF(minute, timestamp_field ,getdate()::TIMESTAMP)
TIMESTAMP
Datatype – Tragedypostgresql
- especially if the function you are having problems with does not exist in Postgres – Manonselect datediff(day, getdate(), current_timestamp);
and got the following error:function pg_catalog.date_diff("unknown", timestamp without time zone, timestamp with time zone) does not exist
So I guess that current_timestamp returns a timestamp with a timezone and getdate() a timestamp without. Unfortunately this doesn't explain your error message. – Fernandina