Hi,
Since an exclusive backup method was dropped in v15, in v15 or later, we need to create backup_label and tablespace_map
filesfrom the result of pg_backup_stop() when taking a base backup using low level backup API. One issue when doing
thisis that; there is no simple way to create those files from two columns "labelfile" and "spcmapfile" that
pg_backup_stop()returns if we execute it via psql. Probaby we need to store those columns in a temporary file and run
someOS commands or script to separate that file into backup_label and tablespace_map. This is not simple way, and which
wouldprevent users from migrating their backup scripts using psql from an exclusive backup method to non-exclusive one,
I'mafraid.
To enable us to do that more easily, how about adding the pg_backup_label() function that returns backup_label and
tablespace_map?I'm thinking to make this function available just after pg_backup_start() finishes, also even after
pg_backup_stop()finishes. For example, this function allows us to take a backup using the following psql script file.
------------------------------
SELECT * FROM pg_backup_start('test');
\! cp -a $PGDATA /backup
SELECT * FROM pg_backup_stop();
\pset tuples_only on
\pset format unaligned
\o /backup/data/backup_label
SELECT labelfile FROM pg_backup_label();
\o /backup/data/tablespace_map
SELECT spcmapfile FROM pg_backup_label();
------------------------------
Attached is the WIP patch to add pg_backup_label function. No tests nor docs have been added yet, but if we can
successfullyreach the consensus for adding the function, I will update the patch.
Thought?
Regards,
--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION