From: | Kris Kewley <kris(dot)kewley(at)gmail(dot)com> |
---|---|
To: | Guillaume Lelarge <guillaume(at)lelarge(dot)info> |
Cc: | "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>, Another Trad <anothertrad(at)gmail(dot)com>, Lee Hachadoorian <lee(dot)hachadoorian(at)gmail(dot)com> |
Subject: | Re: LIMIT BASED ON PERCENT |
Date: | 2009-11-19 00:20:24 |
Message-ID: | E1C9300E-A2D5-4B70-8C4F-6B272915BDBF@gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Could you not create a function to do this instead?
Set var_limit = 20% of row count
Replace subquery with var_limit
Kris
On 18-Nov-09, at 14:27, Guillaume Lelarge <guillaume(at)lelarge(dot)info>
wrote:
> Le mercredi 18 novembre 2009 à 20:24:09, Another Trad a écrit :
>> No, It doesn't.
>> In my machine:
>>
>> First select
>> ERROR: syntax error at end of input
>> LINE 1: select * from rapadura.cliente limit 20%
>> ^
>> Second one:
>> ERROR: argument of LIMIT must not contain subqueries
>>
>> Postgres 8.3
>>
>
> It works for Lee because obviously he's working on a 8.4 server. You
> can use
> subquery in a LIMIT clause if you have an 8.4 PostgreSQL server. For
> earlier
> releases, there's no way to do this in a single query.
>
>
> --
> Guillaume.
> http://www.postgresqlfr.org
> http://dalibo.com
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
From | Date | Subject | |
---|---|---|---|
Next Message | Guillaume Lelarge | 2009-11-19 06:47:59 | Re: LIMIT BASED ON PERCENT |
Previous Message | Pavel Stehule | 2009-11-18 19:39:34 | Re: LIMIT BASED ON PERCENT |