Search Postgresql Archives

Re: Variable LIMIT and OFFSET in SELECTs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sam Mason <sam@xxxxxxxxxxxxx> writes:
> In relational algebra terms, try thinking about what would happen if you
> did something like:

>   SELECT * FROM foo LIMIT val;

> Where the table foo has more than one row (and val had different values
> for each row).  Which row would the database use?  I believe these are
> the semantics Trevor was referring to.

Exactly: if the numbers are coming from within the query then there is
no guarantee that there's a unique value to use.  The numbers can be
variable so long as they come from "outside" the query and so are fixed
over any one query execution.  That includes the case of a subselect
getting its limit from the outer query, for instance ... but not what
the OP was trying to do.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org/

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux