Re: adding years to a date field

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: adding years to a date field
Date: 2011-04-06 20:18:40
Message-ID: 4D9CCAA0.1060105@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 04/06/2011 12:28 PM, John R Pierce wrote:
> On 04/06/11 9:10 AM, Steve Crawford wrote:
>> select ii_purchased + your_interval_field * '1 year'::date as date
>> from inventory_item;
>
> that SHOULD be written as...
>
> select ii_purchased + your_interval_field * interval '1 year' as date
> from inventory_item;
>
>
>
Correct. I meant ...::interval... but hadn't had my first coffee. :)

Cheers,
Steve

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Emi Lu 2011-04-06 20:28:12 dblink server closed the connection unexpectedly - Exception
Previous Message Radosław Smogura 2011-04-06 20:09:05 Re: [RMX:#] Re: Strange loss of data during INSERT