Re: Date Index

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: awilliam(at)whitemice(dot)org
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Date Index
Date: 2012-11-05 15:13:29
Message-ID: 26989.1352128409@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Adam Tauno Williams <awilliam(at)whitemice(dot)org> writes:
> OGo=> create index job_date_only on job(extract(date from start_date at
> time zone 'utc'));
> ERROR: timestamp units "date" not recognized

There's no field called "date" in a timestamp. I think what you're
trying to achieve is "date_trunc('day', start_date at time zone 'utc')"

http://www.postgresql.org/docs/9.2/static/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message pantelis vlachos 2012-11-07 08:36:34 find sudstring on text (data type) field failure
Previous Message Adam Tauno Williams 2012-11-05 10:54:47 Re: Date Index