Re: [HACKERS] views and group by (formerly: create view as selec - Mailing list pgsql-hackers

From jwieck@debis.com (Jan Wieck)
Subject Re: [HACKERS] views and group by (formerly: create view as selec
Date
Msg-id m10guMm-000EBXC@orion.SAPserv.Hamburg.dsh.de
Whole thread Raw
In response to Re: [HACKERS] views and group by (formerly: create view as selec  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
>
> Bruce Momjian <maillist@candle.pha.pa.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@debis.com (Jan Wieck) #

pgsql-hackers by date:

Previous
From: Oleg Bartunov
Date:
Subject: Re: [HACKERS] 6.5 cvs ERROR: copyObject: don't know how to copy 604
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] INSERT INTO