pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
ERROR: ExecEvalAggref: no aggregates in this expression context
6+ messages / 2 participants
[nested] [flat]

* ERROR: ExecEvalAggref: no aggregates in this expression context
@ 2000-07-05 00:37 Paul McGarry <paulm@opentec.com.au>
  2000-07-05 17:15 ` Re: ERROR: ExecEvalAggref: no aggregates in this expression context Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 6+ messages in thread

From: Paul McGarry @ 2000-07-05 00:37 UTC (permalink / raw)
  To: pgsql-sql@hub.org

Hello,

Can someone tell me what this error message means:
==========
ERROR: ExecEvalAggref: no aggregates in this expression context
==========

Does it mean that there aren't any aggregate in the expression
context when there should be. Does it mean there are and there
shouldn't be?

For that matter, what are aggregates and in what expression
context should they be or not be in?

Could it be because I am trying to group around something like
	entry_view.minprice,
	entry_view.maxprice
where minprice and maxprice are defined in as
	min (item.item_price) as minprice,
	max (item.item_price) as maxprice
when the entry_view view is defined?
	
Thanks

-- 
Paul McGarry            mailto:paulm@opentec.com.au 
Systems Integrator      http://www.opentec.com.au 
Opentec Pty Ltd         http://www.iebusiness.com.au
6 Lyon Park Road        Phone: (02) 9878 1744 
North Ryde NSW 2113     Fax:   (02) 9878 1755



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

* Re: ERROR: ExecEvalAggref: no aggregates in this expression context
  2000-07-05 00:37 ERROR: ExecEvalAggref: no aggregates in this expression context Paul McGarry <paulm@opentec.com.au>
@ 2000-07-05 17:15 ` Tom Lane <tgl@sss.pgh.pa.us>
  2000-07-06 00:59   ` Re: ERROR: ExecEvalAggref: no aggregates in this expressioncontext Paul McGarry <paulm@opentec.com.au>
  0 siblings, 1 reply; 6+ messages in thread

From: Tom Lane @ 2000-07-05 17:15 UTC (permalink / raw)
  To: Paul McGarry <paulm@opentec.com.au>; +Cc: pgsql-sql@hub.org

Paul McGarry <paulm@opentec.com.au> writes:
> Can someone tell me what this error message means:
> ERROR: ExecEvalAggref: no aggregates in this expression context

> Does it mean that there aren't any aggregate in the expression
> context when there should be.

Yup.  ExecEvalAggref is supposed to fetch the result of a (previously
computed) aggregate function.  It's unhappy because it's not finding
anything to return.  This is a bug --- can we see a complete example
that causes it?

> For that matter, what are aggregates

SUM(), COUNT(), MIN(), that sort of thing...

			regards, tom lane



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

* Re: ERROR: ExecEvalAggref: no aggregates in this expressioncontext
  2000-07-05 00:37 ERROR: ExecEvalAggref: no aggregates in this expression context Paul McGarry <paulm@opentec.com.au>
  2000-07-05 17:15 ` Re: ERROR: ExecEvalAggref: no aggregates in this expression context Tom Lane <tgl@sss.pgh.pa.us>
