forbid_pg_xlogfile_name_during_recovery_v2.patch
application/octet-stream
Filename: forbid_pg_xlogfile_name_during_recovery_v2.patch
Type: application/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: context
Series: patch v2
| File | + | − |
|---|---|---|
| doc/src/sgml/func.sgml | 2 | 0 |
| src/backend/access/transam/xlog.c | 12 | 0 |
*** a/doc/src/sgml/func.sgml
--- b/doc/src/sgml/func.sgml
***************
*** 13064,13071 **** SELECT set_config('log_statement_stats', 'off', false);
<para>
The functions shown in <xref
linkend="functions-admin-backup-table"> assist in making on-line backups.
! Use of the first three functions is restricted to superusers. The first
! five functions cannot be executed during recovery.
</para>
<table id="functions-admin-backup-table">
--- 13064,13071 ----
<para>
The functions shown in <xref
linkend="functions-admin-backup-table"> assist in making on-line backups.
! These functions cannot be executed during recovery.
! Use of the first three functions is restricted to superusers.
</para>
<table id="functions-admin-backup-table">
*** a/src/backend/access/transam/xlog.c
--- b/src/backend/access/transam/xlog.c
***************
*** 8410,8415 **** pg_xlogfile_name_offset(PG_FUNCTION_ARGS)
--- 8410,8421 ----
HeapTuple resultHeapTuple;
Datum result;
+ if (RecoveryInProgress())
+ ereport(ERROR,
+ (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+ errmsg("recovery is in progress"),
+ errhint("pg_xlogfile_name_offset() cannot be executed during recovery.")));
+
/*
* Read input and parse
*/
***************
*** 8479,8484 **** pg_xlogfile_name(PG_FUNCTION_ARGS)
--- 8485,8496 ----
XLogRecPtr locationpoint;
char xlogfilename[MAXFNAMELEN];
+ if (RecoveryInProgress())
+ ereport(ERROR,
+ (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+ errmsg("recovery is in progress"),
+ errhint("pg_xlogfile_name() cannot be executed during recovery.")));
+
locationstr = text_to_cstring(location);
if (sscanf(locationstr, "%X/%X", &uxlogid, &uxrecoff) != 2)