Re: Variable LIMIT and OFFSET in SELECTs - Mailing list pgsql-general

From Sam Mason
Subject Re: Variable LIMIT and OFFSET in SELECTs
Date
Msg-id 20071115173139.GH1955@frubble.xen.chris-lamb.co.uk
Whole thread Raw
In response to Re: Variable LIMIT and OFFSET in SELECTs  (Reg Me Please <regmeplease@gmail.com>)
Responses Re: Variable LIMIT and OFFSET in SELECTs  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Thu, Nov 15, 2007 at 06:08:20PM +0100, Reg Me Please wrote:
> Your remarks make a lot of sense. Of course.

good! it's interesting to see how things like this fit together.

> But then why allowing the LIMIT and the OFFSET as coming from function
> argument evaluations?

I believe the query is planned by ignoring the LIMIT and OFFSET.

> Isn't this breaking the planner?
> Of course I would say no, as in my case it's just working fine, only
> more complex to write that the "simpler" way.

Strictly speaking, I don't see why you couldn't put an IMMUTABLE
expression into a LIMIT or OFFSET.  The query could be planned, by
ignoring the LIMIT and OFFSET, and then when the actual query was
executed they would be evaluated and the results fed into the right
places.  I guess it's not been a problem before so nobody's spent the
time/effort to write all the code.


  Sam

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: [ADMIN] "global/pg_control": Permission denied
Next
From: Andrew Sullivan
Date:
Subject: Re: PLpgsql debugger question