Re: extract day from interval

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Seb <spluque(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: extract day from interval
Date: 2008-03-28 04:06:59
Message-ID: 23849.1206677219@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Seb <spluque(at)gmail(dot)com> writes:
> EXTRACT(DAY FROM (table_b.date - table_a.date)) AS age,

> Is this an efficient way to get the days from the time interval? Both
> 'date' columns are of type "Date". Thanks.

Efficiency is moot, it's just plain wrong. Or at least something is
wrong here, Subtraction of two "date" values gives an integer number of
days already, so I'd expect the EXTRACT to fail altogether. You
sure the date columns are type date and not type timestamp?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Seb 2008-03-28 04:36:20 Re: extract day from interval
Previous Message Seb 2008-03-28 03:32:05 extract day from interval