Re: Variable LIMIT and OFFSET in SELECTs

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Variable LIMIT and OFFSET in SELECTs
Дата
Msg-id 5387.1195147554@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Variable LIMIT and OFFSET in SELECTs  (Sam Mason <sam@samason.me.uk>)
Ответы Re: Variable LIMIT and OFFSET in SELECTs  (Gregory Stark <stark@enterprisedb.com>)
Список pgsql-general
Sam Mason <sam@samason.me.uk> 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

В списке pgsql-general по дате отправления:

Предыдущее
От: Steve Atkins
Дата:
Сообщение: Re: PLpgsql debugger question
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: [ADMIN] "global/pg_control": Permission denied