pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re: going gaga on creating an aggregate... [solved of course...]
2+ messages / 2 participants
[nested] [flat]

* Re: going gaga on creating an aggregate... [solved of course...]
@ 2000-04-15 23:01  Christian Fritze <The.Finn@sprawl.de>
  0 siblings, 1 reply; 2+ messages in thread

From: Christian Fritze @ 2000-04-15 23:01 UTC (permalink / raw)
  To: Christian Fritze <The.Finn@sprawl.de>; +Cc: pgsql-sql


Oh my, I've been obfuscating. Again...
While having a couple of beers as mental lubricants in the 
LAP (Local Area Pub), it came to my mind that just doing a 

 create aggregate test_agg_1 (
 basetype = text, 
 stype1 = text, 
 sfunc1 = textcat, 
 initcond1 = '');

and then selecting like

 select test_agg_1(textvar || ' ') from testtable;

perfectly suites my needs. Sorry for the fuzz!

Still I'm somewhat curious as to why my first 
approach didn't work...


Greetings
Christian


-- 
"The sky above the port was the color of television,
 tuned to a dead channel."
                                         -- W.G. --





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Re: going gaga on creating an aggregate... [solved of course...]
@ 2000-04-16 05:04  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Christian Fritze <The.Finn@sprawl.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2000-04-16 05:04 UTC (permalink / raw)
  To: Christian Fritze <The.Finn@sprawl.de>; +Cc: pgsql-sql

Christian Fritze <The.Finn@sprawl.de> writes:
>  create aggregate test_agg_1 (
>  basetype = text, 
>  stype1 = text, 
>  sfunc1 = textcat, 
>  initcond1 = '');

> and then selecting like

>  select test_agg_1(textvar || ' ') from testtable;

> perfectly suites my needs. Sorry for the fuzz!

> Still I'm somewhat curious as to why my first 
> approach didn't work...

The difference is that textcat is a built-in function (C-coded), and
what you were previously trying to supply to CREATE AGGREGATE was an
SQL function.  The function manager is currently quite paranoid about
allowing SQL functions to be invoked from arbitrary contexts inside the
system; in particular it won't allow one to be called from the aggregate
executor.

This restriction is probably overly conservative, but it's not
completely without foundation.  For example, imagine defining an index
whose sort order depends on an SQL function, and then make the SQL
function be one that queries, or even worse updates, the table the index
is on.  Is that gonna work?  Nyet: it'll lead to infinite recursion,
crash and burn.  So for the moment I'd rather see the code err on the
side of caution.  Eventually we need a more sophisticated execution
model that can catch such recursive loops directly, and then we can
allow the normal non-recursive cases without fear.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2000-04-16 05:04 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-04-15 23:01 Re: going gaga on creating an aggregate... [solved of course...] Christian Fritze <The.Finn@sprawl.de>
2000-04-16 05:04 ` 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