Header And Logo

PostgreSQL
| The world's most advanced open source database.

dbcommands.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * dbcommands.h
00004  *      Database management commands (create/drop database).
00005  *
00006  *
00007  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
00008  * Portions Copyright (c) 1994, Regents of the University of California
00009  *
00010  * src/include/commands/dbcommands.h
00011  *
00012  *-------------------------------------------------------------------------
00013  */
00014 #ifndef DBCOMMANDS_H
00015 #define DBCOMMANDS_H
00016 
00017 #include "access/xlog.h"
00018 #include "nodes/parsenodes.h"
00019 
00020 /* XLOG stuff */
00021 #define XLOG_DBASE_CREATE       0x00
00022 #define XLOG_DBASE_DROP         0x10
00023 
00024 typedef struct xl_dbase_create_rec_old
00025 {
00026     /* Records copying of a single subdirectory incl. contents */
00027     Oid         db_id;
00028     char        src_path[1];    /* VARIABLE LENGTH STRING */
00029     /* dst_path follows src_path */
00030 }   xl_dbase_create_rec_old;
00031 
00032 typedef struct xl_dbase_drop_rec_old
00033 {
00034     /* Records dropping of a single subdirectory incl. contents */
00035     Oid         db_id;
00036     char        dir_path[1];    /* VARIABLE LENGTH STRING */
00037 }   xl_dbase_drop_rec_old;
00038 
00039 typedef struct xl_dbase_create_rec
00040 {
00041     /* Records copying of a single subdirectory incl. contents */
00042     Oid         db_id;
00043     Oid         tablespace_id;
00044     Oid         src_db_id;
00045     Oid         src_tablespace_id;
00046 } xl_dbase_create_rec;
00047 
00048 typedef struct xl_dbase_drop_rec
00049 {
00050     /* Records dropping of a single subdirectory incl. contents */
00051     Oid         db_id;
00052     Oid         tablespace_id;
00053 } xl_dbase_drop_rec;
00054 
00055 extern Oid createdb(const CreatedbStmt *stmt);
00056 extern void dropdb(const char *dbname, bool missing_ok);
00057 extern Oid RenameDatabase(const char *oldname, const char *newname);
00058 extern Oid AlterDatabase(AlterDatabaseStmt *stmt, bool isTopLevel);
00059 extern Oid AlterDatabaseSet(AlterDatabaseSetStmt *stmt);
00060 extern Oid AlterDatabaseOwner(const char *dbname, Oid newOwnerId);
00061 
00062 extern Oid  get_database_oid(const char *dbname, bool missingok);
00063 extern char *get_database_name(Oid dbid);
00064 
00065 extern void dbase_redo(XLogRecPtr lsn, XLogRecord *rptr);
00066 extern void dbase_desc(StringInfo buf, uint8 xl_info, char *rec);
00067 
00068 extern void check_encoding_locale_matches(int encoding, const char *collate, const char *ctype);
00069 
00070 #endif   /* DBCOMMANDS_H */