Can we generate a series of tables in a loop and then use another loop to union all?

Поиск
Список
Период
Сортировка
Искать

Can we generate a series of tables in a loop and then use another loop to union all?

От:
Shaozhong SHI <shishaozhong@gmail.com>
Дата:
Can we do the following?

for j in 1..max loop
create table j as select .............
end loop;

Then,  We do 


Alternatively, can we generate an empty table and append each newly generated table to it so that we end up with a whole table?

Regards,

David

Re: Can we generate a series of tables in a loop and then use another loop to union all?

От:
Frank Gard <frank.von.postgresql.org@familie-gard.de>
Дата:

Hi,

you can use PL/pgSQL's "EXECUTE" to do such things.

Cheers,
Frank.

Am 13.10.22 um 17:44 schrieb Shaozhong SHI:
Can we do the following?

for j in 1..max loop
create table j as select .............
end loop;

Then,  We do 


Alternatively, can we generate an empty table and append each newly generated table to it so that we end up with a whole table?

Regards,

David
FAQ