Re: Date Index

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Ryan Hansen" <ryan(dot)hansen(at)brightbuilders(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Date Index
Date: 2008-11-03 23:59:17
Message-ID: 4050.1225756757@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Ryan Hansen" <ryan(dot)hansen(at)brightbuilders(dot)com> writes:
> Incidentally, extract(date from ts) doesn't work on my install of 8.3

The field names recognized by extract() are quite well documented
http://www.postgresql.org/docs/8.3/static/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT
and "date" isn't one of them.

What you probably want is just to cast the timestamp to date:
cast(ts as date) -- SQL standard syntax
ts::date -- traditional Postgres abbreviation

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Robert Haas 2008-11-04 00:26:47 Re: [SQL] reliable lock inside stored procedure (SOLVED)
Previous Message Ryan Hansen 2008-11-03 22:57:25 Re: Date Index