Re: [HACKERS] views and group by (formerly: create view as selec

From: jwieck(at)debis(dot)com (Jan Wieck)
To: tgl(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane)
Cc: maillist(at)candle(dot)pha(dot)pa(dot)us, jwieck(at)debis(dot)com, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] views and group by (formerly: create view as selec
Date: 1999-05-10 18:01:24
Message-ID: m10guMm-000EBXC@orion.SAPserv.Hamburg.dsh.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> writes:
> > I now get. I am sure it instills confidence in our users:
> > ERROR: union_planner: query is marked hasAggs, but I don't see any
>
> Yes :-(. I've been waiting for Jan to respond to the issue --- I think
> this is a rewriter problem, so I wanted to know whether he could do
> anything with it. (See my message "GROUP BY fixes committed" dated
> 02 May 1999 20:54:30 -0400.)
>
> It'd be possible to work around this problem inside the planner, by not
> believing what the rewriter says about either resnos or hasAggs, but
> that seems like a kluge rather than a fix.

Sorry - forgot about that one.

I think the best place to check if the query has aggregates
or not is at the beginning of the planner. The rewrite system
is recursive, and thus the check at the end of one cycle
doesn't guarantee that it will still be true at the end of
all rewrites.

OTOH views with aggregates are very buggy and introducing
ton's of problems (as the other threads show). I'm not sure
that it was a good idea to make it partially working :-( for
v6.4. There was only the advice that they shouldn't be used.
Now it's a released feature. More and more pressure for the
subselecting RTE's which are IMHO the only way to solve that
all cleanly.

The other issue about the resno's is something that I must
still search for in the rewriter. There are bad problems
where it seems to mangle up not only resno's, it also get's
lost of varlevelsup somehow and producing totally wrong
varno's into subselects. Still problems coming from the
EXCEPT/INTERSECT patch I haven't found so far >:-{

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#======================================== jwieck(at)debis(dot)com (Jan Wieck) #

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-05-10 18:19:04 Re: [HACKERS] INSERT INTO
Previous Message Thomas Lockhart 1999-05-10 17:58:30 Re: [HACKERS] numeric & decimal