1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-25 13:17:41 +03:00

The contents of command.c, creatinh.c, define.c, remove.c and rename.c

have been divided according to the type of object manipulated - so ALTER
TABLE code is in tablecmds.c, aggregate commands in aggregatecmds.c and
so on.

A few common support routines remain in define.c (prototypes in
src/include/commands/defrem.h).

No code has been changed except for includes to reflect the new files.
The prototypes for aggregatecmds.c, functioncmds.c, operatorcmds.c,
and typecmds.c remain in src/include/commands/defrem.h.

From John Gray <jgray@azuli.co.uk>
This commit is contained in:
Tom Lane
2002-04-15 05:22:04 +00:00
parent ab1ead6b97
commit 71dc300a37
29 changed files with 3620 additions and 3578 deletions

View File

@@ -1,81 +0,0 @@
/*-------------------------------------------------------------------------
*
* command.h
* prototypes for command.c.
*
*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: command.h,v 1.37 2002/04/01 04:35:39 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef COMMAND_H
#define COMMAND_H
#include "utils/portal.h"
/*
* PerformPortalFetch
* Performs the POSTQUEL function FETCH. Fetches count (or all if 0)
* tuples in portal with name in the forward direction iff goForward.
*
* Exceptions:
* BadArg if forward invalid.
* "ERROR" if portal not found.
*/
extern void PerformPortalFetch(char *name, bool forward, int count,
CommandDest dest, char *completionTag);
/*
* PerformPortalClose
* Performs the POSTQUEL function CLOSE.
*/
extern void PerformPortalClose(char *name, CommandDest dest);
extern void PortalCleanup(Portal portal);
/*
* ALTER TABLE variants
*/
extern void AlterTableAddColumn(Oid myrelid, bool inherits, ColumnDef *colDef);
extern void AlterTableAlterColumnDefault(Oid myrelid, bool inh,
const char *colName, Node *newDefault);
extern void AlterTableAlterColumnDropNotNull(Oid myrelid,
bool inh, const char *colName);
extern void AlterTableAlterColumnSetNotNull(Oid myrelid,
bool inh, const char *colName);
extern void AlterTableAlterColumnFlags(Oid myrelid,
bool inh, const char *colName,
Node *flagValue, const char *flagType);
extern void AlterTableDropColumn(Oid myrelid, bool inh,
const char *colName, int behavior);
extern void AlterTableAddConstraint(Oid myrelid,
bool inh, List *newConstraints);
extern void AlterTableDropConstraint(Oid myrelid,
bool inh, const char *constrName, int behavior);
extern void AlterTableCreateToastTable(Oid relOid, bool silent);
extern void AlterTableOwner(Oid relationOid, int32 newOwnerSysId);
/*
* LOCK
*/
extern void LockTableCommand(LockStmt *lockstmt);
/*
* SCHEMA
*/
extern void CreateSchemaCommand(CreateSchemaStmt *parsetree);
#endif /* COMMAND_H */

View File

@@ -1,23 +0,0 @@
/*-------------------------------------------------------------------------
*
* creatinh.h
* prototypes for creatinh.c.
*
*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: creatinh.h,v 1.20 2002/03/29 19:06:22 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef CREATINH_H
#define CREATINH_H
#include "nodes/parsenodes.h"
extern Oid DefineRelation(CreateStmt *stmt, char relkind);
extern void RemoveRelation(const RangeVar *relation);
extern void TruncateRelation(const RangeVar *relation);
#endif /* CREATINH_H */

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: defrem.h,v 1.34 2002/04/09 20:35:54 tgl Exp $
* $Id: defrem.h,v 1.35 2002/04/15 05:22:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -16,6 +16,8 @@
#include "nodes/parsenodes.h"
#define DEFAULT_TYPDELIM ','
/*
* prototypes in indexcmds.c
*/
@@ -33,22 +35,33 @@ extern void ReindexTable(RangeVar *relation, bool force);
extern void ReindexDatabase(const char *databaseName, bool force, bool all);
/*
* prototypes in define.c
* DefineFoo and RemoveFoo are now both in foocmds.c
*/
extern void CreateFunction(ProcedureStmt *stmt);
extern void DefineOperator(List *names, List *parameters);
extern void DefineAggregate(List *names, List *parameters);
extern void DefineType(List *names, List *parameters);
extern void DefineDomain(CreateDomainStmt *stmt);
/*
* prototypes in remove.c
*/
extern void RemoveDomain(List *names, int behavior);
extern void CreateFunction(ProcedureStmt *stmt);
extern void RemoveFunction(List *functionName, List *argTypes);
extern void DefineOperator(List *names, List *parameters);
extern void RemoveOperator(char *operatorName,
TypeName *typeName1, TypeName *typeName2);
extern void RemoveType(List *names);
TypeName *typeName1, TypeName *typeName2);
extern void DefineAggregate(List *names, List *parameters);
extern void RemoveAggregate(List *aggName, TypeName *aggType);
extern void DefineType(List *names, List *parameters);
extern void RemoveType(List *names);
extern void DefineDomain(CreateDomainStmt *stmt);
extern void RemoveDomain(List *names, int behavior);
/* support routines in define.c */
extern void case_translate_language_name(const char *input, char *output);
extern char *defGetString(DefElem *def);
extern double defGetNumeric(DefElem *def);
extern List *defGetQualifiedName(DefElem *def);
extern TypeName *defGetTypeName(DefElem *def);
extern int defGetTypeLength(DefElem *def);
#endif /* DEFREM_H */

