Re: Variable LIMIT and OFFSET in SELECTs

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Variable LIMIT and OFFSET in SELECTs
Date: 2007-11-15 17:31:39
Message-ID: 20071115173139.GH1955@frubble.xen.chris-lamb.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2007-11-15 17:34:36 Re: PLpgsql debugger question
Previous Message Alvaro Herrera 2007-11-15 17:27:07 Re: [GENERAL] "global/pg_control": Permission denied