From: Kris Kewley <kris.kewley@gmail.com>
To: Guillaume Lelarge <guillaume@lelarge.info>
Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Cc: Another Trad <anothertrad@gmail.com>
Cc: Lee Hachadoorian <lee.hachadoorian@gmail.com>
Subject: Re: LIMIT BASED ON PERCENT
Date: Wed, 18 Nov 2009 19:20:24 -0500
Message-ID: <E1C9300E-A2D5-4B70-8C4F-6B272915BDBF@gmail.com> (raw)
In-Reply-To: <200911182027.08857.guillaume@lelarge.info>
References: <af7271950911181112h574da17euf94d9640ec7680df@mail.gmail.com>
<5ab13580911181121g6e89759doa6c6ea6557424f71@mail.gmail.com>
<af7271950911181124i2a309729q2271d9f878e42f3d@mail.gmail.com>
<200911182027.08857.guillaume@lelarge.info>
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@lelarge.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@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: kris.kewley@gmail.com, guillaume@lelarge.info, anothertrad@gmail.com, lee.hachadoorian@gmail.com
Subject: Re: LIMIT BASED ON PERCENT
In-Reply-To: <E1C9300E-A2D5-4B70-8C4F-6B272915BDBF@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox