Create function get_pg_version() to read PG_VERSION

With the recovery configuration changes in PostgreSQL 12, there will
be situations where we'll need to determine the version number from
a dormant data directory in order to determine whether to write
recovery.conf or not.
This commit is contained in:
Ian Barwick
2018-11-27 09:38:01 +09:00
parent 793d83b22c
commit 5ff3744895
2 changed files with 60 additions and 36 deletions

View File

@@ -12,6 +12,7 @@
#include "postgres_fe.h"
#include "catalog/pg_control.h"
#define MAX_VERSION_STRING 24
/*
* A simplified representation of pg_control containing only those fields
* required by repmgr.
@@ -329,7 +330,7 @@ typedef struct ControlFileData11
} ControlFileData11;
extern int get_pg_version(const char *data_directory, char *version_string);
extern DBState get_db_state(const char *data_directory);
extern const char *describe_db_state(DBState state);
extern int get_data_checksum_version(const char *data_directory);