You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-11-05 04:30:41 +03:00
Remove dependency on pg_database.datlastsysoid.
This column has been removed in PostgreSQL 15. Rather than add a lot of special handling, it seems better just to update all versions to not depend on this column. Add centralized functions to identify the type of database (i.e. system or user) by name and use FirstNormalObjectId when a name is not available. The new query in the db module will still return the prior result for PostgreSQL <= 15, which will be stored in the manifest. This is important to preserve behavior when downgrading pgBackRest. There are no concerns here for PostgreSQL 15 since older versions of pgBackRest won't be able to restore backups for PostgreSQL 15 anyway.
This commit is contained in:
@@ -10,6 +10,7 @@ PostgreSQL Interface
|
||||
#include "common/memContext.h"
|
||||
#include "common/regExp.h"
|
||||
#include "postgres/interface.h"
|
||||
#include "postgres/interface/static.vendor.h"
|
||||
#include "postgres/interface/version.h"
|
||||
#include "postgres/version.h"
|
||||
#include "storage/helper.h"
|
||||
@@ -239,6 +240,39 @@ pgInterfaceVersion(unsigned int pgVersion)
|
||||
FUNCTION_TEST_RETURN_TYPE_CONST_P(PgInterface, result);
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
bool
|
||||
pgDbIsTemplate(const String *const name)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STRING, name);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
FUNCTION_TEST_RETURN(BOOL, strEqZ(name, "template0") || strEqZ(name, "template1"));
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
bool
|
||||
pgDbIsSystem(const String *const name)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STRING, name);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
FUNCTION_TEST_RETURN(BOOL, strEqZ(name, "postgres") || pgDbIsTemplate(name));
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
bool
|
||||
pgDbIsSystemId(const unsigned int id)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(UINT, id);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
FUNCTION_TEST_RETURN(BOOL, id < FirstNormalObjectId);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Check expected WAL segment size for older PostgreSQL versions
|
||||
***********************************************************************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user