From: | Никита Старовойтов <nikstarall(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | possibility of partial data dumps with pg_dump |
Date: | 2022-10-04 05:57:31 |
Message-ID: | CAC5EiNMthnPAKugDj0D8-kfn21hPQnOuvDAMOHa4TDmzGYon4w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello,
with a view to meeting with postgres code and to get some practice with it,
I am making a small patch that adds the possibility of partial tables dump.
A rule of filtering is specified with standard SQL where clause (without
"where" keyword)
There are three ways to send data filters over command line:
1) using table pattern in "where" parameter with divider '@'
... --where "table_pattern(at)where_condition" ...
"Where" condition will be used for all tables that match the search pattern.
2) using table parameter before any table inclusion
... --where "where condition" ...
All tables in databases will be filtered with input condition.
3) using "where" parameter after table pattern
... -t table_pattern --where where_condition ...
Only tables matching to last pattern before --where will be filtered. Third
way is necessary to shorten the command
line and to avoid duplicating tables pattern when specific tables are
dumped.
Also filters may be input from files.
A file consists of lines, and every line is a table pattern or a where
condition for data.
For example, file
"""
where column_name_1 == 1
table_pattern
table_pattern where column_name_2 == 1
"""
corresponds to parameters
--where "column_name_1 == 1" -t table_pattern --where "column_name_2 == 1"
The file format is not very good, because it doesn't provide sending
patterns of other components such as schemas for example.
And I am ready to change it, if functionality is actually needed.
All use cases are provided with tests.
I will be grateful if patch will get a discussion.
Attachment | Content-Type | Size |
---|---|---|
where_condition_v1.patch | application/octet-stream | 14.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Kyotaro Horiguchi | 2022-10-04 06:17:06 | Re: Use XLogFromFileName() in pg_resetwal to parse position from WAL file |
Previous Message | Peter Geoghegan | 2022-10-04 05:45:37 | Re: New strategies for freezing, advancing relfrozenxid early |