Re: LIMITing number of results in a VIEW with global variables

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: LIMITing number of results in a VIEW with global variables
Дата
Msg-id CA+TgmoaaM+kUGZ+LWA02ABqfq1AdWW_E_Sip2Q0vCtoouLdDoQ@mail.gmail.com
обсуждение исходный текст
Ответ на LIMITing number of results in a VIEW with global variables  (Thomas Girault <toma.girault@gmail.com>)
Ответы Re: LIMITing number of results in a VIEW with global variables
Список pgsql-hackers
On Fri, Oct 14, 2011 at 10:43 AM, Thomas Girault <toma.girault@gmail.com> wrote:
> I am now trying to limit the number of results in the view according
> to the global value K :
>
> CREATE OR REPLACE VIEW filtered_employees AS
>    SELECT *, get_mu() as mu
>    FROM employees
>    ORDER BY mu DESC
>    LIMIT K;

Well, SQL, our our dialect of it anyway, doesn't have global
variables.  So I think the above is going to throw a syntax error.
You may have global variables in your C code, but those won't be
visible from the SQL level.

In general, I think you'd be better off not relying on C global
variables either, and instead passing the values you need as function
arguments.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


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

Предыдущее
От: Nathan Boley
Дата:
Сообщение: Re: WIP: collect frequency statistics for arrays
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Call stacks and RAISE INFO