Search Postgresql Archives

Re: adding years to a date field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/06/11 1:18 PM, Steve Crawford wrote:
select ii_purchased + your_interval_field * interval '1 year' as date from inventory_item;



Correct. I meant ...::interval...

FWIW, '1 year'::interval implies a cast, that is a postgresql-specific notation for cast('1 year' as interval), while interval '1 year' is the SQL standard notation for an interval constant. yes, the end results are the same, the parser/optimizer will look at that cast and do it in advance rather than at execution time since the input is invariant.



--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux