Re: PL/PGSQL + inserts+updates+limit - Postgres 9.3

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: PL/PGSQL + inserts+updates+limit - Postgres 9.3
Дата
Msg-id 929089c5-c62c-17bb-28e5-3a645ed570ed@aklaver.com
обсуждение исходный текст
Ответ на Re: PL/PGSQL + inserts+updates+limit - Postgres 9.3  (Patrick B <patrickbakerbr@gmail.com>)
Ответы Re: PL/PGSQL + inserts+updates+limit - Postgres 9.3  (Patrick B <patrickbakerbr@gmail.com>)
Список pgsql-general
On 06/06/2016 09:01 PM, Patrick B wrote:
> Ok so guys....
>
>         CREATE or REPLACE FUNCTION function_data_1()
>
>         RETURNS SETOF bigint AS $$
>
>
>         declare
>
>                 row record;
>
>
>         BEGIN
>
>
>         [...]
>
>
>         FOR row IN EXECUTE '
>
>                     SELECT
>
>                             t1.file_id,
>
>                             t1.path,
>
>                             t1.account_id
>
>                     FROM
>
>                             table1 t1
>
>                     JOIN
>
>                             table3 t3 ON t3.file_Id = t1.file_id
>
>                     WHERE
>
>                             t3.migrated = 0
>
>                     AND
>
>                            *t3.account_id = 1112*
>
>                     ORDER BY 1 LIMIT 30 '
>
>
>         [...]
>
>
>
>  How can I make the function works with account_id?
>
> *Example: select function_data_1(1112)*
>
> and then it will do all the work just for that specific account_id?

https://www.postgresql.org/docs/9.5/static/plpgsql-declarations.html#PLPGSQL-DECLARATION-PARAMETERS

>
> If you guys please could give me the way to do that..
> thanks
> Patrick


--
Adrian Klaver
adrian.klaver@aklaver.com


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

Предыдущее
От: Nikhil
Дата:
Сообщение: 2 node bdr setup gives error in replication slots
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Re-sync slave server