Re: I have an exporting need...

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: I have an exporting need...
Дата
Msg-id 1091077.1715698469@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: I have an exporting need...  (Heikki Linnakangas <hlinnaka@iki.fi>)
Ответы Re: I have an exporting need...  (Juan Hernández <dejesusog@gmail.com>)
Список pgsql-hackers
Heikki Linnakangas <hlinnaka@iki.fi> writes:
> On 13/05/2024 16:01, Juan Hernández wrote:
>> Do you consider useful to add a parameter (for example, 
>> --separatetables) so when used the exporting file process can create a 
>> different tablename.sql file for each table in database automatically?

> It'd be tricky to restore from, as you need to restore the tables in the 
> right order. I think you'd still need a "main" sql file that includes 
> all the other files in the right order. And using the table names as 
> filenames gets tricky if the table names contain any funny characters.

It's a lot worse than that, as it's entirely possible to have circular
FK dependencies, meaning there is no "right order" if you think of
each table file as self-contained DDL plus data.  Other sorts of
circularities are possible too.

pg_dump deals with that hazard by splitting things up: first create
all the tables, then load all the data, then create all the indexes
and foreign keys.  You can tell it to just emit the parts relevant to
a particular table, but it's on your head whether that's actually
going to be useful in your context.  I doubt that it's widely enough
useful to justify creating a special mode beyond what we already
have.

            regards, tom lane



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

Предыдущее
От: Justin Pryzby
Дата:
Сообщение: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Dump-restore loosing 'attnotnull' bit for DEFERRABLE PRIMARY KEY column(s).