Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 912FE9FA252 for ; Sat, 16 Dec 2006 12:24:47 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 63489-04 for ; Sat, 16 Dec 2006 12:24:36 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.173]) by postgresql.org (Postfix) with ESMTP id C0C2E9F9FE1 for ; Sat, 16 Dec 2006 12:24:36 -0400 (AST) Received: by ug-out-1314.google.com with SMTP id k3so1104540ugf for ; Sat, 16 Dec 2006 08:24:36 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=WXT8jgfERzXMHoUXYjgnRptzooXL7juhs5hiCGuF9LvMXI8sXu74OvrjJWtEkD4hubcbCERheTIVMhTW+zGHJAZNcdThl70KDblDX1CAYUGr+uv3SVR7gwkFuYI/g2scOG87dWLjut6QJnfPT6AbSHqVqYFVEChtJj34+hnBTZc= Received: by 10.67.103.7 with SMTP id f7mr1968683ugm.1166286276308; Sat, 16 Dec 2006 08:24:36 -0800 (PST) Received: by 10.66.216.15 with HTTP; Sat, 16 Dec 2006 08:24:36 -0800 (PST) Message-ID: Date: Sat, 16 Dec 2006 21:54:36 +0530 From: "Rajesh Kumar Mallah" To: "Lista Postgres" Subject: Adding a column with default value possibly corrupting a functional index. MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1774_1747282.1166286276271" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/234 X-Sequence-Number: 24026 ------=_Part_1774_1747282.1166286276271 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, 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. if no default value is giving while adding the column the query continues to give proper result. Regds mallah. tradein_clients=> SELECT category_id from general.web_category_masterwhere upper( general.cat_url(category_id)::text) = 'AGRICULTURE'; +-------------+ | category_id | +-------------+ | 1 | +-------------+ (1 row) tradein_clients=> explain SELECT category_id from general.web_category_master where upper(general.cat_url(category_id)::text) = 'AGRICULTURE'; +-------------------------------------------------------------------------------------------------------------+ | QUERY PLAN | +-------------------------------------------------------------------------------------------------------------+ | Index Scan using web_category_master_upper_cat_url on web_category_master (cost=0.00..8.02 rows=1 width=4) | | Index Cond: (upper((general.cat_url(category_id))::text) = 'AGRICULTURE'::text) | +-------------------------------------------------------------------------------------------------------------+ (2 rows) tradein_clients=> ALTER TABLE general.web_category_master add test_id int default 0; ALTER TABLE tradein_clients=> SELECT category_id from general.web_category_masterwhere upper( general.cat_url(category_id)::text) = 'AGRICULTURE'; +-------------+ | category_id | +-------------+ +-------------+ (0 rows) tradein_clients=> REINDEX TABLE general.web_category_master; REINDEX tradein_clients=> SELECT category_id from general.web_category_masterwhere upper( general.cat_url(category_id)::text) = 'AGRICULTURE'; +-------------+ | category_id | +-------------+ | 1 | +-------------+ (1 row) ------=_Part_1774_1747282.1166286276271 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi,

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. if no default value is giving while adding
the column the query continues to give proper result.

Regds
mallah.

tradein_clients=> SELECT  category_id from general.web_category_master where  upper(general.cat_url(category_id)::text) = 'AGRICULTURE';
+-------------+
| category_id |
+-------------+
|           1 |
+-------------+
(1 row)

tradein_clients=> explain SELECT  category_id from general.web_category_master where  upper(general.cat_url(category_id)::text) = 'AGRICULTURE';
+-------------------------------------------------------------------------------------------------------------+
|                                                 QUERY PLAN                                                  |
+-------------------------------------------------------------------------------------------------------------+
| Index Scan using web_category_master_upper_cat_url on web_category_master  (cost=0.00..8.02 rows=1 width=4) |
|   Index Cond: (upper((general.cat_url(category_id))::text) = 'AGRICULTURE'::text)                           |
+-------------------------------------------------------------------------------------------------------------+
(2 rows)

tradein_clients=> ALTER TABLE general.web_category_master add test_id int default 0;
ALTER TABLE
tradein_clients=> SELECT  category_id from general.web_category_master where  upper(general.cat_url (category_id)::text) = 'AGRICULTURE';
+-------------+
| category_id |
+-------------+
+-------------+
(0 rows)

tradein_clients=> REINDEX TABLE  general.web_category_master;
REINDEX
tradein_clients=> SELECT  category_id from general.web_category_master where  upper(general.cat_url(category_id)::text) = 'AGRICULTURE';
+-------------+
| category_id |
+-------------+
|           1 |
+-------------+
(1 row)


------=_Part_1774_1747282.1166286276271--