Thread: LIMIT and UNION

LIMIT and UNION

From
Chris Bitmead
Date:
Is it a known problem that LIMIT doesn't work with UNION, or have I
discovered a bug?

-- 
Chris Bitmead
mailto:chris@tech.com.au
http://www.techphoto.org - Photography News, Stuff that Matters


Re: [HACKERS] LIMIT and UNION

From
Tom Lane
Date:
Chris Bitmead <chris@tech.com.au> writes:
> Is it a known problem that LIMIT doesn't work with UNION, or have I
> discovered a bug?

Not sure, but I think the LIMIT would be parsed as an attribute of
one or the other of the sub-selects, not as a limit on the total
result size.  This is probably not the behavior you want :-(
        regards, tom lane


Re: [HACKERS] LIMIT and UNION

From
Bruce Momjian
Date:
> 
> Is it a known problem that LIMIT doesn't work with UNION, or have I
> discovered a bug?
> 

I see.  Syntax is accepted, but LIMIT is not performed.  Looks like a
bug.


--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: [HACKERS] LIMIT and UNION

From
Bruce Momjian
Date:
> 
> Is it a known problem that LIMIT doesn't work with UNION, or have I
> discovered a bug?

Added to TODO:
* UNION with LIMIT fails

--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026