can't create index with 'dowcast' row

From: Louis-David Mitterrand <vindex+lists-pgsql-general(at)apartia(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: can't create index with 'dowcast' row
Date: 2008-01-24 15:54:21
Message-ID: 20080124155421.GA24152@apartia.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

To constraint unique'ness of my visitors to a 24h periode I tried
created a index including the 'date' part of the created_on timestamp:

CREATE UNIQUE INDEX visit_idx ON visit_buffer USING btree (id_session,
id_story, created_on::date);

psql:visit_pkey.sql:5: ERROR: syntax error at or near "::"
LINE 1: ...buffer USING btree (id_session, id_story, created_on::date);

and this:

CREATE UNIQUE INDEX visit_idx ON visit_buffer USING btree (id_session, id_story, extract(date from created_on));
psql:visit_pkey.sql:4: ERROR: functions in index expression must be marked IMMUTABLE

How can I achieve what I am trying?

Thanks,

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stefan Schwarzer 2008-01-24 16:10:51 Re: Forgot to dump old data before re-installing machine
Previous Message Tom Lane 2008-01-24 15:47:57 Re: check constraint question