@ -34,6 +34,7 @@ pg_control_system(PG_FUNCTION_ARGS)
TupleDesc tupdesc ;
TupleDesc tupdesc ;
HeapTuple htup ;
HeapTuple htup ;
ControlFileData * ControlFile ;
ControlFileData * ControlFile ;
bool crc_ok ;
/*
/*
* Construct a tuple descriptor for the result row . This must match this
* Construct a tuple descriptor for the result row . This must match this
@ -51,8 +52,8 @@ pg_control_system(PG_FUNCTION_ARGS)
tupdesc = BlessTupleDesc ( tupdesc ) ;
tupdesc = BlessTupleDesc ( tupdesc ) ;
/* read the control file */
/* read the control file */
ControlFile = get_controlfile ( DataDir , NULL ) ;
ControlFile = get_controlfile ( DataDir , NULL , & crc_ok ) ;
if ( ! ControlFile )
if ( ! crc_ok )
ereport ( ERROR ,
ereport ( ERROR ,
( errmsg ( " calculated CRC checksum does not match value stored in file " ) ) ) ;
( errmsg ( " calculated CRC checksum does not match value stored in file " ) ) ) ;
@ -83,6 +84,7 @@ pg_control_checkpoint(PG_FUNCTION_ARGS)
ControlFileData * ControlFile ;
ControlFileData * ControlFile ;
XLogSegNo segno ;
XLogSegNo segno ;
char xlogfilename [ MAXFNAMELEN ] ;
char xlogfilename [ MAXFNAMELEN ] ;
bool crc_ok ;
/*
/*
* Construct a tuple descriptor for the result row . This must match this
* Construct a tuple descriptor for the result row . This must match this
@ -130,8 +132,8 @@ pg_control_checkpoint(PG_FUNCTION_ARGS)
tupdesc = BlessTupleDesc ( tupdesc ) ;
tupdesc = BlessTupleDesc ( tupdesc ) ;
/* Read the control file. */
/* Read the control file. */
ControlFile = get_controlfile ( DataDir , NULL ) ;
ControlFile = get_controlfile ( DataDir , NULL , & crc_ok ) ;
if ( ! ControlFile )
if ( ! crc_ok )
ereport ( ERROR ,
ereport ( ERROR ,
( errmsg ( " calculated CRC checksum does not match value stored in file " ) ) ) ;
( errmsg ( " calculated CRC checksum does not match value stored in file " ) ) ) ;
@ -216,6 +218,7 @@ pg_control_recovery(PG_FUNCTION_ARGS)
TupleDesc tupdesc ;
TupleDesc tupdesc ;
HeapTuple htup ;
HeapTuple htup ;
ControlFileData * ControlFile ;
ControlFileData * ControlFile ;
bool crc_ok ;
/*
/*
* Construct a tuple descriptor for the result row . This must match this
* Construct a tuple descriptor for the result row . This must match this
@ -235,8 +238,8 @@ pg_control_recovery(PG_FUNCTION_ARGS)
tupdesc = BlessTupleDesc ( tupdesc ) ;
tupdesc = BlessTupleDesc ( tupdesc ) ;
/* read the control file */
/* read the control file */
ControlFile = get_controlfile ( DataDir , NULL ) ;
ControlFile = get_controlfile ( DataDir , NULL , & crc_ok ) ;
if ( ! ControlFile )
if ( ! crc_ok )
ereport ( ERROR ,
ereport ( ERROR ,
( errmsg ( " calculated CRC checksum does not match value stored in file " ) ) ) ;
( errmsg ( " calculated CRC checksum does not match value stored in file " ) ) ) ;
@ -268,6 +271,7 @@ pg_control_init(PG_FUNCTION_ARGS)
TupleDesc tupdesc ;
TupleDesc tupdesc ;
HeapTuple htup ;
HeapTuple htup ;
ControlFileData * ControlFile ;
ControlFileData * ControlFile ;
bool crc_ok ;
/*
/*
* Construct a tuple descriptor for the result row . This must match this
* Construct a tuple descriptor for the result row . This must match this
@ -303,8 +307,8 @@ pg_control_init(PG_FUNCTION_ARGS)
tupdesc = BlessTupleDesc ( tupdesc ) ;
tupdesc = BlessTupleDesc ( tupdesc ) ;
/* read the control file */
/* read the control file */
ControlFile = get_controlfile ( DataDir , NULL ) ;
ControlFile = get_controlfile ( DataDir , NULL , & crc_ok ) ;
if ( ! ControlFile )
if ( ! crc_ok )
ereport ( ERROR ,
ereport ( ERROR ,
( errmsg ( " calculated CRC checksum does not match value stored in file " ) ) ) ;
( errmsg ( " calculated CRC checksum does not match value stored in file " ) ) ) ;