@ 2000-07-06 00:59   ` Paul McGarry <paulm@opentec.com.au>
  2000-07-06 02:45     ` Re: ERROR: ExecEvalAggref: no aggregates in thisexpressioncontext Paul McGarry <paulm@opentec.com.au>
  2000-07-06 04:44     ` Re: ERROR: ExecEvalAggref: no aggregates in this expressioncontext Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 6+ messages in thread

From: Paul McGarry @ 2000-07-06 00:59 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql@hub.org

Hi Tom,

Tom Lane wrote:
> > ERROR: ExecEvalAggref: no aggregates in this expression context
> > Does it mean that there aren't any aggregate in the expression
> > context when there should be.
> Yup.  ExecEvalAggref is supposed to fetch the result of a (previously
> computed) aggregate function.  It's unhappy because it's not finding
> anything to return.  This is a bug --- can we see a complete example
> that causes it?

The view that I am experiencing this error on is rather nasty, so
much so that I am going to solve the problem it was supposed to
solve in another way.

On another (possibly related) note, the same view seems to pose
problems when I do a 'SELECT count(*) from view_name'.

If I do a 'SELECT * from view_name' and get 8 rows of data, when I
 do a 'SELECT count(*) from view_name' I get 8 rows of the 
number 1 returned. 

In any case I'll try and distill both of these down to a slightly 
less horrific testcase and send it in.

-- 
Paul McGarry            mailto:paulm@opentec.com.au 
Systems Integrator      http://www.opentec.com.au 
Opentec Pty Ltd         http://www.iebusiness.com.au
6 Lyon Park Road        Phone: (02) 9878 1744 
North Ryde NSW 2113     Fax:   (02) 9878 1755



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

* Re: ERROR: ExecEvalAggref: no aggregates in thisexpressioncontext
  2000-07-05 00:37 ERROR: ExecEvalAggref: no aggregates in this expression context Paul McGarry <paulm@opentec.com.au>
  2000-07-05 17:15 ` Re: ERROR: ExecEvalAggref: no aggregates in this expression context Tom Lane <tgl@sss.pgh.pa.us>
  2000-07-06 00:59   ` Re: ERROR: ExecEvalAggref: no aggregates in this expressioncontext Paul McGarry <paulm@opentec.com.au>
@ 2000-07-06 02:45     ` Paul McGarry <paulm@opentec.com.au>
  1 sibling, 0 replies; 6+ messages in thread

From: Paul McGarry @ 2000-07-06 02:45 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql@hub.org

Paul McGarry wrote:

> If I do a 'SELECT * from view_name' and get 8 rows of data, when I
>  do a 'SELECT count(*) from view_name' I get 8 rows of the
> number 1 returned.

I've attached a script which will generate a bunch of tables and
a view then do a select * and select count(*) on that view. It
is almost certainly to do with the GROUPing used in the view.

The ouput I get is:

select * from entry_view;
 id | description_text | parent_id | minamount 
----+------------------+-----------+-----------
  1 | entry one        |         0 |         1
  2 | entry two        |         1 |         2
  3 | entry three      |         2 |         7
(3 rows)

select count(*) from entry_view;
 count 
-------
     2
     2
     1
(3 rows)

That doesn't make much sense to me...

Postgres 7.0.2 by the way.

I'll work on the more complex case where I got the 
ERROR: ExecEvalAggref error message now.

-- 
Paul McGarry            mailto:paulm@opentec.com.au 
Systems Integrator      http://www.opentec.com.au 
Opentec Pty Ltd         http://www.iebusiness.com.au
6 Lyon Park Road        Phone: (02) 9878 1744 
North Ryde NSW 2113     Fax:   (02) 9878 1755

Attachments:

  countbug.sql (application/x-unknown-content-type-sql_auto_file, 2.1K) download

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

* Re: ERROR: ExecEvalAggref: no aggregates in this expressioncontext
  2000-07-05 00:37 ERROR: ExecEvalAggref: no aggregates in this expression context Paul McGarry <paulm@opentec.com.au>
  2000-07-05 17:15 ` Re: ERROR: ExecEvalAggref: no aggregates in this expression context Tom Lane <tgl@sss.pgh.pa.us>
  2000-07-06 00:59   ` Re: ERROR: ExecEvalAggref: no aggregates in this expressioncontext Paul McGarry <paulm@opentec.com.au>
@ 2000-07-06 04:44     ` Tom Lane <tgl@sss.pgh.pa.us>
  2000-07-06 05:19       ` Re: ERROR: ExecEvalAggref: no aggregates in thisexpressioncontext Paul McGarry <paulm@opentec.com.au>
  1 sibling, 1 reply; 6+ messages in thread

