Re: Interval FAQ - please review - Mailing list pgsql-sql

From Peter Eisentraut
Subject Re: Interval FAQ - please review
Date
Msg-id Pine.LNX.4.30.0108170004110.677-100000@peter.localdomain
Whole thread Raw
In response to Interval FAQ - please review  ("Josh Berkus" <josh@agliodbs.com>)
List pgsql-sql
Josh Berkus writes:

> 1. The difference between two TIMESTAMPs is always an INTERVAL
>     '1999-12-30'::TIMESTAMP - '1999-12-11'::TIMESTAMP = '19 days'::INTERVAL
> 2. You may add or subtract an INTERVAL to a TIMESTAMP to produce another
> TIMESTAMP:
>     '1999-12-11'::TIMESTAMP + '19 days'::INTERVAL = '1999-12-30'::TIMESTAMP
> 3. You may add or subtract two INTERVALS:
>     '1 month'::INTERVAL + '1 month 3 days'::INTERVAL = '2 months 3 days'
> INTERVAL

You should probably use the correct literal syntax here, e.g., TIMESTAMP
'1999-12-30' and INTERVAL '3 days'.

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter



pgsql-sql by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: Nested JOINs
Next
From: Tom Lane
Date:
Subject: Re: Nested JOINs