Line data Source code
1 : /*-------------------------------------------------------------------------
2 : *
3 : * dbasedesc.c
4 : * rmgr descriptor routines for commands/dbcommands.c
5 : *
6 : * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
7 : * Portions Copyright (c) 1994, Regents of the University of California
8 : *
9 : *
10 : * IDENTIFICATION
11 : * src/backend/access/rmgrdesc/dbasedesc.c
12 : *
13 : *-------------------------------------------------------------------------
14 : */
15 : #include "postgres.h"
16 :
17 : #include "commands/dbcommands_xlog.h"
18 : #include "lib/stringinfo.h"
19 :
20 :
21 : void
22 0 : dbase_desc(StringInfo buf, XLogReaderState *record)
23 : {
24 0 : char *rec = XLogRecGetData(record);
25 0 : uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
26 :
27 0 : if (info == XLOG_DBASE_CREATE)
28 : {
29 0 : xl_dbase_create_rec *xlrec = (xl_dbase_create_rec *) rec;
30 :
31 0 : appendStringInfo(buf, "copy dir %u/%u to %u/%u",
32 : xlrec->src_db_id, xlrec->src_tablespace_id,
33 : xlrec->db_id, xlrec->tablespace_id);
34 : }
35 0 : else if (info == XLOG_DBASE_DROP)
36 : {
37 0 : xl_dbase_drop_rec *xlrec = (xl_dbase_drop_rec *) rec;
38 :
39 0 : appendStringInfo(buf, "dir %u/%u",
40 : xlrec->db_id, xlrec->tablespace_id);
41 : }
42 0 : }
43 :
44 : const char *
45 0 : dbase_identify(uint8 info)
46 : {
47 0 : const char *id = NULL;
48 :
49 0 : switch (info & ~XLR_INFO_MASK)
50 : {
51 : case XLOG_DBASE_CREATE:
52 0 : id = "CREATE";
53 0 : break;
54 : case XLOG_DBASE_DROP:
55 0 : id = "DROP";
56 0 : break;
57 : }
58 :
59 0 : return id;
60 : }
|