From: Tom Lane @ 2000-07-06 04:44 UTC (permalink / raw)
  To: Paul McGarry <paulm@opentec.com.au>; +Cc: pgsql-sql@hub.org

Paul McGarry <paulm@opentec.com.au> writes:
>> Yup.  ExecEvalAggref is supposed to fetch the result of a (previously
>> computed) aggregate function.  It's unhappy because it's not finding
>> anything to return.  This is a bug --- can we see a complete example
>> that causes it?

> The view that I am experiencing this error on is rather nasty, so
> much so that I am going to solve the problem it was supposed to
> solve in another way.

View?  Hmm, we know that views involving GROUP BY or aggregates
don't work very well.  We hope to fix those problems in 7.2, but
right now there's probably not much that can be done about it.
I'd recommend avoiding views that use those features for now.

			regards, tom lane



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

* Re: ERROR: ExecEvalAggref: no aggregates in thisexpressioncontext
  2000-07-05 00:37 ERROR: ExecEvalAggref: no aggregates in this expression context Paul McGarry <paulm@opentec.com.au>
  2000-07-05 17:15 ` Re: ERROR: ExecEvalAggref: no aggregates in this expression context Tom Lane <tgl@sss.pgh.pa.us>
  2000-07-06 00:59   ` Re: ERROR: ExecEvalAggref: no aggregates in this expressioncontext Paul McGarry <paulm@opentec.com.au>
  2000-07-06 04:44     ` Re: ERROR: ExecEvalAggref: no aggregates in this expressioncontext Tom Lane <tgl@sss.pgh.pa.us>
@ 2000-07-06 05:19       ` Paul McGarry <paulm@opentec.com.au>
  0 siblings, 0 replies; 6+ messages in thread

From: Paul McGarry @ 2000-07-06 05:19 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql@hub.org


Tom Lane wrote:
> View?  Hmm, we know that views involving GROUP BY or aggregates
> don't work very well.  We hope to fix those problems in 7.2, but
> right now there's probably not much that can be done about it.
> I'd recommend avoiding views that use those features for now.

Yes, I've just discovered the Todo list :) Oh well, it probably
needed rethinking anyway.....I want fast retrieval over fast
update so I probably want to do my min() and max() magic with
triggers on insert/update/delete rather than on each select
with the view.

In any case I have attached some SQL which sets up tables and
generates the ExecEvalAggref I was getting in case it is of
any use to anyone.

Cheers.

-- 
Paul McGarry            mailto:paulm@opentec.com.au 
Systems Integrator      http://www.opentec.com.au 
Opentec Pty Ltd         http://www.iebusiness.com.au
6 Lyon Park Road        Phone: (02) 9878 1744 
North Ryde NSW 2113     Fax:   (02) 9878 1755

Attachments:

  execeval.sql (application/x-unknown-content-type-sql_auto_file, 1.5K) download

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


end of thread, other threads:[~2000-07-06 05:19 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-07-05 00:37 ERROR: ExecEvalAggref: no aggregates in this expression context Paul McGarry <paulm@opentec.com.au>
2000-07-05 17:15 ` Tom Lane <tgl@sss.pgh.pa.us>
2000-07-06 00:59   ` Re: ERROR: ExecEvalAggref: no aggregates in this expressioncontext Paul McGarry <paulm@opentec.com.au>
2000-07-06 02:45     ` Re: ERROR: ExecEvalAggref: no aggregates in thisexpressioncontext Paul McGarry <paulm@opentec.com.au>
2000-07-06 04:44     ` Re: ERROR: ExecEvalAggref: no aggregates in this expressioncontext Tom Lane <tgl@sss.pgh.pa.us>
2000-07-06 05:19       ` Re: ERROR: ExecEvalAggref: no aggregates in thisexpressioncontext Paul McGarry <paulm@opentec.com.au>

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