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