pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rajesh Kumar Mallah. <mallah@trade-india.com>
To: pgsql-sql@postgresql.org
Subject: possible bug in \df+
Date: Fri, 2 Aug 2002 19:47:28 +0530
Message-ID: <200208021947.28780.mallah@trade-india.com> (raw)



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.





Message-ID: <200208021947.28780.mallah@trade-india.com>
Permalink:  ../200208021947.28780.mallah@trade-india.com/
Also on:    postgresql.org/message-id/200208021947.28780.mallah@trade-india.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mallah@trade-india.com
  Subject: Re: possible bug in \df+
  In-Reply-To: <200208021947.28780.mallah@trade-india.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox