possible bug in \df+

From: "Rajesh Kumar Mallah(dot)" <mallah(at)trade-india(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: possible bug in \df+
Date: 2002-08-02 14:17:28
Message-ID: 200208021947.28780.mallah@trade-india.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi there ,

" SELECT prosrc from pg_proc where proname='<procedure_name>'; "

and

\df+ <procedure_name> are reporting two different versions
for FUNCTION body.

eg:

\df+ category_path shows:

DECLARE v_category_id ALIAS FOR $1;
DECLARE tmp_record RECORD;
DECLARE tmp_id VARCHAR;
DECLARE tmp_code VARCHAR;

BEGIN
tmp_code := '' ;
SELECT INTO tmp_record b.name , a.category_id , a.parent_category_id from category_tree_new a natural inner
join categories_new b where category_id=v_category_id and a.link is not true ;
IF NOT FOUND THEN
RETURN 'Home';
END IF;

IF tmp_record.category_id = 0 THEN
RETURN tmp_record.name;
END IF;

tmp_id := category_path_text(tmp_record.parent_category_id) ;

IF tmp_record.category_id <> 0 THEN
tmp_code := tmp_id || ' > ' || tmp_record.name ;
END IF;

RETURN tmp_code;
END;

and select from pg_proc gives

DECLARE v_category_id ALIAS FOR $1;
DECLARE tmp_record RECORD;
DECLARE tmp_id VARCHAR;
DECLARE tmp_code VARCHAR;

BEGIN
tmp_code := '' ;
SELECT INTO tmp_record b.name , a.category_id , a.parent_category_id from category_tree_new a natural inner join categories_new b where category_id=v_category_id and a.link is not true ;
IF NOT FOUND THEN
RETURN '0' || ':' || 'ROOT';
END IF;

IF tmp_record.category_id = 0 THEN
RETURN tmp_record.category_id || ':' || tmp_record.name ;
END IF;

tmp_id := category_path(tmp_record.parent_category_id) ;

IF tmp_record.category_id <> 0 THEN
tmp_code := tmp_id || '#' || tmp_record.category_id || ':' || tmp_record.name ;
END IF;

RETURN tmp_code;
END;

regds
mallah.

--
Rajesh Kumar Mallah,
Project Manager (Development)
Infocom Network Limited, New Delhi
phone: +91(11)6152172 (221) (L) ,9811255597 (M)

Visit http://www.trade-india.com ,
India's Leading B2B eMarketplace.

Browse pgsql-sql by date

  From Date Subject
Next Message Wei Weng 2002-08-02 16:16:42 Seeking advice regarding a design problem
Previous Message Stephan Szabo 2002-08-02 14:12:13 Re: Random resultset retrieving -> performance bottleneck