Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id DD29B632ADB for ; Wed, 18 Nov 2009 15:28:59 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 13599-03 for ; Wed, 18 Nov 2009 19:28:45 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-yx0-f181.google.com (mail-yx0-f181.google.com [209.85.210.181]) by mail.postgresql.org (Postfix) with ESMTP id 395216329B9 for ; Wed, 18 Nov 2009 15:28:48 -0400 (AST) Received: by yxe11 with SMTP id 11so1282686yxe.15 for ; Wed, 18 Nov 2009 11:28:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=1wfOcNYOWdlxFtfCvNSDZBc1mVuuT8piCGC83jkeW7k=; b=e8seq62s8O1S3MkOssYbbg3yiTos2BfV6lHEA3F2BOmvYioVU2ZkUNXnStbQ9cLsN3 isYcKOUc7wjbbhKp28o+x2tY7Bcua/lKUO2dCtq3p0bYVp5bHzLbRS6RA3ly9mNtIGMJ PJRK2wNvB8o79ZnKyzlq0YaGvcJq3FNhFuBgk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=FO6EXeLn+Dghp90li1dKhk6R1BvX5YCl9SkN3kWxRoxWRXat7X7eTiw5HufGyUOA4f ER+VSNvAmROBa7wCCq4sLO3wUR+M5nzPU+TARboWb8Dxb7ruS115I/oZq0BwrgzUMStE EGi4yl9rzaF2ZjGTXPnTtmnuJdp+6RLMkrRUE= MIME-Version: 1.0 Received: by 10.90.255.1 with SMTP id c1mr2721278agi.115.1258572526747; Wed, 18 Nov 2009 11:28:46 -0800 (PST) In-Reply-To: <200911182027.08857.guillaume@lelarge.info> References: <5ab13580911181121g6e89759doa6c6ea6557424f71@mail.gmail.com> <200911182027.08857.guillaume@lelarge.info> Date: Wed, 18 Nov 2009 16:28:46 -0300 Message-ID: Subject: Re: LIMIT BASED ON PERCENT From: Another Trad To: Guillaume Lelarge Cc: pgsql-sql@postgresql.org, Lee Hachadoorian Content-Type: multipart/alternative; boundary=001636283f386180360478aa40b8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.707 tagged_above=-10 required=5 tests=AWL=0.891, BAYES_00=-2.599, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200911/53 X-Sequence-Number: 33404 --001636283f386180360478aa40b8 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable But there is any way to do it? 2009/11/18 Guillaume Lelarge > Le mercredi 18 novembre 2009 =E0 20:24:09, Another Trad a =E9crit : > > 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 > --001636283f386180360478aa40b8 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable But there is any way to do it?

2009/11/18= Guillaume Lelarge <guillaume@lelarge.info>
Le mercredi 18 novembre 2009 =E0 20:24:09, Another Trad a =E9crit :
> No, It doesn't.
> In my machine:
>
> First select
> ERROR: =A0syntax error at end of input
> LINE 1: select * from rapadura.cliente limit 20%
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 ^
> Second one:
> ERROR: =A0argument 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 earlie= r
releases, there's no way to do this in a single query.


--
Guillaume.
=A0http://www.pos= tgresqlfr.org
=A0http://dalibo.com

--001636283f386180360478aa40b8--