Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XC9ft-0000qb-9H for pgsql-bugs@arkaria.postgresql.org; Tue, 29 Jul 2014 15:50:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XC9fs-0008Aw-Ih for pgsql-bugs@arkaria.postgresql.org; Tue, 29 Jul 2014 15:50:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XC9fr-0008Aq-SS for pgsql-bugs@postgresql.org; Tue, 29 Jul 2014 15:50:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XC9fo-0007bj-KU for pgsql-bugs@postgresql.org; Tue, 29 Jul 2014 15:50:46 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s6TFofeV000969; Tue, 29 Jul 2014 11:50:41 -0400 From: Tom Lane To: hiapo@tahiti-ingenierie.pf cc: pgsql-bugs@postgresql.org Subject: Re: BUG #11078: this query crash on array_agg, but there is no array_agg In-reply-to: <20140729024655.16601.27547@wrigleys.postgresql.org> References: <20140729024655.16601.27547@wrigleys.postgresql.org> Comments: In-reply-to hiapo@tahiti-ingenierie.pf message dated "Tue, 29 Jul 2014 02:46:55 -0000" Date: Tue, 29 Jul 2014 11:50:41 -0400 Message-ID: <968.1406649041@sss.pgh.pa.us> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org hiapo@tahiti-ingenierie.pf writes: > select x.oid,x.c from ( > select p.oid,pg_get_functiondef(p.oid)::varchar as c > from information_schema.routines r inner join pg_catalog.pg_proc p on > (r.specific_name=p.proname||'_'||oid::varchar) where > specific_schema='public' > )x where x.c ilike '%getcnx%' pg_get_functiondef doesn't work on aggregate functions. You might get away with not defending against that without the ilike condition; but with it, the ilike gets pushed down to the scan of pg_proc so the join condition doesn't save you. You could do something like this to avoid the problem: select x.oid,x.c from ( select p.oid,case when p.proisagg then null else pg_get_functiondef(p.oid) end as c from information_schema.routines r inner join pg_catalog.pg_proc p on (r.specific_name=p.proname||'_'||oid::varchar) where specific_schema='public' )x where x.c ilike '%getcnx%'; Another idea, depending on what you are really trying to accomplish with the ilike, is to just look directly at p.prosrc instead of going through pg_get_functiondef. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs