Skip site navigation (1) Skip section navigation (2)

Re: array_agg + limit

From: Lew <noone(at)lewscanon(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: array_agg + limit
Date: 2010-11-27 15:24:03
Message-ID: icr7qv$ip1$1@news.albasani.net (view raw or flat)
Thread:
Lists: pgsql-general
Emanuel Calvo Franco wrote:
> I'm having this 'issue':
>
> coches=# select array_agg(patente order by fecha desc) from
> dia4.infraccion limit 6;
>
>                                 array_agg
> --------------------------------------------------------------------------
> -----------------------------------------------------------------
> --------------------------------------------------------------------------
>   {565538,726668,639414,739391,674212,941061,636533,981958,999057,743729,548494,923939,841427,454574,363754,670514,566266,251071,852043,1537
> 11,952549,129124,446671,476345,168905,308274,404812,501024,738098,636071}
> (1 row)
>
> I now [know] why it happens an[d] how [to] avoid it, but.... it's ok?
> Must work like this?

Yes and yes.  LIMIT applies to the number of rows, and that's how it's documented.
<http://www.postgresql.org/docs/9.0/interactive/queries-limit.html>

-- 
Lew

In response to

Responses

pgsql-general by date

Next:From: Emanuel Calvo FrancoDate: 2010-11-27 18:26:24
Subject: Re: array_agg + limit
Previous:From: Alban HertroysDate: 2010-11-27 14:31:01
Subject: Re: Help on explain analyze

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group