View File

@@ -0,0 +1,24 @@
/*-------------------------------------------------------------------------
*
* lockcmds.h
* prototypes for lockcmds.c.
*
*
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: lockcmds.h,v 1.1 2002/04/15 05:22:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef LOCKCMDS_H
#define LOCKCMDS_H
#include "nodes/parsenodes.h"
/*
* LOCK
*/
extern void LockTableCommand(LockStmt *lockstmt);
#endif /* LOCKCMDS_H */

View File

@@ -0,0 +1,39 @@
/*-------------------------------------------------------------------------
*
* portalcmds.h
* prototypes for portalcmds.c.
*
*
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: portalcmds.h,v 1.1 2002/04/15 05:22:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PORTALCMDS_H
#define PORTALCMDS_H
#include "utils/portal.h"
/*
* PerformPortalFetch
* Performs the POSTQUEL function FETCH. Fetches count (or all if 0)
* tuples in portal with name in the forward direction iff goForward.
*
* Exceptions:
* BadArg if forward invalid.
* "ERROR" if portal not found.
*/
extern void PerformPortalFetch(char *name, bool forward, int count,
CommandDest dest, char *completionTag);
/*
* PerformPortalClose
* Performs the POSTQUEL function CLOSE.
*/
extern void PerformPortalClose(char *name, CommandDest dest);
extern void PortalCleanup(Portal portal);
#endif /* PORTALCMDS_H */

View File

@@ -1,25 +0,0 @@
/*-------------------------------------------------------------------------
*
* rename.h
*
*
*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: rename.h,v 1.16 2002/03/31 07:49:30 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef RENAME_H
#define RENAME_H
extern void renameatt(Oid relid,
const char *oldattname,
const char *newattname,
bool recurse);
extern void renamerel(Oid relid,
const char *newrelname);
#endif /* RENAME_H */

View File

@@ -0,0 +1,22 @@
/*-------------------------------------------------------------------------
*
* schemacmds.h
* prototypes for schemacmds.c.
*
*
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: schemacmds.h,v 1.1 2002/04/15 05:22:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef SCHEMACMDS_H
#define SCHEMACMDS_H
#include "nodes/parsenodes.h"
extern void CreateSchemaCommand(CreateSchemaStmt *parsetree);
#endif /* SCHEMACMDS_H */

View File

@@ -0,0 +1,63 @@
/*-------------------------------------------------------------------------
*
* tablecmds.h
* prototypes for tablecmds.c.
*
*
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: tablecmds.h,v 1.1 2002/04/15 05:22:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef TABLECMDS_H
#define TABLECMDS_H
#include "nodes/parsenodes.h"
extern void AlterTableAddColumn(Oid myrelid, bool inherits,
ColumnDef *colDef);
extern void AlterTableAlterColumnDefault(Oid myrelid, bool inh,
const char *colName,
Node *newDefault);
extern void AlterTableAlterColumnDropNotNull(Oid myrelid, bool inh,
const char *colName);
extern void AlterTableAlterColumnSetNotNull(Oid myrelid, bool inh,
const char *colName);
extern void AlterTableAlterColumnFlags(Oid myrelid, bool inh,
const char *colName,
Node *flagValue, const char *flagType);
extern void AlterTableDropColumn(Oid myrelid, bool inh,
const char *colName, int behavior);
extern void AlterTableAddConstraint(Oid myrelid, bool inh,
List *newConstraints);
extern void AlterTableDropConstraint(Oid myrelid, bool inh,
const char *constrName, int behavior);
extern void AlterTableCreateToastTable(Oid relOid, bool silent);
extern void AlterTableOwner(Oid relationOid, int32 newOwnerSysId);
extern Oid DefineRelation(CreateStmt *stmt, char relkind);
extern void RemoveRelation(const RangeVar *relation);
extern void TruncateRelation(const RangeVar *relation);
extern void renameatt(Oid relid,
const char *oldattname,
const char *newattname,
bool recurse);
extern void renamerel(Oid relid,
const char *newrelname);
#endif /* TABLECMDS_H */