From: Tom Lane <tgl@sss.pgh.pa.us>
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
Date: Tue, 29 Jul 2014 11:50:41 -0400
Message-ID: <968.1406649041@sss.pgh.pa.us> (raw)
In-Reply-To: <20140729024655.16601.27547@wrigleys.postgresql.org>
References: <20140729024655.16601.27547@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
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
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, hiapo@tahiti-ingenierie.pf
Subject: Re: BUG #11078: this query crash on array_agg, but there is no array_agg
In-Reply-To: <968.1406649041@sss.pgh.pa.us>
References: <20140729024655.16601.27547@wrigleys.postgresql.org> <968.1406649041@sss.pgh.pa.us>
* 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