Re: Added Having Clause - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Added Having Clause
Date
Msg-id 199803202214.RAA16016@candle.pha.pa.us
Whole thread Raw
List pgsql-hackers
We are preparing a 6.3 patch.  Is this patch ready to be used by the
user community, or are you still working on it?

>
> Hi!
>
> I started adding the Having Clause and it works quite fine for
> sequential scans! (I think it will also work with hash, index, etc but
> I did not check it out! I made some High level changes which should
> work for all access methods, but maybe I'm wrong. Please let me know.)
>
> Now it is possible to make queries like:
>
> select s.sname, max(p.pid), min(p.pid)
> from part p, supplier s
> where s.sid=p.sid
> group by s.sname
> having max(pid)=6 and min(pid)=1 or avg(pid)=4;
>
> Having does not work yet for queries that contain a subselect statement
> in the Having clause, I'll try to fix this in the next days.
>
> If there are some bugs, please let me know, I'll start to read the
> mailinglists now!
>
> Now here is the patch against the original 6.3 version (no snapshot!!):
>
> It is encoded using uuencode and called:
>       postgresql-6.3.tar.gz_to_having.diff.gz.uu
>
> If your original 6.3 source tree is in:
>    tmp/postgresql-6.3/
> perform the following steps to apply the patch:
>
> $ cd tmp/
> $ uudecode postgresql-6.3.tar.gz_to_having.diff.gz.uu
> $ gunzip postgresql-6.3.tar.gz_to_having.diff.gz
> $ patch < postgresql-6.3.tar.gz_to_having.diff
>
> Hopefully you will see only "Hunk succeeded..." messages :-)
>
> Regards
>
>      Stefan
>
>
> -----------------------Cut here----------------------------------------
> begin 644 postgresql-6.3.tar.gz_to_having.diff.gz
> M'XL("&QL"34``W!O<W1G<F5S<6PM-BXS+G1A<BYG>E]T;U]H879I;F<N9&EF
> M9@#-6VUSVD@2_DQJ?\0XF\H!%B`A\5Y.%>>0"W>.G;79[*7VMCA9#*"+D!2-
> MY(3-^K]?3\^,)%X-6:>RE`/2:*:G>[K[F>[6)`Q8/(LH^^A5FE6SQB*G=FL[
> M'Z@_J='/U$GB(,*+GQ+;JSJD6JV%QXV8N-,IC;K$F=L1:>HM4R.>ZU-2UYM/
> MRN4R.8Y<831/R"MZ2^I-HEM=T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2JCC-
> MHS)26%#U3@CO2^G9)5`3'L$4)Y;4*-5*Q&$^+,K!\Y6LL"\J:.(Y(5DM29XD
> M$D"H^%)9]:/S5?@*QO;H(:*?(C>FZO<U%LH?/NRR<]B*@34,2X&@(?2XS\!V
> MT5PW,P"R@W/6O32Q=H(06X?T=0\R&IV&5M>-U-BXPHI1/*;\`,<8LCFL(434
> MPVBY\B*:C*/$HZS$3X>*ESOY\W'\'0/!JJ\:BJ<V+OA-\?S-R_'-X&)P/M+(
> MZA1XCR]/-1'?\Q)J6G<!T(*@<H+'VV"BR*5W_`P@BR'QE*5/56!V02><8$D<
> M693"*8O]2PE7^#/2;<6-5D,SVWI6!A,-F?CI6X(P"B:)$X\_)A2F8^J`#U\A
> M/P;@5OS"`UV=WLRQ$<5<)/O6H_((,E^D:WZL9G3KR9,_:@DR6(CB'8>F34C5
> MS'8GQW<;^.[DCDXJ?DY/>^I>K*]2'<PRIW8X#D+J1ZF&^;MFCR<=I>P(ZI/T
> MC/,ZC4S]_`5FIGUY_%N=B=XJ@F58FF7D1+",EF;5S141UJQN]_Q"2!3(\0)&
> M-WDMY;2R*HVTCQSC<L*M?#?;IM9LI\40>;:,$'S7=RV`9>7%'YHNIAT5G#S?
> M4=86BVE'42PMY?]#0[[_E4^+J\XNLZ`V)$%*_=NX;K4Z6JMMY>N]=6CH;!IZ
> M>AA>V3?_'PVP8L*[>BM]\4V0](S4)93-*/0X/?6315Z(H7\7?("8]@6Y'OQR
> :/1P-QL/+=U?_&HS?]/\MO>/_/<H'1Y`S```X
> `
> end
>
> -----------------------Cut here----------------------------------------
>
>
> --
> +------------------------------------------------------------------------+
> + Simkovics Stefan                                                       +
> + Student an der TU Wien (Informatik)                                    +
> + Tel.: 02239/3367                                                       +
> + email: ssimkovi@ag.or.at | e9225039@student.tuwien.ac.at               +
> +------------------------------------------------------------------------+
>


--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

pgsql-hackers by date:

Previous
From: dg@illustra.com (David Gould)
Date:
Subject: Re: [HACKERS] Re: [PATCHES] patches for 6.2.1p6
Next
From: Coronach
Date:
Subject: Re: [HACKERS] psql nested queries with 2000+ records