init
This commit is contained in:
31
pg_include/commands/alter.h
Executable file
31
pg_include/commands/alter.h
Executable file
@@ -0,0 +1,31 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* alter.h
|
||||
* prototypes for commands/alter.c
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/commands/alter.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef ALTER_H
|
||||
#define ALTER_H
|
||||
|
||||
#include "catalog/dependency.h"
|
||||
#include "utils/acl.h"
|
||||
#include "utils/relcache.h"
|
||||
|
||||
extern void ExecRenameStmt(RenameStmt *stmt);
|
||||
extern void ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt);
|
||||
extern Oid AlterObjectNamespace_oid(Oid classId, Oid objid, Oid nspOid,
|
||||
ObjectAddresses *objsMoved);
|
||||
extern Oid AlterObjectNamespace(Relation rel, int oidCacheId, int nameCacheId,
|
||||
Oid objid, Oid nspOid,
|
||||
int Anum_name, int Anum_namespace, int Anum_owner,
|
||||
AclObjectKind acl_kind);
|
||||
extern void ExecAlterOwnerStmt(AlterOwnerStmt *stmt);
|
||||
|
||||
#endif /* ALTER_H */
|
||||
59
pg_include/commands/async.h
Executable file
59
pg_include/commands/async.h
Executable file
@@ -0,0 +1,59 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* async.h
|
||||
* Asynchronous notification: NOTIFY, LISTEN, UNLISTEN
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/commands/async.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef ASYNC_H
|
||||
#define ASYNC_H
|
||||
|
||||
#include "fmgr.h"
|
||||
|
||||
/*
|
||||
* The number of SLRU page buffers we use for the notification queue.
|
||||
*/
|
||||
#define NUM_ASYNC_BUFFERS 8
|
||||
|
||||
extern bool Trace_notify;
|
||||
|
||||
extern Size AsyncShmemSize(void);
|
||||
extern void AsyncShmemInit(void);
|
||||
|
||||
/* notify-related SQL statements */
|
||||
extern void Async_Notify(const char *channel, const char *payload);
|
||||
extern void Async_Listen(const char *channel);
|
||||
extern void Async_Unlisten(const char *channel);
|
||||
extern void Async_UnlistenAll(void);
|
||||
|
||||
/* notify-related SQL functions */
|
||||
extern Datum pg_listening_channels(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_notify(PG_FUNCTION_ARGS);
|
||||
|
||||
/* perform (or cancel) outbound notify processing at transaction commit */
|
||||
extern void PreCommit_Notify(void);
|
||||
extern void AtCommit_Notify(void);
|
||||
extern void AtAbort_Notify(void);
|
||||
extern void AtSubStart_Notify(void);
|
||||
extern void AtSubCommit_Notify(void);
|
||||
extern void AtSubAbort_Notify(void);
|
||||
extern void AtPrepare_Notify(void);
|
||||
extern void ProcessCompletedNotifies(void);
|
||||
|
||||
/* signal handler for inbound notifies (PROCSIG_NOTIFY_INTERRUPT) */
|
||||
extern void HandleNotifyInterrupt(void);
|
||||
|
||||
/*
|
||||
* enable/disable processing of inbound notifies directly from signal handler.
|
||||
* The enable routine first performs processing of any inbound notifies that
|
||||
* have occurred since the last disable.
|
||||
*/
|
||||
extern void EnableNotifyInterrupt(void);
|
||||
extern bool DisableNotifyInterrupt(void);
|
||||
|
||||
#endif /* ASYNC_H */
|
||||
35
pg_include/commands/cluster.h
Executable file
35
pg_include/commands/cluster.h
Executable file
@@ -0,0 +1,35 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* cluster.h
|
||||
* header file for postgres cluster command stuff
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994-5, Regents of the University of California
|
||||
*
|
||||
* src/include/commands/cluster.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef CLUSTER_H
|
||||
#define CLUSTER_H
|
||||
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "storage/lock.h"
|
||||
#include "utils/relcache.h"
|
||||
|
||||
|
||||
extern void cluster(ClusterStmt *stmt, bool isTopLevel);
|
||||
extern void cluster_rel(Oid tableOid, Oid indexOid, bool recheck,
|
||||
bool verbose, int freeze_min_age, int freeze_table_age);
|
||||
extern void check_index_is_clusterable(Relation OldHeap, Oid indexOid,
|
||||
bool recheck, LOCKMODE lockmode);
|
||||
extern void mark_index_clustered(Relation rel, Oid indexOid);
|
||||
|
||||
extern Oid make_new_heap(Oid OIDOldHeap, Oid NewTableSpace);
|
||||
extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
|
||||
bool is_system_catalog,
|
||||
bool swap_toast_by_content,
|
||||
bool check_constraints,
|
||||
TransactionId frozenXid);
|
||||
|
||||
#endif /* CLUSTER_H */
|
||||
27
pg_include/commands/collationcmds.h
Executable file
27
pg_include/commands/collationcmds.h
Executable file
@@ -0,0 +1,27 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* collationcmds.h
|
||||
* prototypes for collationcmds.c.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/commands/collationcmds.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef COLLATIONCMDS_H
|
||||
#define COLLATIONCMDS_H
|
||||
|
||||
#include "nodes/parsenodes.h"
|
||||
|
||||
extern void DefineCollation(List *names, List *parameters);
|
||||
extern void RenameCollation(List *name, const char *newname);
|
||||
extern void AlterCollationOwner(List *name, Oid newOwnerId);
|
||||
extern void AlterCollationOwner_oid(Oid collationOid, Oid newOwnerId);
|
||||
extern void AlterCollationNamespace(List *name, const char *newschema);
|
||||
extern Oid AlterCollationNamespace_oid(Oid collOid, Oid newNspOid);
|
||||
|
||||
#endif /* COLLATIONCMDS_H */
|
||||
44
pg_include/commands/comment.h
Executable file
44
pg_include/commands/comment.h
Executable file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* src/include/commands/comment.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*
|
||||
* comment.h
|
||||
*
|
||||
* Prototypes for functions in commands/comment.c
|
||||
*
|
||||
* Copyright (c) 1999-2012, PostgreSQL Global Development Group
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef COMMENT_H
|
||||
#define COMMENT_H
|
||||
|
||||
#include "nodes/parsenodes.h"
|
||||
|
||||
/*------------------------------------------------------------------
|
||||
* Function Prototypes --
|
||||
*
|
||||
* The following prototypes define the public functions of the comment
|
||||
* related routines. CommentObject() implements the SQL "COMMENT ON"
|
||||
* command. DeleteComments() deletes all comments for an object.
|
||||
* CreateComments creates (or deletes, if comment is NULL) a comment
|
||||
* for a specific key. There are versions of these two methods for
|
||||
* both normal and shared objects.
|
||||
*------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern void CommentObject(CommentStmt *stmt);
|
||||
|
||||
extern void DeleteComments(Oid oid, Oid classoid, int32 subid);
|
||||
|
||||
extern void CreateComments(Oid oid, Oid classoid, int32 subid, char *comment);
|
||||
|
||||
extern void DeleteSharedComments(Oid oid, Oid classoid);
|
||||
|
||||
extern void CreateSharedComments(Oid oid, Oid classoid, char *comment);
|
||||
|
||||
extern char *GetComment(Oid oid, Oid classoid, int32 subid);
|
||||
|
||||
#endif /* COMMENT_H */
|
||||
27
pg_include/commands/conversioncmds.h
Executable file
27
pg_include/commands/conversioncmds.h
Executable file
@@ -0,0 +1,27 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* conversioncmds.h
|
||||
* prototypes for conversioncmds.c.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/commands/conversioncmds.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef CONVERSIONCMDS_H
|
||||
#define CONVERSIONCMDS_H
|
||||
|
||||
#include "nodes/parsenodes.h"
|
||||
|
||||
extern void CreateConversionCommand(CreateConversionStmt *parsetree);
|
||||
extern void RenameConversion(List *name, const char *newname);
|
||||
extern void AlterConversionOwner(List *name, Oid newOwnerId);
|
||||
extern void AlterConversionOwner_oid(Oid conversionOid, Oid newOwnerId);
|
||||
extern void AlterConversionNamespace(List *name, const char *newschema);
|
||||
extern Oid AlterConversionNamespace_oid(Oid convOid, Oid newNspOid);
|
||||
|
||||
#endif /* CONVERSIONCMDS_H */
|
||||
38
pg_include/commands/copy.h
Executable file
38
pg_include/commands/copy.h
Executable file
@@ -0,0 +1,38 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* copy.h
|
||||
* Definitions for using the POSTGRES copy command.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/commands/copy.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef COPY_H
|
||||
#define COPY_H
|
||||
|
||||
#include "nodes/execnodes.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "tcop/dest.h"
|
||||
|
||||
/* CopyStateData is private in commands/copy.c */
|
||||
typedef struct CopyStateData *CopyState;
|
||||
|
||||
extern uint64 DoCopy(const CopyStmt *stmt, const char *queryString);
|
||||
|
||||
extern void ProcessCopyOptions(CopyState cstate, bool is_from, List *options);
|
||||
extern CopyState BeginCopyFrom(Relation rel, const char *filename,
|
||||
List *attnamelist, List *options);
|
||||
extern void EndCopyFrom(CopyState cstate);
|
||||
extern bool NextCopyFrom(CopyState cstate, ExprContext *econtext,
|
||||
Datum *values, bool *nulls, Oid *tupleOid);
|
||||
extern bool NextCopyFromRawFields(CopyState cstate,
|
||||
char ***fields, int *nfields);
|
||||
extern void CopyFromErrorCallback(void *arg);
|
||||
|
||||
extern DestReceiver *CreateCopyDestReceiver(void);
|
||||
|
||||
#endif /* COPY_H */
|
||||
29
pg_include/commands/createas.h
Executable file
29
pg_include/commands/createas.h
Executable file
@@ -0,0 +1,29 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* createas.h
|
||||
* prototypes for createas.c.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/commands/createas.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef CREATEAS_H
|
||||
#define CREATEAS_H
|
||||
|
||||
#include "nodes/params.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "tcop/dest.h"
|
||||
|
||||
|
||||
extern void ExecCreateTableAs(CreateTableAsStmt *stmt, const char *queryString,
|
||||
ParamListInfo params, char *completionTag);
|
||||
|
||||
extern int GetIntoRelEFlags(IntoClause *intoClause);
|
||||
|
||||
extern DestReceiver *CreateIntoRelDestReceiver(IntoClause *intoClause);
|
||||
|
||||
#endif /* CREATEAS_H */
|
||||
70
pg_include/commands/dbcommands.h
Executable file
70
pg_include/commands/dbcommands.h
Executable file
@@ -0,0 +1,70 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* dbcommands.h
|
||||
* Database management commands (create/drop database).
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/commands/dbcommands.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef DBCOMMANDS_H
|
||||
#define DBCOMMANDS_H
|
||||
|
||||
#include "access/xlog.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
|
||||
/* XLOG stuff */
|
||||
#define XLOG_DBASE_CREATE 0x00
|
||||
#define XLOG_DBASE_DROP 0x10
|
||||
|
||||
typedef struct xl_dbase_create_rec_old
|
||||
{
|
||||
/* Records copying of a single subdirectory incl. contents */
|
||||
Oid db_id;
|
||||
char src_path[1]; /* VARIABLE LENGTH STRING */
|
||||
/* dst_path follows src_path */
|
||||
} xl_dbase_create_rec_old;
|
||||
|
||||
typedef struct xl_dbase_drop_rec_old
|
||||
{
|
||||
/* Records dropping of a single subdirectory incl. contents */
|
||||
Oid db_id;
|
||||
char dir_path[1]; /* VARIABLE LENGTH STRING */
|
||||
} xl_dbase_drop_rec_old;
|
||||
|
||||
typedef struct xl_dbase_create_rec
|
||||
{
|
||||
/* Records copying of a single subdirectory incl. contents */
|
||||
Oid db_id;
|
||||
Oid tablespace_id;
|
||||
Oid src_db_id;
|
||||
Oid src_tablespace_id;
|
||||
} xl_dbase_create_rec;
|
||||
|
||||
typedef struct xl_dbase_drop_rec
|
||||
{
|
||||
/* Records dropping of a single subdirectory incl. contents */
|
||||
Oid db_id;
|
||||
Oid tablespace_id;
|
||||
} xl_dbase_drop_rec;
|
||||
|
||||
extern void createdb(const CreatedbStmt *stmt);
|
||||
extern void dropdb(const char *dbname, bool missing_ok);
|
||||
extern void RenameDatabase(const char *oldname, const char *newname);
|
||||
extern void AlterDatabase(AlterDatabaseStmt *stmt, bool isTopLevel);
|
||||
extern void AlterDatabaseSet(AlterDatabaseSetStmt *stmt);
|
||||
extern void AlterDatabaseOwner(const char *dbname, Oid newOwnerId);
|
||||
|
||||
extern Oid get_database_oid(const char *dbname, bool missingok);
|
||||
extern char *get_database_name(Oid dbid);
|
||||
|
||||
extern void dbase_redo(XLogRecPtr lsn, XLogRecord *rptr);
|
||||
extern void dbase_desc(StringInfo buf, uint8 xl_info, char *rec);
|
||||
|
||||
extern void check_encoding_locale_matches(int encoding, const char *collate, const char *ctype);
|
||||
|
||||
#endif /* DBCOMMANDS_H */
|
||||
164
pg_include/commands/defrem.h
Executable file
164
pg_include/commands/defrem.h
Executable file
@@ -0,0 +1,164 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* defrem.h
|
||||
* POSTGRES define and remove utility definitions.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/commands/defrem.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef DEFREM_H
|
||||
#define DEFREM_H
|
||||
|
||||
#include "nodes/parsenodes.h"
|
||||
|
||||
/* commands/dropcmds.c */
|
||||
extern void RemoveObjects(DropStmt *stmt);
|
||||
|
||||
/* commands/indexcmds.c */
|
||||
extern Oid DefineIndex(IndexStmt *stmt,
|
||||
Oid indexRelationId,
|
||||
bool is_alter_table,
|
||||
bool check_rights,
|
||||
bool skip_build,
|
||||
bool quiet);
|
||||
extern void ReindexIndex(RangeVar *indexRelation);
|
||||
extern void ReindexTable(RangeVar *relation);
|
||||
extern void ReindexDatabase(const char *databaseName,
|
||||
bool do_system, bool do_user);
|
||||
extern char *makeObjectName(const char *name1, const char *name2,
|
||||
const char *label);
|
||||
extern char *ChooseRelationName(const char *name1, const char *name2,
|
||||
const char *label, Oid namespaceid);
|
||||
extern bool CheckIndexCompatible(Oid oldId,
|
||||
RangeVar *heapRelation,
|
||||
char *accessMethodName,
|
||||
List *attributeList,
|
||||
List *exclusionOpNames);
|
||||
extern Oid GetDefaultOpClass(Oid type_id, Oid am_id);
|
||||
|
||||
/* commands/functioncmds.c */
|
||||
extern void CreateFunction(CreateFunctionStmt *stmt, const char *queryString);
|
||||
extern void RemoveFunctionById(Oid funcOid);
|
||||
extern void SetFunctionReturnType(Oid funcOid, Oid newRetType);
|
||||
extern void SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType);
|
||||
extern void RenameFunction(List *name, List *argtypes, const char *newname);
|
||||
extern void AlterFunctionOwner(List *name, List *argtypes, Oid newOwnerId);
|
||||
extern void AlterFunctionOwner_oid(Oid procOid, Oid newOwnerId);
|
||||
extern void AlterFunction(AlterFunctionStmt *stmt);
|
||||
extern void CreateCast(CreateCastStmt *stmt);
|
||||
extern void DropCastById(Oid castOid);
|
||||
extern void AlterFunctionNamespace(List *name, List *argtypes, bool isagg,
|
||||
const char *newschema);
|
||||
extern Oid AlterFunctionNamespace_oid(Oid procOid, Oid nspOid);
|
||||
extern void ExecuteDoStmt(DoStmt *stmt);
|
||||
extern Oid get_cast_oid(Oid sourcetypeid, Oid targettypeid, bool missing_ok);
|
||||
|
||||
/* commands/operatorcmds.c */
|
||||
extern void DefineOperator(List *names, List *parameters);
|
||||
extern void RemoveOperatorById(Oid operOid);
|
||||
extern void AlterOperatorOwner(List *name, TypeName *typeName1,
|
||||
TypeName *typename2, Oid newOwnerId);
|
||||
extern void AlterOperatorOwner_oid(Oid operOid, Oid newOwnerId);
|
||||
extern void AlterOperatorNamespace(List *names, List *argtypes, const char *newschema);
|
||||
extern Oid AlterOperatorNamespace_oid(Oid operOid, Oid newNspOid);
|
||||
|
||||
/* commands/aggregatecmds.c */
|
||||
extern void DefineAggregate(List *name, List *args, bool oldstyle,
|
||||
List *parameters);
|
||||
extern void RenameAggregate(List *name, List *args, const char *newname);
|
||||
extern void AlterAggregateOwner(List *name, List *args, Oid newOwnerId);
|
||||
|
||||
/* commands/opclasscmds.c */
|
||||
extern void DefineOpClass(CreateOpClassStmt *stmt);
|
||||
extern void DefineOpFamily(CreateOpFamilyStmt *stmt);
|
||||
extern void AlterOpFamily(AlterOpFamilyStmt *stmt);
|
||||
extern void RemoveOpClassById(Oid opclassOid);
|
||||
extern void RemoveOpFamilyById(Oid opfamilyOid);
|
||||
extern void RemoveAmOpEntryById(Oid entryOid);
|
||||
extern void RemoveAmProcEntryById(Oid entryOid);
|
||||
extern void RenameOpClass(List *name, const char *access_method, const char *newname);
|
||||
extern void RenameOpFamily(List *name, const char *access_method, const char *newname);
|
||||
extern void AlterOpClassOwner(List *name, const char *access_method, Oid newOwnerId);
|
||||
extern void AlterOpClassOwner_oid(Oid opclassOid, Oid newOwnerId);
|
||||
extern void AlterOpClassNamespace(List *name, char *access_method, const char *newschema);
|
||||
extern Oid AlterOpClassNamespace_oid(Oid opclassOid, Oid newNspOid);
|
||||
extern void AlterOpFamilyOwner(List *name, const char *access_method, Oid newOwnerId);
|
||||
extern void AlterOpFamilyOwner_oid(Oid opfamilyOid, Oid newOwnerId);
|
||||
extern void AlterOpFamilyNamespace(List *name, char *access_method, const char *newschema);
|
||||
extern Oid AlterOpFamilyNamespace_oid(Oid opfamilyOid, Oid newNspOid);
|
||||
extern Oid get_am_oid(const char *amname, bool missing_ok);
|
||||
extern Oid get_opclass_oid(Oid amID, List *opclassname, bool missing_ok);
|
||||
extern Oid get_opfamily_oid(Oid amID, List *opfamilyname, bool missing_ok);
|
||||
|
||||
/* commands/tsearchcmds.c */
|
||||
extern void DefineTSParser(List *names, List *parameters);
|
||||
extern void RenameTSParser(List *oldname, const char *newname);
|
||||
extern void AlterTSParserNamespace(List *name, const char *newschema);
|
||||
extern Oid AlterTSParserNamespace_oid(Oid prsId, Oid newNspOid);
|
||||
extern void RemoveTSParserById(Oid prsId);
|
||||
|
||||
extern void DefineTSDictionary(List *names, List *parameters);
|
||||
extern void RenameTSDictionary(List *oldname, const char *newname);
|
||||
extern void RemoveTSDictionaryById(Oid dictId);
|
||||
extern void AlterTSDictionary(AlterTSDictionaryStmt *stmt);
|
||||
extern void AlterTSDictionaryOwner(List *name, Oid newOwnerId);
|
||||
extern void AlterTSDictionaryNamespace(List *name, const char *newschema);
|
||||
extern Oid AlterTSDictionaryNamespace_oid(Oid dictId, Oid newNspOid);
|
||||
|
||||
extern void DefineTSTemplate(List *names, List *parameters);
|
||||
extern void RenameTSTemplate(List *oldname, const char *newname);
|
||||
extern void AlterTSTemplateNamespace(List *name, const char *newschema);
|
||||
extern Oid AlterTSTemplateNamespace_oid(Oid tmplId, Oid newNspOid);
|
||||
extern void RemoveTSTemplateById(Oid tmplId);
|
||||
|
||||
extern void DefineTSConfiguration(List *names, List *parameters);
|
||||
extern void RenameTSConfiguration(List *oldname, const char *newname);
|
||||
extern void RemoveTSConfigurationById(Oid cfgId);
|
||||
extern void AlterTSConfiguration(AlterTSConfigurationStmt *stmt);
|
||||
extern void AlterTSConfigurationOwner(List *name, Oid newOwnerId);
|
||||
extern void AlterTSConfigurationNamespace(List *name, const char *newschema);
|
||||
extern Oid AlterTSConfigurationNamespace_oid(Oid cfgId, Oid newNspOid);
|
||||
|
||||
extern text *serialize_deflist(List *deflist);
|
||||
extern List *deserialize_deflist(Datum txt);
|
||||
|
||||
/* commands/foreigncmds.c */
|
||||
extern void RenameForeignServer(const char *oldname, const char *newname);
|
||||
extern void RenameForeignDataWrapper(const char *oldname, const char *newname);
|
||||
extern void AlterForeignServerOwner(const char *name, Oid newOwnerId);
|
||||
extern void AlterForeignServerOwner_oid(Oid, Oid newOwnerId);
|
||||
extern void AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId);
|
||||
extern void AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId);
|
||||
extern void CreateForeignDataWrapper(CreateFdwStmt *stmt);
|
||||
extern void AlterForeignDataWrapper(AlterFdwStmt *stmt);
|
||||
extern void RemoveForeignDataWrapperById(Oid fdwId);
|
||||
extern void CreateForeignServer(CreateForeignServerStmt *stmt);
|
||||
extern void AlterForeignServer(AlterForeignServerStmt *stmt);
|
||||
extern void RemoveForeignServerById(Oid srvId);
|
||||
extern void CreateUserMapping(CreateUserMappingStmt *stmt);
|
||||
extern void AlterUserMapping(AlterUserMappingStmt *stmt);
|
||||
extern void RemoveUserMapping(DropUserMappingStmt *stmt);
|
||||
extern void RemoveUserMappingById(Oid umId);
|
||||
extern void CreateForeignTable(CreateForeignTableStmt *stmt, Oid relid);
|
||||
extern Datum transformGenericOptions(Oid catalogId,
|
||||
Datum oldOptions,
|
||||
List *options,
|
||||
Oid fdwvalidator);
|
||||
|
||||
/* support routines in commands/define.c */
|
||||
|
||||
extern char *defGetString(DefElem *def);
|
||||
extern double defGetNumeric(DefElem *def);
|
||||
extern bool defGetBoolean(DefElem *def);
|
||||
extern int64 defGetInt64(DefElem *def);
|
||||
extern List *defGetQualifiedName(DefElem *def);
|
||||
extern TypeName *defGetTypeName(DefElem *def);
|
||||
extern int defGetTypeLength(DefElem *def);
|
||||
extern DefElem *defWithOids(bool value);
|
||||
|
||||
#endif /* DEFREM_H */
|
||||
20
pg_include/commands/discard.h
Executable file
20
pg_include/commands/discard.h
Executable file
@@ -0,0 +1,20 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* discard.h
|
||||
* prototypes for discard.c.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
*
|
||||
* src/include/commands/discard.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef DISCARD_H
|
||||
#define DISCARD_H
|
||||
|
||||
#include "nodes/parsenodes.h"
|
||||
|
||||
extern void DiscardCommand(DiscardStmt *stmt, bool isTopLevel);
|
||||
|
||||
#endif /* DISCARD_H */
|
||||
90
pg_include/commands/explain.h
Executable file
90
pg_include/commands/explain.h
Executable file
@@ -0,0 +1,90 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* explain.h
|
||||
* prototypes for explain.c
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994-5, Regents of the University of California
|
||||
*
|
||||
* src/include/commands/explain.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef EXPLAIN_H
|
||||
#define EXPLAIN_H
|
||||
|
||||
#include "executor/executor.h"
|
||||
|
||||
typedef enum ExplainFormat
|
||||
{
|
||||
EXPLAIN_FORMAT_TEXT,
|
||||
EXPLAIN_FORMAT_XML,
|
||||
EXPLAIN_FORMAT_JSON,
|
||||
EXPLAIN_FORMAT_YAML
|
||||
} ExplainFormat;
|
||||
|
||||
typedef struct ExplainState
|
||||
{
|
||||
StringInfo str; /* output buffer */
|
||||
/* options */
|
||||
bool verbose; /* be verbose */
|
||||
bool analyze; /* print actual times */
|
||||
bool costs; /* print costs */
|
||||
bool buffers; /* print buffer usage */
|
||||
bool timing; /* print timing */
|
||||
ExplainFormat format; /* output format */
|
||||
/* other states */
|
||||
PlannedStmt *pstmt; /* top of plan */
|
||||
List *rtable; /* range table */
|
||||
int indent; /* current indentation level */
|
||||
List *grouping_stack; /* format-specific grouping state */
|
||||
} ExplainState;
|
||||
|
||||
/* Hook for plugins to get control in ExplainOneQuery() */
|
||||
typedef void (*ExplainOneQuery_hook_type) (Query *query,
|
||||
IntoClause *into,
|
||||
ExplainState *es,
|
||||
const char *queryString,
|
||||
ParamListInfo params);
|
||||
extern PGDLLIMPORT ExplainOneQuery_hook_type ExplainOneQuery_hook;
|
||||
|
||||
/* Hook for plugins to get control in explain_get_index_name() */
|
||||
typedef const char *(*explain_get_index_name_hook_type) (Oid indexId);
|
||||
extern PGDLLIMPORT explain_get_index_name_hook_type explain_get_index_name_hook;
|
||||
|
||||
|
||||
extern void ExplainQuery(ExplainStmt *stmt, const char *queryString,
|
||||
ParamListInfo params, DestReceiver *dest);
|
||||
|
||||
extern void ExplainInitState(ExplainState *es);
|
||||
|
||||
extern TupleDesc ExplainResultDesc(ExplainStmt *stmt);
|
||||
|
||||
extern void ExplainOneUtility(Node *utilityStmt, IntoClause *into,
|
||||
ExplainState *es,
|
||||
const char *queryString, ParamListInfo params);
|
||||
|
||||
extern void ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into,
|
||||
ExplainState *es,
|
||||
const char *queryString, ParamListInfo params);
|
||||
|
||||
extern void ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc);
|
||||
|
||||
extern void ExplainQueryText(ExplainState *es, QueryDesc *queryDesc);
|
||||
|
||||
extern void ExplainBeginOutput(ExplainState *es);
|
||||
extern void ExplainEndOutput(ExplainState *es);
|
||||
extern void ExplainSeparatePlans(ExplainState *es);
|
||||
|
||||
extern void ExplainPropertyList(const char *qlabel, List *data,
|
||||
ExplainState *es);
|
||||
extern void ExplainPropertyText(const char *qlabel, const char *value,
|
||||
ExplainState *es);
|
||||
extern void ExplainPropertyInteger(const char *qlabel, int value,
|
||||
ExplainState *es);
|
||||
extern void ExplainPropertyLong(const char *qlabel, long value,
|
||||
ExplainState *es);
|
||||
extern void ExplainPropertyFloat(const char *qlabel, double value, int ndigits,
|
||||
ExplainState *es);
|
||||
|
||||
#endif /* EXPLAIN_H */
|
||||
50
pg_include/commands/extension.h
Executable file
50
pg_include/commands/extension.h
Executable file
@@ -0,0 +1,50 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* extension.h
|
||||
* Extension management commands (create/drop extension).
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/commands/extension.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef EXTENSION_H
|
||||
#define EXTENSION_H
|
||||
|
||||
#include "nodes/parsenodes.h"
|
||||
|
||||
|
||||
/*
|
||||
* creating_extension is only true while running a CREATE EXTENSION command.
|
||||
* It instructs recordDependencyOnCurrentExtension() to register a dependency
|
||||
* on the current pg_extension object for each SQL object created by its
|
||||
* installation script.
|
||||
*/
|
||||
extern bool creating_extension;
|
||||
extern Oid CurrentExtensionObject;
|
||||
|
||||
|
||||
extern void CreateExtension(CreateExtensionStmt *stmt);
|
||||
|
||||
extern void RemoveExtensionById(Oid extId);
|
||||
|
||||
extern Oid InsertExtensionTuple(const char *extName, Oid extOwner,
|
||||
Oid schemaOid, bool relocatable, const char *extVersion,
|
||||
Datum extConfig, Datum extCondition,
|
||||
List *requiredExtensions);
|
||||
|
||||
extern void ExecAlterExtensionStmt(AlterExtensionStmt *stmt);
|
||||
|
||||
extern void ExecAlterExtensionContentsStmt(AlterExtensionContentsStmt *stmt);
|
||||
|
||||
extern Oid get_extension_oid(const char *extname, bool missing_ok);
|
||||
extern char *get_extension_name(Oid ext_oid);
|
||||
|
||||
extern void AlterExtensionNamespace(List *names, const char *newschema);
|
||||
|
||||
extern void AlterExtensionOwner_oid(Oid extensionOid, Oid newOwnerId);
|
||||
|
||||
#endif /* EXTENSION_H */
|
||||
24
pg_include/commands/lockcmds.h
Executable file
24
pg_include/commands/lockcmds.h
Executable file
@@ -0,0 +1,24 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* lockcmds.h
|
||||
* prototypes for lockcmds.c.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/commands/lockcmds.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef LOCKCMDS_H
|
||||
#define LOCKCMDS_H
|
||||
|
||||
#include "nodes/parsenodes.h"
|
||||
|
||||
/*
|
||||
* LOCK
|
||||
*/
|
||||
extern void LockTableCommand(LockStmt *lockstmt);
|
||||
|
||||
#endif /* LOCKCMDS_H */
|
||||
33
pg_include/commands/portalcmds.h
Executable file
33
pg_include/commands/portalcmds.h
Executable file
@@ -0,0 +1,33 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* portalcmds.h
|
||||
* prototypes for portalcmds.c.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/commands/portalcmds.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PORTALCMDS_H
|
||||
#define PORTALCMDS_H
|
||||
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "utils/portal.h"
|
||||
|
||||
|
||||
extern void PerformCursorOpen(PlannedStmt *stmt, ParamListInfo params,
|
||||
const char *queryString, bool isTopLevel);
|
||||
|
||||
extern void PerformPortalFetch(FetchStmt *stmt, DestReceiver *dest,
|
||||
char *completionTag);
|
||||
|
||||
extern void PerformPortalClose(const char *name);
|
||||
|
||||
extern void PortalCleanup(Portal portal);
|
||||
|
||||
extern void PersistHoldablePortal(Portal portal);
|
||||
|
||||
#endif /* PORTALCMDS_H */
|
||||
58
pg_include/commands/prepare.h
Executable file
58
pg_include/commands/prepare.h
Executable file
@@ -0,0 +1,58 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* prepare.h
|
||||
* PREPARE, EXECUTE and DEALLOCATE commands, and prepared-stmt storage
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2002-2012, PostgreSQL Global Development Group
|
||||
*
|
||||
* src/include/commands/prepare.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PREPARE_H
|
||||
#define PREPARE_H
|
||||
|
||||
#include "commands/explain.h"
|
||||
#include "utils/plancache.h"
|
||||
|
||||
/*
|
||||
* The data structure representing a prepared statement. This is now just
|
||||
* a thin veneer over a plancache entry --- the main addition is that of
|
||||
* a name.
|
||||
*
|
||||
* Note: all subsidiary storage lives in the referenced plancache entry.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/* dynahash.c requires key to be first field */
|
||||
char stmt_name[NAMEDATALEN];
|
||||
CachedPlanSource *plansource; /* the actual cached plan */
|
||||
bool from_sql; /* prepared via SQL, not FE/BE protocol? */
|
||||
TimestampTz prepare_time; /* the time when the stmt was prepared */
|
||||
} PreparedStatement;
|
||||
|
||||
|
||||
/* Utility statements PREPARE, EXECUTE, DEALLOCATE, EXPLAIN EXECUTE */
|
||||
extern void PrepareQuery(PrepareStmt *stmt, const char *queryString);
|
||||
extern void ExecuteQuery(ExecuteStmt *stmt, IntoClause *intoClause,
|
||||
const char *queryString, ParamListInfo params,
|
||||
DestReceiver *dest, char *completionTag);
|
||||
extern void DeallocateQuery(DeallocateStmt *stmt);
|
||||
extern void ExplainExecuteQuery(ExecuteStmt *execstmt, IntoClause *into,
|
||||
ExplainState *es,
|
||||
const char *queryString, ParamListInfo params);
|
||||
|
||||
/* Low-level access to stored prepared statements */
|
||||
extern void StorePreparedStatement(const char *stmt_name,
|
||||
CachedPlanSource *plansource,
|
||||
bool from_sql);
|
||||
extern PreparedStatement *FetchPreparedStatement(const char *stmt_name,
|
||||
bool throwError);
|
||||
extern void DropPreparedStatement(const char *stmt_name, bool showError);
|
||||
extern TupleDesc FetchPreparedStatementResultDesc(PreparedStatement *stmt);
|
||||
extern List *FetchPreparedStatementTargetList(PreparedStatement *stmt);
|
||||
|
||||
extern void DropAllPreparedStatements(void);
|
||||
|
||||
#endif /* PREPARE_H */
|
||||
25
pg_include/commands/proclang.h
Executable file
25
pg_include/commands/proclang.h
Executable file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* src/include/commands/proclang.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*
|
||||
* proclang.h
|
||||
* prototypes for proclang.c.
|
||||
*
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PROCLANG_H
|
||||
#define PROCLANG_H
|
||||
|
||||
#include "nodes/parsenodes.h"
|
||||
|
||||
extern void CreateProceduralLanguage(CreatePLangStmt *stmt);
|
||||
extern void DropProceduralLanguageById(Oid langOid);
|
||||
extern void RenameLanguage(const char *oldname, const char *newname);
|
||||
extern void AlterLanguageOwner(const char *name, Oid newOwnerId);
|
||||
extern void AlterLanguageOwner_oid(Oid oid, Oid newOwnerId);
|
||||
extern bool PLTemplateExists(const char *languageName);
|
||||
extern Oid get_language_oid(const char *langname, bool missing_ok);
|
||||
|
||||
#endif /* PROCLANG_H */
|
||||
29
pg_include/commands/schemacmds.h
Executable file
29
pg_include/commands/schemacmds.h
Executable file
@@ -0,0 +1,29 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* schemacmds.h
|
||||
* prototypes for schemacmds.c.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/commands/schemacmds.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef SCHEMACMDS_H
|
||||
#define SCHEMACMDS_H
|
||||
|
||||
#include "nodes/parsenodes.h"
|
||||
|
||||
extern void CreateSchemaCommand(CreateSchemaStmt *parsetree,
|
||||
const char *queryString);
|
||||
|
||||
extern void RemoveSchemaById(Oid schemaOid);
|
||||
|
||||
extern void RenameSchema(const char *oldname, const char *newname);
|
||||
extern void AlterSchemaOwner(const char *name, Oid newOwnerId);
|
||||
extern void AlterSchemaOwner_oid(Oid schemaOid, Oid newOwnerId);
|
||||
|
||||
#endif /* SCHEMACMDS_H */
|
||||
34
pg_include/commands/seclabel.h
Executable file
34
pg_include/commands/seclabel.h
Executable file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* seclabel.h
|
||||
*
|
||||
* Prototypes for functions in commands/seclabel.c
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*/
|
||||
#ifndef SECLABEL_H
|
||||
#define SECLABEL_H
|
||||
|
||||
#include "catalog/objectaddress.h"
|
||||
|
||||
/*
|
||||
* Internal APIs
|
||||
*/
|
||||
extern char *GetSecurityLabel(const ObjectAddress *object,
|
||||
const char *provider);
|
||||
extern void SetSecurityLabel(const ObjectAddress *object,
|
||||
const char *provider, const char *label);
|
||||
extern void DeleteSecurityLabel(const ObjectAddress *object);
|
||||
extern void DeleteSharedSecurityLabel(Oid objectId, Oid classId);
|
||||
|
||||
/*
|
||||
* Statement and ESP hook support
|
||||
*/
|
||||
extern void ExecSecLabelStmt(SecLabelStmt *stmt);
|
||||
|
||||
typedef void (*check_object_relabel_type) (const ObjectAddress *object,
|
||||
const char *seclabel);
|
||||
extern void register_label_provider(const char *provider,
|
||||
check_object_relabel_type hook);
|
||||
|
||||
#endif /* SECLABEL_H */
|
||||
81
pg_include/commands/sequence.h
Executable file
81
pg_include/commands/sequence.h
Executable file
@@ -0,0 +1,81 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* sequence.h
|
||||
* prototypes for sequence.c.
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/commands/sequence.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef SEQUENCE_H
|
||||
#define SEQUENCE_H
|
||||
|
||||
#include "access/xlog.h"
|
||||
#include "fmgr.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "storage/relfilenode.h"
|
||||
|
||||
|
||||
typedef struct FormData_pg_sequence
|
||||
{
|
||||
NameData sequence_name;
|
||||
int64 last_value;
|
||||
int64 start_value;
|
||||
int64 increment_by;
|
||||
int64 max_value;
|
||||
int64 min_value;
|
||||
int64 cache_value;
|
||||
int64 log_cnt;
|
||||
bool is_cycled;
|
||||
bool is_called;
|
||||
} FormData_pg_sequence;
|
||||
|
||||
typedef FormData_pg_sequence *Form_pg_sequence;
|
||||
|
||||
/*
|
||||
* Columns of a sequence relation
|
||||
*/
|
||||
|
||||
#define SEQ_COL_NAME 1
|
||||
#define SEQ_COL_LASTVAL 2
|
||||
#define SEQ_COL_STARTVAL 3
|
||||
#define SEQ_COL_INCBY 4
|
||||
#define SEQ_COL_MAXVALUE 5
|
||||
#define SEQ_COL_MINVALUE 6
|
||||
#define SEQ_COL_CACHE 7
|
||||
#define SEQ_COL_LOG 8
|
||||
#define SEQ_COL_CYCLE 9
|
||||
#define SEQ_COL_CALLED 10
|
||||
|
||||
#define SEQ_COL_FIRSTCOL SEQ_COL_NAME
|
||||
#define SEQ_COL_LASTCOL SEQ_COL_CALLED
|
||||
|
||||
/* XLOG stuff */
|
||||
#define XLOG_SEQ_LOG 0x00
|
||||
|
||||
typedef struct xl_seq_rec
|
||||
{
|
||||
RelFileNode node;
|
||||
/* SEQUENCE TUPLE DATA FOLLOWS AT THE END */
|
||||
} xl_seq_rec;
|
||||
|
||||
extern Datum nextval(PG_FUNCTION_ARGS);
|
||||
extern Datum nextval_oid(PG_FUNCTION_ARGS);
|
||||
extern Datum currval_oid(PG_FUNCTION_ARGS);
|
||||
extern Datum setval_oid(PG_FUNCTION_ARGS);
|
||||
extern Datum setval3_oid(PG_FUNCTION_ARGS);
|
||||
extern Datum lastval(PG_FUNCTION_ARGS);
|
||||
|
||||
extern Datum pg_sequence_parameters(PG_FUNCTION_ARGS);
|
||||
|
||||
extern void DefineSequence(CreateSeqStmt *stmt);
|
||||
extern void AlterSequence(AlterSeqStmt *stmt);
|
||||
extern void ResetSequence(Oid seq_relid);
|
||||
|
||||
extern void seq_redo(XLogRecPtr lsn, XLogRecord *rptr);
|
||||
extern void seq_desc(StringInfo buf, uint8 xl_info, char *rec);
|
||||
|
||||
#endif /* SEQUENCE_H */
|
||||
81
pg_include/commands/tablecmds.h
Executable file
81
pg_include/commands/tablecmds.h
Executable file
@@ -0,0 +1,81 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* tablecmds.h
|
||||
* prototypes for tablecmds.c.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/commands/tablecmds.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef TABLECMDS_H
|
||||
#define TABLECMDS_H
|
||||
|
||||
#include "access/htup.h"
|
||||
#include "catalog/dependency.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "storage/lock.h"
|
||||
#include "utils/relcache.h"
|
||||
|
||||
|
||||
extern Oid DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId);
|
||||
|
||||
extern void RemoveRelations(DropStmt *drop);
|
||||
|
||||
extern Oid AlterTableLookupRelation(AlterTableStmt *stmt, LOCKMODE lockmode);
|
||||
|
||||
extern void AlterTable(Oid relid, LOCKMODE lockmode, AlterTableStmt *stmt);
|
||||
|
||||
extern LOCKMODE AlterTableGetLockLevel(List *cmds);
|
||||
|
||||
extern void ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, LOCKMODE lockmode);
|
||||
|
||||
extern void AlterTableInternal(Oid relid, List *cmds, bool recurse);
|
||||
|
||||
extern void AlterTableNamespace(AlterObjectSchemaStmt *stmt);
|
||||
|
||||
extern void AlterTableNamespaceInternal(Relation rel, Oid oldNspOid,
|
||||
Oid nspOid, ObjectAddresses *objsMoved);
|
||||
|
||||
extern void AlterRelationNamespaceInternal(Relation classRel, Oid relOid,
|
||||
Oid oldNspOid, Oid newNspOid,
|
||||
bool hasDependEntry,
|
||||
ObjectAddresses *objsMoved);
|
||||
|
||||
extern void CheckTableNotInUse(Relation rel, const char *stmt);
|
||||
|
||||
extern void ExecuteTruncate(TruncateStmt *stmt);
|
||||
|
||||
extern void SetRelationHasSubclass(Oid relationId, bool relhassubclass);
|
||||
|
||||
extern void renameatt(RenameStmt *stmt);
|
||||
|
||||
extern void RenameConstraint(RenameStmt *stmt);
|
||||
|
||||
extern void RenameRelation(RenameStmt *stmt);
|
||||
|
||||
extern void RenameRelationInternal(Oid myrelid,
|
||||
const char *newrelname);
|
||||
|
||||
extern void find_composite_type_dependencies(Oid typeOid,
|
||||
Relation origRelation,
|
||||
const char *origTypeName);
|
||||
|
||||
extern void check_of_type(HeapTuple typetuple);
|
||||
|
||||
extern void register_on_commit_action(Oid relid, OnCommitAction action);
|
||||
extern void remove_on_commit_action(Oid relid);
|
||||
|
||||
extern void PreCommit_on_commit_actions(void);
|
||||
extern void AtEOXact_on_commit_actions(bool isCommit);
|
||||
extern void AtEOSubXact_on_commit_actions(bool isCommit,
|
||||
SubTransactionId mySubid,
|
||||
SubTransactionId parentSubid);
|
||||
|
||||
extern void RangeVarCallbackOwnsTable(const RangeVar *relation,
|
||||
Oid relId, Oid oldRelId, void *arg);
|
||||
|
||||
#endif /* TABLECMDS_H */
|
||||
62
pg_include/commands/tablespace.h
Executable file
62
pg_include/commands/tablespace.h
Executable file
@@ -0,0 +1,62 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* tablespace.h
|
||||
* Tablespace management commands (create/drop tablespace).
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/commands/tablespace.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef TABLESPACE_H
|
||||
#define TABLESPACE_H
|
||||
|
||||
#include "access/xlog.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
|
||||
/* XLOG stuff */
|
||||
#define XLOG_TBLSPC_CREATE 0x00
|
||||
#define XLOG_TBLSPC_DROP 0x10
|
||||
|
||||
typedef struct xl_tblspc_create_rec
|
||||
{
|
||||
Oid ts_id;
|
||||
char ts_path[1]; /* VARIABLE LENGTH STRING */
|
||||
} xl_tblspc_create_rec;
|
||||
|
||||
typedef struct xl_tblspc_drop_rec
|
||||
{
|
||||
Oid ts_id;
|
||||
} xl_tblspc_drop_rec;
|
||||
|
||||
typedef struct TableSpaceOpts
|
||||
{
|
||||
int32 vl_len_; /* varlena header (do not touch directly!) */
|
||||
float8 random_page_cost;
|
||||
float8 seq_page_cost;
|
||||
} TableSpaceOpts;
|
||||
|
||||
extern void CreateTableSpace(CreateTableSpaceStmt *stmt);
|
||||
extern void DropTableSpace(DropTableSpaceStmt *stmt);
|
||||
extern void RenameTableSpace(const char *oldname, const char *newname);
|
||||
extern void AlterTableSpaceOwner(const char *name, Oid newOwnerId);
|
||||
extern void AlterTableSpaceOptions(AlterTableSpaceOptionsStmt *stmt);
|
||||
|
||||
extern void TablespaceCreateDbspace(Oid spcNode, Oid dbNode, bool isRedo);
|
||||
|
||||
extern Oid GetDefaultTablespace(char relpersistence);
|
||||
|
||||
extern void PrepareTempTablespaces(void);
|
||||
|
||||
extern Oid get_tablespace_oid(const char *tablespacename, bool missing_ok);
|
||||
extern char *get_tablespace_name(Oid spc_oid);
|
||||
|
||||
extern bool directory_is_empty(const char *path);
|
||||
|
||||
extern void tblspc_redo(XLogRecPtr lsn, XLogRecord *rptr);
|
||||
extern void tblspc_desc(StringInfo buf, uint8 xl_info, char *rec);
|
||||
|
||||
#endif /* TABLESPACE_H */
|
||||
210
pg_include/commands/trigger.h
Executable file
210
pg_include/commands/trigger.h
Executable file
@@ -0,0 +1,210 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* trigger.h
|
||||
* Declarations for trigger handling.
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/commands/trigger.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef TRIGGER_H
|
||||
#define TRIGGER_H
|
||||
|
||||
#include "nodes/execnodes.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
|
||||
/*
|
||||
* TriggerData is the node type that is passed as fmgr "context" info
|
||||
* when a function is called by the trigger manager.
|
||||
*/
|
||||
|
||||
#define CALLED_AS_TRIGGER(fcinfo) \
|
||||
((fcinfo)->context != NULL && IsA((fcinfo)->context, TriggerData))
|
||||
|
||||
typedef uint32 TriggerEvent;
|
||||
|
||||
typedef struct TriggerData
|
||||
{
|
||||
NodeTag type;
|
||||
TriggerEvent tg_event;
|
||||
Relation tg_relation;
|
||||
HeapTuple tg_trigtuple;
|
||||
HeapTuple tg_newtuple;
|
||||
Trigger *tg_trigger;
|
||||
Buffer tg_trigtuplebuf;
|
||||
Buffer tg_newtuplebuf;
|
||||
} TriggerData;
|
||||
|
||||
/*
|
||||
* TriggerEvent bit flags
|
||||
*
|
||||
* Note that we assume different event types (INSERT/DELETE/UPDATE/TRUNCATE)
|
||||
* can't be OR'd together in a single TriggerEvent. This is unlike the
|
||||
* situation for pg_trigger rows, so pg_trigger.tgtype uses a different
|
||||
* representation!
|
||||
*/
|
||||
#define TRIGGER_EVENT_INSERT 0x00000000
|
||||
#define TRIGGER_EVENT_DELETE 0x00000001
|
||||
#define TRIGGER_EVENT_UPDATE 0x00000002
|
||||
#define TRIGGER_EVENT_TRUNCATE 0x00000003
|
||||
#define TRIGGER_EVENT_OPMASK 0x00000003
|
||||
|
||||
#define TRIGGER_EVENT_ROW 0x00000004
|
||||
|
||||
#define TRIGGER_EVENT_BEFORE 0x00000008
|
||||
#define TRIGGER_EVENT_AFTER 0x00000000
|
||||
#define TRIGGER_EVENT_INSTEAD 0x00000010
|
||||
#define TRIGGER_EVENT_TIMINGMASK 0x00000018
|
||||
|
||||
/* More TriggerEvent flags, used only within trigger.c */
|
||||
|
||||
#define AFTER_TRIGGER_DEFERRABLE 0x00000020
|
||||
#define AFTER_TRIGGER_INITDEFERRED 0x00000040
|
||||
|
||||
#define TRIGGER_FIRED_BY_INSERT(event) \
|
||||
(((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_INSERT)
|
||||
|
||||
#define TRIGGER_FIRED_BY_DELETE(event) \
|
||||
(((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_DELETE)
|
||||
|
||||
#define TRIGGER_FIRED_BY_UPDATE(event) \
|
||||
(((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_UPDATE)
|
||||
|
||||
#define TRIGGER_FIRED_BY_TRUNCATE(event) \
|
||||
(((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_TRUNCATE)
|
||||
|
||||
#define TRIGGER_FIRED_FOR_ROW(event) \
|
||||
((event) & TRIGGER_EVENT_ROW)
|
||||
|
||||
#define TRIGGER_FIRED_FOR_STATEMENT(event) \
|
||||
(!TRIGGER_FIRED_FOR_ROW(event))
|
||||
|
||||
#define TRIGGER_FIRED_BEFORE(event) \
|
||||
(((event) & TRIGGER_EVENT_TIMINGMASK) == TRIGGER_EVENT_BEFORE)
|
||||
|
||||
#define TRIGGER_FIRED_AFTER(event) \
|
||||
(((event) & TRIGGER_EVENT_TIMINGMASK) == TRIGGER_EVENT_AFTER)
|
||||
|
||||
#define TRIGGER_FIRED_INSTEAD(event) \
|
||||
(((event) & TRIGGER_EVENT_TIMINGMASK) == TRIGGER_EVENT_INSTEAD)
|
||||
|
||||
/*
|
||||
* Definitions for replication role based firing.
|
||||
*/
|
||||
#define SESSION_REPLICATION_ROLE_ORIGIN 0
|
||||
#define SESSION_REPLICATION_ROLE_REPLICA 1
|
||||
#define SESSION_REPLICATION_ROLE_LOCAL 2
|
||||
extern PGDLLIMPORT int SessionReplicationRole;
|
||||
|
||||
/*
|
||||
* States at which a trigger can be fired. These are the
|
||||
* possible values for pg_trigger.tgenabled.
|
||||
*/
|
||||
#define TRIGGER_FIRES_ON_ORIGIN 'O'
|
||||
#define TRIGGER_FIRES_ALWAYS 'A'
|
||||
#define TRIGGER_FIRES_ON_REPLICA 'R'
|
||||
#define TRIGGER_DISABLED 'D'
|
||||
|
||||
extern Oid CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
|
||||
Oid constraintOid, Oid indexOid,
|
||||
bool isInternal);
|
||||
|
||||
extern void RemoveTriggerById(Oid trigOid);
|
||||
extern Oid get_trigger_oid(Oid relid, const char *name, bool missing_ok);
|
||||
|
||||
extern void renametrig(RenameStmt *stmt);
|
||||
|
||||
extern void EnableDisableTrigger(Relation rel, const char *tgname,
|
||||
char fires_when, bool skip_system);
|
||||
|
||||
extern void RelationBuildTriggers(Relation relation);
|
||||
|
||||
extern TriggerDesc *CopyTriggerDesc(TriggerDesc *trigdesc);
|
||||
|
||||
extern void FreeTriggerDesc(TriggerDesc *trigdesc);
|
||||
|
||||
extern void ExecBSInsertTriggers(EState *estate,
|
||||
ResultRelInfo *relinfo);
|
||||
extern void ExecASInsertTriggers(EState *estate,
|
||||
ResultRelInfo *relinfo);
|
||||
extern TupleTableSlot *ExecBRInsertTriggers(EState *estate,
|
||||
ResultRelInfo *relinfo,
|
||||
TupleTableSlot *slot);
|
||||
extern void ExecARInsertTriggers(EState *estate,
|
||||
ResultRelInfo *relinfo,
|
||||
HeapTuple trigtuple,
|
||||
List *recheckIndexes);
|
||||
extern TupleTableSlot *ExecIRInsertTriggers(EState *estate,
|
||||
ResultRelInfo *relinfo,
|
||||
TupleTableSlot *slot);
|
||||
extern void ExecBSDeleteTriggers(EState *estate,
|
||||
ResultRelInfo *relinfo);
|
||||
extern void ExecASDeleteTriggers(EState *estate,
|
||||
ResultRelInfo *relinfo);
|
||||
extern bool ExecBRDeleteTriggers(EState *estate,
|
||||
EPQState *epqstate,
|
||||
ResultRelInfo *relinfo,
|
||||
ItemPointer tupleid);
|
||||
extern void ExecARDeleteTriggers(EState *estate,
|
||||
ResultRelInfo *relinfo,
|
||||
ItemPointer tupleid);
|
||||
extern bool ExecIRDeleteTriggers(EState *estate,
|
||||
ResultRelInfo *relinfo,
|
||||
HeapTuple trigtuple);
|
||||
extern void ExecBSUpdateTriggers(EState *estate,
|
||||
ResultRelInfo *relinfo);
|
||||
extern void ExecASUpdateTriggers(EState *estate,
|
||||
ResultRelInfo *relinfo);
|
||||
extern TupleTableSlot *ExecBRUpdateTriggers(EState *estate,
|
||||
EPQState *epqstate,
|
||||
ResultRelInfo *relinfo,
|
||||
ItemPointer tupleid,
|
||||
TupleTableSlot *slot);
|
||||
extern void ExecARUpdateTriggers(EState *estate,
|
||||
ResultRelInfo *relinfo,
|
||||
ItemPointer tupleid,
|
||||
HeapTuple newtuple,
|
||||
List *recheckIndexes);
|
||||
extern TupleTableSlot *ExecIRUpdateTriggers(EState *estate,
|
||||
ResultRelInfo *relinfo,
|
||||
HeapTuple trigtuple,
|
||||
TupleTableSlot *slot);
|
||||
extern void ExecBSTruncateTriggers(EState *estate,
|
||||
ResultRelInfo *relinfo);
|
||||
extern void ExecASTruncateTriggers(EState *estate,
|
||||
ResultRelInfo *relinfo);
|
||||
|
||||
extern void AfterTriggerBeginXact(void);
|
||||
extern void AfterTriggerBeginQuery(void);
|
||||
extern void AfterTriggerEndQuery(EState *estate);
|
||||
extern void AfterTriggerFireDeferred(void);
|
||||
extern void AfterTriggerEndXact(bool isCommit);
|
||||
extern void AfterTriggerBeginSubXact(void);
|
||||
extern void AfterTriggerEndSubXact(bool isCommit);
|
||||
extern void AfterTriggerSetState(ConstraintsSetStmt *stmt);
|
||||
extern bool AfterTriggerPendingOnRel(Oid relid);
|
||||
|
||||
|
||||
/*
|
||||
* in utils/adt/ri_triggers.c
|
||||
*/
|
||||
extern bool RI_FKey_keyequal_upd_pk(Trigger *trigger, Relation pk_rel,
|
||||
HeapTuple old_row, HeapTuple new_row);
|
||||
extern bool RI_FKey_keyequal_upd_fk(Trigger *trigger, Relation fk_rel,
|
||||
HeapTuple old_row, HeapTuple new_row);
|
||||
extern bool RI_Initial_Check(Trigger *trigger,
|
||||
Relation fk_rel, Relation pk_rel);
|
||||
|
||||
/* result values for RI_FKey_trigger_type: */
|
||||
#define RI_TRIGGER_PK 1 /* is a trigger on the PK relation */
|
||||
#define RI_TRIGGER_FK 2 /* is a trigger on the FK relation */
|
||||
#define RI_TRIGGER_NONE 0 /* is not an RI trigger function */
|
||||
|
||||
extern int RI_FKey_trigger_type(Oid tgfoid);
|
||||
|
||||
extern Datum pg_trigger_depth(PG_FUNCTION_ARGS);
|
||||
|
||||
#endif /* TRIGGER_H */
|
||||
55
pg_include/commands/typecmds.h
Executable file
55
pg_include/commands/typecmds.h
Executable file
@@ -0,0 +1,55 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* typecmds.h
|
||||
* prototypes for typecmds.c.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/commands/typecmds.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef TYPECMDS_H
|
||||
#define TYPECMDS_H
|
||||
|
||||
#include "access/htup.h"
|
||||
#include "catalog/dependency.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
|
||||
|
||||
#define DEFAULT_TYPDELIM ','
|
||||
|
||||
extern void DefineType(List *names, List *parameters);
|
||||
extern void RemoveTypeById(Oid typeOid);
|
||||
extern void DefineDomain(CreateDomainStmt *stmt);
|
||||
extern void DefineEnum(CreateEnumStmt *stmt);
|
||||
extern void DefineRange(CreateRangeStmt *stmt);
|
||||
extern void AlterEnum(AlterEnumStmt *stmt);
|
||||
extern Oid DefineCompositeType(RangeVar *typevar, List *coldeflist);
|
||||
extern Oid AssignTypeArrayOid(void);
|
||||
|
||||
extern void AlterDomainDefault(List *names, Node *defaultRaw);
|
||||
extern void AlterDomainNotNull(List *names, bool notNull);
|
||||
extern void AlterDomainAddConstraint(List *names, Node *constr);
|
||||
extern void AlterDomainValidateConstraint(List *names, char *constrName);
|
||||
extern void AlterDomainDropConstraint(List *names, const char *constrName,
|
||||
DropBehavior behavior, bool missing_ok);
|
||||
|
||||
extern void checkDomainOwner(HeapTuple tup);
|
||||
|
||||
extern List *GetDomainConstraints(Oid typeOid);
|
||||
|
||||
extern void RenameType(RenameStmt *stmt);
|
||||
extern void AlterTypeOwner(List *names, Oid newOwnerId, ObjectType objecttype);
|
||||
extern void AlterTypeOwnerInternal(Oid typeOid, Oid newOwnerId,
|
||||
bool hasDependEntry);
|
||||
extern void AlterTypeNamespace(List *names, const char *newschema, ObjectType objecttype);
|
||||
extern Oid AlterTypeNamespace_oid(Oid typeOid, Oid nspOid, ObjectAddresses *objsMoved);
|
||||
extern Oid AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid,
|
||||
bool isImplicitArray,
|
||||
bool errorOnTableType,
|
||||
ObjectAddresses *objsMoved);
|
||||
|
||||
#endif /* TYPECMDS_H */
|
||||
34
pg_include/commands/user.h
Executable file
34
pg_include/commands/user.h
Executable file
@@ -0,0 +1,34 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* user.h
|
||||
* Commands for manipulating roles (formerly called users).
|
||||
*
|
||||
*
|
||||
* src/include/commands/user.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef USER_H
|
||||
#define USER_H
|
||||
|
||||
#include "nodes/parsenodes.h"
|
||||
|
||||
|
||||
/* Hook to check passwords in CreateRole() and AlterRole() */
|
||||
#define PASSWORD_TYPE_PLAINTEXT 0
|
||||
#define PASSWORD_TYPE_MD5 1
|
||||
|
||||
typedef void (*check_password_hook_type) (const char *username, const char *password, int password_type, Datum validuntil_time, bool validuntil_null);
|
||||
|
||||
extern PGDLLIMPORT check_password_hook_type check_password_hook;
|
||||
|
||||
extern void CreateRole(CreateRoleStmt *stmt);
|
||||
extern void AlterRole(AlterRoleStmt *stmt);
|
||||
extern void AlterRoleSet(AlterRoleSetStmt *stmt);
|
||||
extern void DropRole(DropRoleStmt *stmt);
|
||||
extern void GrantRole(GrantRoleStmt *stmt);
|
||||
extern void RenameRole(const char *oldname, const char *newname);
|
||||
extern void DropOwnedObjects(DropOwnedStmt *stmt);
|
||||
extern void ReassignOwnedObjects(ReassignOwnedStmt *stmt);
|
||||
|
||||
#endif /* USER_H */
|
||||
177
pg_include/commands/vacuum.h
Executable file
177
pg_include/commands/vacuum.h
Executable file
@@ -0,0 +1,177 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* vacuum.h
|
||||
* header file for postgres vacuum cleaner and statistics analyzer
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/commands/vacuum.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef VACUUM_H
|
||||
#define VACUUM_H
|
||||
|
||||
#include "access/htup.h"
|
||||
#include "catalog/pg_statistic.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "storage/buf.h"
|
||||
#include "storage/lock.h"
|
||||
#include "utils/relcache.h"
|
||||
|
||||
|
||||
/*----------
|
||||
* ANALYZE builds one of these structs for each attribute (column) that is
|
||||
* to be analyzed. The struct and subsidiary data are in anl_context,
|
||||
* so they live until the end of the ANALYZE operation.
|
||||
*
|
||||
* The type-specific typanalyze function is passed a pointer to this struct
|
||||
* and must return TRUE to continue analysis, FALSE to skip analysis of this
|
||||
* column. In the TRUE case it must set the compute_stats and minrows fields,
|
||||
* and can optionally set extra_data to pass additional info to compute_stats.
|
||||
* minrows is its request for the minimum number of sample rows to be gathered
|
||||
* (but note this request might not be honored, eg if there are fewer rows
|
||||
* than that in the table).
|
||||
*
|
||||
* The compute_stats routine will be called after sample rows have been
|
||||
* gathered. Aside from this struct, it is passed:
|
||||
* fetchfunc: a function for accessing the column values from the
|
||||
* sample rows
|
||||
* samplerows: the number of sample tuples
|
||||
* totalrows: estimated total number of rows in relation
|
||||
* The fetchfunc may be called with rownum running from 0 to samplerows-1.
|
||||
* It returns a Datum and an isNull flag.
|
||||
*
|
||||
* compute_stats should set stats_valid TRUE if it is able to compute
|
||||
* any useful statistics. If it does, the remainder of the struct holds
|
||||
* the information to be stored in a pg_statistic row for the column. Be
|
||||
* careful to allocate any pointed-to data in anl_context, which will NOT
|
||||
* be CurrentMemoryContext when compute_stats is called.
|
||||
*
|
||||
* Note: for the moment, all comparisons done for statistical purposes
|
||||
* should use the database's default collation (DEFAULT_COLLATION_OID).
|
||||
* This might change in some future release.
|
||||
*----------
|
||||
*/
|
||||
typedef struct VacAttrStats *VacAttrStatsP;
|
||||
|
||||
typedef Datum (*AnalyzeAttrFetchFunc) (VacAttrStatsP stats, int rownum,
|
||||
bool *isNull);
|
||||
|
||||
typedef void (*AnalyzeAttrComputeStatsFunc) (VacAttrStatsP stats,
|
||||
AnalyzeAttrFetchFunc fetchfunc,
|
||||
int samplerows,
|
||||
double totalrows);
|
||||
|
||||
typedef struct VacAttrStats
|
||||
{
|
||||
/*
|
||||
* These fields are set up by the main ANALYZE code before invoking the
|
||||
* type-specific typanalyze function.
|
||||
*
|
||||
* Note: do not assume that the data being analyzed has the same datatype
|
||||
* shown in attr, ie do not trust attr->atttypid, attlen, etc. This is
|
||||
* because some index opclasses store a different type than the underlying
|
||||
* column/expression. Instead use attrtypid, attrtypmod, and attrtype for
|
||||
* information about the datatype being fed to the typanalyze function.
|
||||
*/
|
||||
Form_pg_attribute attr; /* copy of pg_attribute row for column */
|
||||
Oid attrtypid; /* type of data being analyzed */
|
||||
int32 attrtypmod; /* typmod of data being analyzed */
|
||||
Form_pg_type attrtype; /* copy of pg_type row for attrtypid */
|
||||
MemoryContext anl_context; /* where to save long-lived data */
|
||||
|
||||
/*
|
||||
* These fields must be filled in by the typanalyze routine, unless it
|
||||
* returns FALSE.
|
||||
*/
|
||||
AnalyzeAttrComputeStatsFunc compute_stats; /* function pointer */
|
||||
int minrows; /* Minimum # of rows wanted for stats */
|
||||
void *extra_data; /* for extra type-specific data */
|
||||
|
||||
/*
|
||||
* These fields are to be filled in by the compute_stats routine. (They
|
||||
* are initialized to zero when the struct is created.)
|
||||
*/
|
||||
bool stats_valid;
|
||||
float4 stanullfrac; /* fraction of entries that are NULL */
|
||||
int4 stawidth; /* average width of column values */
|
||||
float4 stadistinct; /* # distinct values */
|
||||
int2 stakind[STATISTIC_NUM_SLOTS];
|
||||
Oid staop[STATISTIC_NUM_SLOTS];
|
||||
int numnumbers[STATISTIC_NUM_SLOTS];
|
||||
float4 *stanumbers[STATISTIC_NUM_SLOTS];
|
||||
int numvalues[STATISTIC_NUM_SLOTS];
|
||||
Datum *stavalues[STATISTIC_NUM_SLOTS];
|
||||
|
||||
/*
|
||||
* These fields describe the stavalues[n] element types. They will be
|
||||
* initialized to match attrtypid, but a custom typanalyze function might
|
||||
* want to store an array of something other than the analyzed column's
|
||||
* elements. It should then overwrite these fields.
|
||||
*/
|
||||
Oid statypid[STATISTIC_NUM_SLOTS];
|
||||
int2 statyplen[STATISTIC_NUM_SLOTS];
|
||||
bool statypbyval[STATISTIC_NUM_SLOTS];
|
||||
char statypalign[STATISTIC_NUM_SLOTS];
|
||||
|
||||
/*
|
||||
* These fields are private to the main ANALYZE code and should not be
|
||||
* looked at by type-specific functions.
|
||||
*/
|
||||
int tupattnum; /* attribute number within tuples */
|
||||
HeapTuple *rows; /* access info for std fetch function */
|
||||
TupleDesc tupDesc;
|
||||
Datum *exprvals; /* access info for index fetch function */
|
||||
bool *exprnulls;
|
||||
int rowstride;
|
||||
} VacAttrStats;
|
||||
|
||||
|
||||
/* GUC parameters */
|
||||
extern PGDLLIMPORT int default_statistics_target; /* PGDLLIMPORT for
|
||||
* PostGIS */
|
||||
extern int vacuum_freeze_min_age;
|
||||
extern int vacuum_freeze_table_age;
|
||||
|
||||
|
||||
/* in commands/vacuum.c */
|
||||
extern void vacuum(VacuumStmt *vacstmt, Oid relid, bool do_toast,
|
||||
BufferAccessStrategy bstrategy, bool for_wraparound, bool isTopLevel);
|
||||
extern void vac_open_indexes(Relation relation, LOCKMODE lockmode,
|
||||
int *nindexes, Relation **Irel);
|
||||
extern void vac_close_indexes(int nindexes, Relation *Irel, LOCKMODE lockmode);
|
||||
extern double vac_estimate_reltuples(Relation relation, bool is_analyze,
|
||||
BlockNumber total_pages,
|
||||
BlockNumber scanned_pages,
|
||||
double scanned_tuples);
|
||||
extern void vac_update_relstats(Relation relation,
|
||||
BlockNumber num_pages,
|
||||
double num_tuples,
|
||||
BlockNumber num_all_visible_pages,
|
||||
bool hasindex,
|
||||
TransactionId frozenxid);
|
||||
extern void vacuum_set_xid_limits(int freeze_min_age, int freeze_table_age,
|
||||
bool sharedRel,
|
||||
TransactionId *oldestXmin,
|
||||
TransactionId *freezeLimit,
|
||||
TransactionId *freezeTableLimit);
|
||||
extern void vac_update_datfrozenxid(void);
|
||||
extern void vacuum_delay_point(void);
|
||||
|
||||
/* in commands/vacuumlazy.c */
|
||||
extern void lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt,
|
||||
BufferAccessStrategy bstrategy);
|
||||
|
||||
/* in commands/analyze.c */
|
||||
extern void analyze_rel(Oid relid, VacuumStmt *vacstmt,
|
||||
BufferAccessStrategy bstrategy);
|
||||
extern bool std_typanalyze(VacAttrStats *stats);
|
||||
extern double anl_random_fract(void);
|
||||
extern double anl_init_selection_state(int n);
|
||||
extern double anl_get_next_S(double t, int n, double *stateptr);
|
||||
|
||||
#endif /* VACUUM_H */
|
||||
40
pg_include/commands/variable.h
Executable file
40
pg_include/commands/variable.h
Executable file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* variable.h
|
||||
* Routines for handling specialized SET variables.
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/commands/variable.h
|
||||
*/
|
||||
#ifndef VARIABLE_H
|
||||
#define VARIABLE_H
|
||||
|
||||
#include "utils/guc.h"
|
||||
|
||||
|
||||
extern bool check_datestyle(char **newval, void **extra, GucSource source);
|
||||
extern void assign_datestyle(const char *newval, void *extra);
|
||||
extern bool check_timezone(char **newval, void **extra, GucSource source);
|
||||
extern void assign_timezone(const char *newval, void *extra);
|
||||
extern const char *show_timezone(void);
|
||||
extern bool check_log_timezone(char **newval, void **extra, GucSource source);
|
||||
extern void assign_log_timezone(const char *newval, void *extra);
|
||||
extern const char *show_log_timezone(void);
|
||||
extern bool check_transaction_read_only(bool *newval, void **extra, GucSource source);
|
||||
extern bool check_XactIsoLevel(char **newval, void **extra, GucSource source);
|
||||
extern void assign_XactIsoLevel(const char *newval, void *extra);
|
||||
extern const char *show_XactIsoLevel(void);
|
||||
extern bool check_transaction_deferrable(bool *newval, void **extra, GucSource source);
|
||||
extern bool check_random_seed(double *newval, void **extra, GucSource source);
|
||||
extern void assign_random_seed(double newval, void *extra);
|
||||
extern const char *show_random_seed(void);
|
||||
extern bool check_client_encoding(char **newval, void **extra, GucSource source);
|
||||
extern void assign_client_encoding(const char *newval, void *extra);
|
||||
extern bool check_session_authorization(char **newval, void **extra, GucSource source);
|
||||
extern void assign_session_authorization(const char *newval, void *extra);
|
||||
extern bool check_role(char **newval, void **extra, GucSource source);
|
||||
extern void assign_role(const char *newval, void *extra);
|
||||
extern const char *show_role(void);
|
||||
|
||||
#endif /* VARIABLE_H */
|
||||
21
pg_include/commands/view.h
Executable file
21
pg_include/commands/view.h
Executable file
@@ -0,0 +1,21 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* view.h
|
||||
*
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/commands/view.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef VIEW_H
|
||||
#define VIEW_H
|
||||
|
||||
#include "nodes/parsenodes.h"
|
||||
|
||||
extern void DefineView(ViewStmt *stmt, const char *queryString);
|
||||
|
||||
#endif /* VIEW_H */
|
||||
Reference in New Issue
Block a user