xmlagg doesn't honor LIMIT?

From: Peter Kroon <plakroon(at)gmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: xmlagg doesn't honor LIMIT?
Date: 2013-11-26 13:02:15
Message-ID: CAOh+DOkcFjjf0bsaNA8iVqY-_4Q-DWwivaMU5RrTSJUH9vL0ew@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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..

"PostgreSQL 9.2.4 on i686-pc-linux-gnu, compiled by gcc (GCC) 4.1.2
20080704 (Red Hat 4.1.2-52), 32-bit"

DROP TABLE IF EXISTS __pg_test_table CASCADE;
CREATE TABLE __pg_test_table(
id serial,
some_value int,
__rel int
);
INSERT INTO __pg_test_table(some_value,__rel)VALUES(1,5);
INSERT INTO __pg_test_table(some_value,__rel)VALUES(2,5);
INSERT INTO __pg_test_table(some_value,__rel)VALUES(3,5);
INSERT INTO __pg_test_table(some_value,__rel)VALUES(4,5);
INSERT INTO __pg_test_table(some_value,__rel)VALUES(5,5);
INSERT INTO __pg_test_table(some_value,__rel)VALUES(6,6);
INSERT INTO __pg_test_table(some_value,__rel)VALUES(7,6);
INSERT INTO __pg_test_table(some_value,__rel)VALUES(8,6);
INSERT INTO __pg_test_table(some_value,__rel)VALUES(9,6);
INSERT INTO __pg_test_table(some_value,__rel)VALUES(10,6);

SELECT
xmlagg(
xmlconcat(
xmlelement(name test_element,
xmlattributes(
0 AS m
),
xmlforest(
dh.id AS i
,dh.some_value AS sv
)--xmlforest
)--test_element
)--xmlconcat
ORDER BY id DESC
)--xmlagg
FROM __pg_test_table AS dh
WHERE dh.__rel=5 LIMIT 2 --OFFSET 10;

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2013-11-26 13:05:58 Re: Autodocumenting plpgsql function
Previous Message Rémi Cura 2013-11-26 12:13:16 Re: Autodocumenting plpgsql function