From: | "Rajesh Kumar Mallah" <mallah(dot)rajesh(at)gmail(dot)com> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "Lista Postgres" <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: Adding a column with default value possibly corrupting a functional index. |
Date: | 2006-12-16 17:27:02 |
Message-ID: | a97c77030612160927u608b4b00td8d71ee442410b7f@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
On 12/16/06, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> "Rajesh Kumar Mallah" <mallah(dot)rajesh(at)gmail(dot)com> writes:
> > I have an index on upper(general.cat_url(category_id)) on a table.
> > when i add a column *with* default value , a query that previously
> > used to give result does not give results anymore. REINDEX'ing the
> > table produces correct result.
>
> Can you provide a self-contained example of this?
Hi,
thanks for the reply.
that was the first thing i was trying to do before the post
so far i have not been able to.
What PG version are
> you using?
8.2.0
What is that nonstandard function you're using in the index?
Its declared immutable , it queries the same table , its recursive
and it queries another custom function also.
dumping the function def below , lemme know if there is anything
obvious.
Warm Regds
mallah.
CREATE OR REPLACE FUNCTION general.cat_url (integer) RETURNS varchar AS '
DECLARE v_category_id ALIAS FOR $1;
DECLARE tmp_record RECORD;
DECLARE tmp_name VARCHAR;
DECLARE tmp_code VARCHAR;
BEGIN
tmp_code := '''' ;
IF v_category_id = -1 THEN
RETURN ''NO SUCH CATEGORY'';
END IF;
SELECT INTO tmp_record name, category_id, parent_category_id from
general.web_category_master join general.category_tree using(category_id)
where category_id=v_category_id and link is false;
IF NOT FOUND THEN
RETURN '''';
END IF;
tmp_name := general.cat_url(tmp_record.parent_category_id) ;
IF tmp_record.category_id <> 0 THEN
tmp_code := tmp_name || ''/'' ||
general.dir_name(tmp_record.name)
;
END IF;
tmp_code = ltrim(tmp_code,''/'');
RETURN tmp_code;
END;
' LANGUAGE 'plpgsql' IMMUTABLE;
regards, tom lane
>
From | Date | Subject | |
---|---|---|---|
Next Message | Rajesh Kumar Mallah | 2006-12-16 17:41:07 | Re: Adding a column with default value possibly corrupting a functional index. |
Previous Message | Tom Lane | 2006-12-16 16:58:42 | Re: Adding a column with default value possibly corrupting a functional index. |