From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | hiapo(at)tahiti-ingenierie(dot)pf |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #11078: this query crash on array_agg, but there is no array_agg |
Date: | 2014-07-29 15:50:41 |
Message-ID: | 968.1406649041@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
hiapo(at)tahiti-ingenierie(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | guido | 2014-07-29 17:14:23 | BUG #11088: posgres blocks when i don't commit |
Previous Message | Bruce Momjian | 2014-07-29 15:03:15 | Re: BUG #10748: xmax is not resetting properly with FOR UPDATE |