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

From: Frank Gard <frank(dot)von(dot)postgresql(dot)org(at)familie-gard(dot)de>
To: pgsql-sql(at)lists(dot)postgresql(dot)org
Subject: Re: Can we generate a series of tables in a loop and then use another loop to union all?
Date: 2022-10-13 16:50:02
Message-ID: e0288eb1-5d3e-266a-6d1f-a4468786c53e@familie-gard.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Shaozhong SHI 2022-10-13 17:02:03 How to union all tables in a schema into one whole table?
Previous Message Shaozhong SHI 2022-10-13 15:44:39 Can we generate a series of tables in a loop and then use another loop to union all?