| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
|---|---|
| To: | Oleg Bartunov <oleg(at)sai(dot)msu(dot)su> | 
| Cc: | pgsql-hackers(at)postgreSQL(dot)org | 
| Subject: | Re: [HACKERS] is it possible to use LIMIT and INTERSECT ? | 
| Date: | 1999-10-17 23:31:09 | 
| Message-ID: | 20769.940203069@sss.pgh.pa.us | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
Oleg Bartunov <oleg(at)sai(dot)msu(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 1999-10-17 23:53:00 | Re: [HACKERS] mdnblocks is an amazing time sink in huge relations | 
| Previous Message | Mike Mascari | 1999-10-17 23:00:12 | Re: [HACKERS] Re: ORACLE COMMENT statement |