summaryrefslogtreecommitdiff
path: root/src/backend/commands/tablespace.c
diff options
context:
space:
mode:
authorTom Lane2006-03-24 04:32:13 +0000
committerTom Lane2006-03-24 04:32:13 +0000
commit0a202070603bf38ce2e2fc11a7f897fc06603b80 (patch)
treea856ccc9da2bf3ec6ec57da03788e27e89c22428 /src/backend/commands/tablespace.c
parent4fb92718be654b38652dfe893d075f3862e84eae (diff)
Arrange to emit a description of the current XLOG record as error context
when an error occurs during xlog replay. Also, replace the former risky 'write into a fixed-size buffer with no overflow detection' API for XLOG record description routines; use an expansible StringInfo instead. (The latter accounts for most of the patch bulk.) Qingqing Zhou
Diffstat (limited to 'src/backend/commands/tablespace.c')
-rw-r--r--src/backend/commands/tablespace.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c
index a5d4a7a5f24..026bbf5169f 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.31 2006/03/05 15:58:25 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.32 2006/03/24 04:32:13 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1042,7 +1042,7 @@ tblspc_redo(XLogRecPtr lsn, XLogRecord *record)
}
void
-tblspc_desc(char *buf, uint8 xl_info, char *rec)
+tblspc_desc(StringInfo buf, uint8 xl_info, char *rec)
{
uint8 info = xl_info & ~XLR_INFO_MASK;
@@ -1050,16 +1050,15 @@ tblspc_desc(char *buf, uint8 xl_info, char *rec)
{
xl_tblspc_create_rec *xlrec = (xl_tblspc_create_rec *) rec;
- sprintf(buf + strlen(buf), "create ts: %u \"%s\"",
+ appendStringInfo(buf, "create ts: %u \"%s\"",
xlrec->ts_id, xlrec->ts_path);
}
else if (info == XLOG_TBLSPC_DROP)
{
xl_tblspc_drop_rec *xlrec = (xl_tblspc_drop_rec *) rec;
- sprintf(buf + strlen(buf), "drop ts: %u",
- xlrec->ts_id);
+ appendStringInfo(buf, "drop ts: %u", xlrec->ts_id);
}
else
- strcat(buf, "UNKNOWN");
+ appendStringInfo(buf, "UNKNOWN");
}