Re: Dynamic partial index

From: Harald Fuchs <hf0731x(at)protecting(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Dynamic partial index
Date: 2006-08-18 09:41:34
Message-ID: puk656cre9.fsf@srv.protecting.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In article <44E4A209(dot)4080106(at)gmail(dot)com>,
gustavo halperin <ggusti(at)gmail(dot)com> writes:

> Hello
> I'm interesting in a partial index for a rows that aren't older than
> 6 mounts, something like the sentence below:
> / CREATE INDEX name_for_the_index ON table
> (the_column_of_type_date) WHERE ( the_column_of_type_date >
> (current_date - interval '6 month')::date );/

> But this is not posible, I receive the next error:
> /ERROR: functions in index predicate must be marked IMMUTABLE/

> So, what is the best solution for my problem?

Use a fixed date 6 months ago, and regularly recreate the index.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message gustavo halperin 2006-08-18 09:52:47 Re: Dynamic Partial Index
Previous Message Alexander Farber 2006-08-18 08:00:20 Re: select * from users where user_id NOT in (select