pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #11078: this query crash on array_agg, but there is no array_agg
2+ messages / 2 participants
[nested] [flat]
* BUG #11078: this query crash on array_agg, but there is no array_agg
@ 2014-07-29 02:46 hiapo@tahiti-ingenierie.pf
2014-07-29 15:50 ` Re: BUG #11078: this query crash on array_agg, but there is no array_agg Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: hiapo@tahiti-ingenierie.pf @ 2014-07-29 02:46 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 11078
Logged by: hiapo
Email address: hiapo@tahiti-ingenierie.pf
PostgreSQL version: 9.3.3
Operating system: Linux OpenSuse 12.3
Description:
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%'
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #11078: this query crash on array_agg, but there is no array_agg
2014-07-29 02:46 BUG #11078: this query crash on array_agg, but there is no array_agg hiapo@tahiti-ingenierie.pf
@ 2014-07-29 15:50 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2014-07-29 15:50 UTC (permalink / raw)
To: hiapo@tahiti-ingenierie.pf; +Cc: pgsql-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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2014-07-29 15:50 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-07-29 02:46 BUG #11078: this query crash on array_agg, but there is no array_agg hiapo@tahiti-ingenierie.pf
2014-07-29 15:50 ` Tom Lane <tgl@sss.pgh.pa.us>
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