Re: [HACKERS] is it possible to use LIMIT and INTERSECT ? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] is it possible to use LIMIT and INTERSECT ?
Date
Msg-id 20769.940203069@sss.pgh.pa.us
Whole thread Raw
In response to is it possible to use LIMIT and INTERSECT ?  (Oleg Bartunov <oleg@sai.msu.su>)
Responses Re: [HACKERS] is it possible to use LIMIT and INTERSECT ?  (Oleg Bartunov <oleg@sai.msu.su>)
List pgsql-hackers
Oleg Bartunov <oleg@sai.msu.su> writes:
> select ......
>  intersect
> select ......
> Current implementation of LIMIT doesn't support this.
> Are there any solutions ?

The problem seems to be right about where I suspected it was...

Try the attached (line numbers are for current, probably are way off
for 6.5.*, but the code in that routine hasn't changed much).
        regards, tom lane



*** src/backend/rewrite/rewriteHandler.c.orig    Thu Oct  7 00:23:15 1999
--- src/backend/rewrite/rewriteHandler.c    Sun Oct 17 19:18:01 1999
***************
*** 1806,1811 ****
--- 1806,1813 ----     bool        isBinary,                 isPortal,                 isTemp;
+     Node       *limitOffset,
+                *limitCount;     CmdType        commandType = CMD_SELECT;     List       *rtable_insert = NIL; 
***************
*** 1856,1861 ****
--- 1858,1865 ----     isBinary = parsetree->isBinary;     isPortal = parsetree->isPortal;     isTemp =
parsetree->isTemp;
+     limitOffset = parsetree->limitOffset;
+     limitCount = parsetree->limitCount;      /*      * The operator tree attached to parsetree->intersectClause is
still
***************
*** 2057,2062 ****
--- 2061,2068 ----     result->isPortal = isPortal;     result->isBinary = isBinary;     result->isTemp = isTemp;
+     result->limitOffset = limitOffset;
+     result->limitCount = limitCount;      /*      * The relation to insert into is attached to the range table of
the


pgsql-hackers by date:

Previous
From: Mike Mascari
Date:
Subject: Re: [HACKERS] Re: ORACLE COMMENT statement
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] mdnblocks is an amazing time sink in huge relations