Re: Variable LIMIT and OFFSET in SELECTs

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Reg Me Please <regmeplease(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, Sam Mason <sam(at)samason(dot)me(dot)uk>
Subject: Re: Variable LIMIT and OFFSET in SELECTs
Date: 2007-11-16 07:33:14
Message-ID: 27857.1195198394@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Reg Me Please <regmeplease(at)gmail(dot)com> writes:
>> The OP's complaint is that we don't allow a variable of the query's own
>> level, but AFAICT he's still not grasped the point that that leads to an
>> indeterminate limit value ...

> So it works, but it's not serious enough to be unlocked.

You really don't have a clue what this is about, do you?
Let me try to explain one more time. You propose allowing

select ... from
table1 join table2 on table1.x = table2.y
limit table1.z

Now this would be somewhat well-defined if there were only one row in
table1, or if there were many rows but they all had the same value
in column z. But what if that's not the case? If there are multiple
possible values for z then the query is just not sensible.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Anton 2007-11-16 07:48:20 ERROR: out of memory
Previous Message Tom Lane 2007-11-16 07:20:47 Re: Variable LIMIT and OFFSET in SELECTs