X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6CDDF476085 for ; Sat, 19 Apr 2003 02:00:30 -0400 (EDT) Received: from rtlocal.trade-india.com (unknown [203.196.129.235]) by postgresql.org (Postfix) with SMTP id 61CBD4758C9 for ; Sat, 19 Apr 2003 02:00:26 -0400 (EDT) Received: (qmail 16820 invoked from network); 19 Apr 2003 06:02:42 -0000 Received: from unknown (HELO system67.trade-india-local.com) (unknown) by unknown with SMTP; 19 Apr 2003 06:02:42 -0000 From: Rajesh Kumar Mallah Organization: Infocom Network Limited To: pgsql-sql@postgresql.org Subject: apparent problem with a PL Date: Sat, 19 Apr 2003 11:29:39 +0530 User-Agent: KMail/1.5 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200304191129.39347.mallah@trade-india.com> X-Spam-Status: No, hits=-7.2 required=5.0 tests=BAYES_01,SIGNATURE_SHORT_SPARSE,USER_AGENT version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/295 X-Sequence-Number: 12996 Hi, If I limit a particular query to show 3 results which has a function call how can the function get called 4 times ? its apparently happening to me. tradein_clients=# SELECT company_id, utils.pgxml_xpath_pl('/Company@CompanyId' , xml) from companies where xml is not null limit 3; INFO: function pgxml_xpath_pl has been called INFO: function pgxml_xpath_pl has been called INFO: function pgxml_xpath_pl has been called INFO: function pgxml_xpath_pl has been called +------------+----------------+ | company_id | pgxml_xpath_pl | +------------+----------------+ | 65 | 65 | | 187 | 187 | | 382 | 382 | +------------+----------------+ (3 rows) but when i filter by a column the behaviour is rite: tradein_clients=# SELECT company_id, utils.pgxml_xpath_pl('/Company@CompanyId' , xml) from companies where xml is not null and company_id=65; INFO: function pgxml_xpath_pl has been called +------------+----------------+ | company_id | pgxml_xpath_pl | +------------+----------------+ | 65 | 65 | +------------+----------------+ (1 row) tradein_clients=# output of vacuum full verbose analyze : ( but the faulty behaviour persists) tradein_clients=# VACUUM FULL Verbose ANALYZE companies ; INFO: --Relation public.companies-- INFO: Pages 385: Changed 0, reaped 377, Empty 0, New 0; Tup 713: Vac 713, Keep/VTL 0/0, UnUsed 2759, MinLen 244, MaxLen 2033; Re-using: Free/Avail. Space 2525848/2524400; EndEmpty/Avail. Pages 0/374. CPU 0.00s/0.00u sec elapsed 0.00 sec. INFO: Index companies_company_id_key: Pages 15; Tuples 713: Deleted 713. CPU 0.00s/0.00u sec elapsed 0.00 sec. INFO: Index companies_keywordidx: Pages 75; Tuples 555: Deleted 555. CPU 0.00s/0.00u sec elapsed 0.00 sec. INFO: Index companies_email: Pages 34; Tuples 713: Deleted 713. CPU 0.00s/0.00u sec elapsed 0.00 sec. INFO: Rel companies: Pages: 385 --> 77; Tuple(s) moved: 359. CPU 0.01s/0.05u sec elapsed 0.11 sec. INFO: Index companies_company_id_key: Pages 15; Tuples 713: Deleted 359. CPU 0.00s/0.00u sec elapsed 0.00 sec. INFO: Index companies_keywordidx: Pages 75; Tuples 555: Deleted 329. CPU 0.00s/0.00u sec elapsed 0.00 sec. INFO: Index companies_email: Pages 34; Tuples 713: Deleted 359. CPU 0.00s/0.00u sec elapsed 0.00 sec. INFO: --Relation pg_toast.pg_toast_14656776-- INFO: Pages 300: Changed 300, reaped 0, Empty 0, New 0; Tup 1382: Vac 0, Keep/VTL 0/0, UnUsed 0, MinLen 37, MaxLen 2034; Re-using: Free/Avail. Space 285232/284268; EndEmpty/Avail. Pages 0/289. CPU 0.00s/0.00u sec elapsed 0.00 sec. INFO: Index pg_toast_14656776_index: Pages 16; Tuples 1382. CPU 0.00s/0.00u sec elapsed 0.01 sec. INFO: Rel pg_toast_14656776: Pages: 300 --> 300; Tuple(s) moved: 0. CPU 0.00s/0.00u sec elapsed 0.00 sec. INFO: Analyzing public.companies VACUUM tradein_clients=# CREATE OR REPLACE FUNCTION utils.pgxml_xpath_pl (varchar,text) RETURNS text AS ' use XML::XPath::Simple; my ($xpath , $xml ) = @_; my $xp; elog INFO , "function pgxml_xpath_pl has been called"; eval { $xp = new XML::XPath::Simple(xml => $xml ,context => "/"); }; if ($@) { elog ERROR , "There was an error: $@ "; } my $content = $xp->valueof($xpath); return $content; ' LANGUAGE 'plperlu'; Can anyone shed some light 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.