Skip to content

Commit

Permalink
Add compatibility with PostgreSQL 9.5 Fixes: #4
Browse files Browse the repository at this point in the history
The incompatible changes have been introduced with commit
72d422a5227ef6f76f412486a395aba9f53bf3f0 during 9.5 development.

Ref: http://git.postgresql.org/gitweb/?p=postgresql.git;h=72d422a

Signed-off-by: Marco Nenciarini <marco.nenciarini@2ndquadrant.it>
  • Loading branch information
mnencia committed Dec 16, 2015
1 parent f667d04 commit 7bedbfb
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion pgespresso.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,39 @@ pgespresso_start_backup(PG_FUNCTION_ARGS)
elog(DEBUG1, "updated ThisTimeLineID = %u", ThisTimeLineID);
}

/*
* Starting from 9.5 the do_pg_start_backup caller needs to allocate the
* 'pg_tblspc' directory and pass it as argument.
*
* Ref: http://git.postgresql.org/gitweb/?p=postgresql.git;h=72d422a
*/
#if PG_VERSION_NUM >= 90500
{
DIR *dir;

/* Make sure we can open the directory with
tablespaces in it */
dir = AllocateDir("pg_tblspc");

if (!dir)
ereport(ERROR,
(errmsg("could not open directory \"%s\": %m", "pg_tblspc")));

/*
* We are not filling the tablespace map here.
* This means that on 9.5 the 'tablespace_map' file has to be
* generated by the invoker.
*/
do_pg_start_backup(backupidstr, fast, NULL, &labelfile,
dir, NULL, NULL, false, false);

FreeDir(dir);
}
/*
* Starting from 9.3 the do_pg_start_backup returns the timeline ID
* in *starttli_p additional argument
*/
#if PG_VERSION_NUM >= 90300
#elif PG_VERSION_NUM >= 90300
do_pg_start_backup(backupidstr, fast, NULL, &labelfile);
#else
do_pg_start_backup(backupidstr, fast, &labelfile);
Expand Down

0 comments on commit 7bedbfb

Please sign in to comment.