Unix Technical Forum

Issue with creation of Partial_indexes (Immutable?)

This is a discussion on Issue with creation of Partial_indexes (Immutable?) within the Pgsql General forums, part of the PostgreSQL category; --> CREATE INDEX idx_d_trh_code_id_partial ON xmms.d_trh_table USING btree (code_id) where code_id not in ('P000','000') and code_id is not null; ERROR: ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-27-2008, 07:08 AM
Ow Mun Heng
 
Posts: n/a
Default Issue with creation of Partial_indexes (Immutable?)

CREATE INDEX idx_d_trh_code_id_partial
ON xmms.d_trh_table
USING btree
(code_id) where code_id not in ('P000','000') and code_id is not null;
ERROR: functions in index predicate must be marked IMMUTABLE

Just trying something new.

I want to create partial indexes on code_id which are not null and not
P000/000

the ones I want are like HMD11 or UE935 or OIOR11 etc.

not sure where the IMMUTABLE part is coming from..

Clue?





--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 08-27-2008, 07:08 AM
Tom Lane
 
Posts: n/a
Default Re: Issue with creation of Partial_indexes (Immutable?)

Ow Mun Heng <Ow.Mun.Heng@wdc.com> writes:
> On Mon, 2008-08-25 at 12:23 +0800, Ow Mun Heng wrote:
>> CREATE INDEX idx_d_trh_code_id_partial
>> ON xmms.d_trh_table
>> USING btree
>> (code_id) where code_id not in ('P000','000') and code_id is not null;
>> ERROR: functions in index predicate must be marked IMMUTABLE


> BTW, this is on 8.2.9 Seems to work OK on 8.3.3.


I suppose code_id is varchar or some such?

Try "where code_id::text not in ...". There's an array type coercion
underlying the right-hand side of the NOT IN, and 8.2 had some problems
with correctly identifying the volatility of such coercions.

regards, tom lane

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-27-2008, 07:08 AM
Tom Lane
 
Posts: n/a
Default Re: Partial Indexes Not being Used [WAS]Re: Partial_indexes (Immutable?)

Ow Mun Heng <Ow.Mun.Heng@wdc.com> writes:
> On Mon, 2008-08-25 at 10:18 -0400, Tom Lane wrote:
>> I suppose code_id is varchar or some such?


> Yep
> After a few more investigation on the usefulness of the partial indexes,
> I found that, it really isn't all that useful, perhaps some experts can
> shed some light.


I poked at that example a bit more earlier today, and found that 8.3
has a problem that's interfering with optimizing x IN ('y','z') type
clauses when x is varchar. If you don't mind building a local copy,
see if this patch helps you any:
http://archives.postgresql.org/pgsql...8/msg00254.php

regards, tom lane

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads for: Issue with creation of Partial_indexes (Immutable?)

Thread Thread Starter Forum Replies Last Post
[jira] Closed: (CONTINUUM-36) Automatic issue creation forcronically failing tests Brett Porter (JIRA) Apache Continuum Bugs 0 08-15-2008 01:25 PM
[ MDKSA-2007:134 ] - Updated xfsdump packages fixunsafe temporary directory creation issue security@mandriva.com Bugtraq Full-disclosure 0 07-02-2008 08:44 AM
[ MDKSA-2007:117 ] - Updated lha packages fixunsafe temporary files creation issue security@mandriva.com Bugtraq Full-disclosure 0 07-02-2008 08:42 AM
[ MDKSA-2007:134 ] - Updated xfsdump packages fix unsafe temporarydirectory creation issue security@mandriva.com Bugtraq 0 07-01-2008 08:12 PM
new zone creation issue Eugenias OpenSolaris Zones 2 06-29-2008 05:37 PM


All times are GMT. The time now is 10:39 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com