public inbox for [email protected]  
help / color / mirror / Atom feed
From: Shaozhong SHI <[email protected]>
To: pgsql-sql <[email protected]>
Subject: Append a list of tables to an empty table to form a whole table
Date: Fri, 14 Oct 2022 07:00:24 +0100
Message-ID: <CA+i5JwaD2rz-jJdm9_SK=88z=J0SDNmij98hMZxCwLuHxbz2Mw@mail.gmail.com> (raw)
In-Reply-To: <CA+i5JwYX9jDXv2fS9u6JP24=xpaTX_r6SXMjUCg5JGwTA2cPog@mail.gmail.com>
References: <CA+i5JwYX9jDXv2fS9u6JP24=xpaTX_r6SXMjUCg5JGwTA2cPog@mail.gmail.com>

How best to append a list of tables to an empty table to form a whole table?

Pseudo codes show the desirable logic.



There are a list of tables with exactly same colums
table_a
table_b
table_c

Create an empty table  emp_table

Foreach a_name in ARRAY ARRAY['table_a', 'table_b', 'table_c'] loop
   insert into em_table as select * from table a_name

end loop;

Can something like that be done is PostGIS?

Regards,

David


view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Append a list of tables to an empty table to form a whole table
  In-Reply-To: <CA+i5JwaD2rz-jJdm9_SK=88z=J0SDNmij98hMZxCwLuHxbz2Mw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox