2012-11-28 16:35:01 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* dbasedesc.c
|
2013-05-29 22:58:43 +02:00
|
|
|
* rmgr descriptor routines for commands/dbcommands.c
|
2012-11-28 16:35:01 +01:00
|
|
|
*
|
2014-01-07 22:05:30 +01:00
|
|
|
* Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
|
2012-11-28 16:35:01 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* IDENTIFICATION
|
2013-05-29 22:58:43 +02:00
|
|
|
* src/backend/access/rmgrdesc/dbasedesc.c
|
2012-11-28 16:35:01 +01:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#include "postgres.h"
|
|
|
|
|
|
|
|
#include "commands/dbcommands.h"
|
|
|
|
#include "lib/stringinfo.h"
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2014-06-14 09:46:48 +02:00
|
|
|
dbase_desc(StringInfo buf, XLogRecord *record)
|
2012-11-28 16:35:01 +01:00
|
|
|
{
|
2014-06-14 09:46:48 +02:00
|
|
|
char *rec = XLogRecGetData(record);
|
|
|
|
uint8 info = record->xl_info & ~XLR_INFO_MASK;
|
2012-11-28 16:35:01 +01:00
|
|
|
|
|
|
|
if (info == XLOG_DBASE_CREATE)
|
|
|
|
{
|
|
|
|
xl_dbase_create_rec *xlrec = (xl_dbase_create_rec *) rec;
|
|
|
|
|
|
|
|
appendStringInfo(buf, "create db: copy dir %u/%u to %u/%u",
|
|
|
|
xlrec->src_db_id, xlrec->src_tablespace_id,
|
|
|
|
xlrec->db_id, xlrec->tablespace_id);
|
|
|
|
}
|
|
|
|
else if (info == XLOG_DBASE_DROP)
|
|
|
|
{
|
|
|
|
xl_dbase_drop_rec *xlrec = (xl_dbase_drop_rec *) rec;
|
|
|
|
|
|
|
|
appendStringInfo(buf, "drop db: dir %u/%u",
|
|
|
|
xlrec->db_id, xlrec->tablespace_id);
|
|
|
|
}
|
|
|
|
else
|
2013-10-31 15:55:59 +01:00
|
|
|
appendStringInfoString(buf, "UNKNOWN");
|
2012-11-28 16:35:01 +01:00
|
|
|
}
|