Re: loops

Поиск
Список
Период
Сортировка
Искать
От
Merlin Moncure
Тема
Re: loops
Дата
Msg-id
b42b73150906021330x744770f8k43450ccfe8409f34@mail.gmail.com
Ответ на
Re: loops (John R Pierce)
Список
Дерево обсуждения
loops "Esneiker" <eenriquez@cav.desoft.cu>
Re: loops hubert depesz lubaczewski <depesz@depesz.com>
Re: loops John R Pierce <pierce@hogranch.com>
Re: loops Merlin Moncure <mmoncure@gmail.com>
On Tue, Jun 2, 2009 at 12:24 PM, John R Pierce  wrote:
> Esneiker wrote:
>>
>> Hello, can anybody tell me how to do loops in postgres?
>>
>
> SQL, the query language, has no such control structures.  SQL is a
> 'declarative' language rather than a procedural one.
>
> pl/pgsql stored procedures do, however, as they embed SQL in a procedural
> context. depesz posted the link to the appropriate docs.

you can simulate simple loops with 'generate_series' and other set
returning functions like unnest or equivalent:

insert into foo(foo_id) select generate_series(1,10) v;
insert  into foo(val) select unnest(current_schemas(true));
В списке pgsql-general по дате отправления
От: Ben Chobot
Дата:
Сообщение: Re: Really out of memory?
От: Geoffrey
Дата:
FAQ