Reputation: 7260
I want to add the QUARTER
to the TIMESTAMP
in PostgreSQL 9.3 version.
For adding:
SELECT TIMESTAMP '2016-01-01' + INTERVAL '01 QUARTER';
For remove:
SELECT TIMESTAMP '2016-01-01' - INTERVAL '01 QUARTER';
********** Error ********** ERROR: invalid input syntax for type interval: "01 QUARTER" SQL state: 22007 Character: 42
Upvotes: 5
Views: 4210
Reputation: 658032
That's because is not among supported units for quarter
interval
input. The manual:
unit is
microsecond
,millisecond
,second
,minute
,hour
,day
,week
,month
,year
,decade
,century
,millennium
, orabbreviations
or plurals of these units;
Use '3 month'
(or similar) instead:
SELECT timestamp '2016-01-01' + interval '3 month';
Upvotes: 10