Re: xmlagg doesn't honor LIMIT?

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Peter Kroon *EXTERN*" <plakroon(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: xmlagg doesn't honor LIMIT?
Date: 2013-11-26 13:15:11
Message-ID: A737B7A37273E048B164557ADEF4A58B17C60299@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Peter Kroon wrote:
> Is anyone able to reproduce?
> When I run the query below all 5 rows are returned instead of 2.
> Or is this the default behaviour..

> SELECT
> xmlagg(
[...]
> )--xmlagg
> FROM __pg_test_table AS dh
> WHERE dh.__rel=5 LIMIT 2 --OFFSET 10;

According to the documentation, that query should return
exactly one row since xmlagg is an aggregate.

So the LIMIT 2 won't do anything to the result.

You can wrap your query in a
SELECT count(*) FROM (SELECT ...) AS dummy;
to see how many rows you got.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nelson Green 2013-11-26 13:26:22 Re: Inserting rows containing composite foreign keys
Previous Message Albe Laurenz 2013-11-26 13:05:58 Re: Autodocumenting plpgsql function