mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
ALTER TABLE rewrite. New cool stuff:
* ALTER ... ADD COLUMN with defaults and NOT NULL constraints works per SQL spec. A default is implemented by rewriting the table with the new value stored in each row. * ALTER COLUMN TYPE. You can change a column's datatype to anything you want, so long as you can specify how to convert the old value. Rewrites the table. (Possible future improvement: optimize no-op conversions such as varchar(N) to varchar(N+1).) * Multiple ALTER actions in a single ALTER TABLE command. You can perform any number of column additions, type changes, and constraint additions with only one pass over the table contents. Basic documentation provided in ALTER TABLE ref page, but some more docs work is needed. Original patch from Rod Taylor, additional work from Tom Lane.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/commands/tablecmds.h,v 1.15 2004/03/23 19:35:17 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/commands/tablecmds.h,v 1.16 2004/05/05 04:48:47 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -16,46 +16,17 @@
|
||||
|
||||
#include "nodes/parsenodes.h"
|
||||
|
||||
extern void AlterTableAddColumn(Oid myrelid, bool recurse, ColumnDef *colDef);
|
||||
|
||||
extern void AlterTableAlterColumnDropNotNull(Oid myrelid, bool recurse,
|
||||
const char *colName);
|
||||
|
||||
extern void AlterTableAlterColumnSetNotNull(Oid myrelid, bool recurse,
|
||||
const char *colName);
|
||||
|
||||
extern void AlterTableAlterColumnDefault(Oid myrelid, bool recurse,
|
||||
const char *colName,
|
||||
Node *newDefault);
|
||||
|
||||
extern void AlterTableAlterColumnFlags(Oid myrelid, bool recurse,
|
||||
const char *colName,
|
||||
Node *flagValue, const char *flagType);
|
||||
|
||||
extern void AlterTableDropColumn(Oid myrelid, bool recurse, bool recursing,
|
||||
const char *colName,
|
||||
DropBehavior behavior);
|
||||
|
||||
extern void AlterTableAddConstraint(Oid myrelid, bool recurse,
|
||||
List *newConstraints);
|
||||
|
||||
extern void AlterTableDropConstraint(Oid myrelid, bool recurse,
|
||||
const char *constrName,
|
||||
DropBehavior behavior);
|
||||
|
||||
extern void AlterTableClusterOn(Oid relOid, const char *indexName);
|
||||
|
||||
extern void AlterTableCreateToastTable(Oid relOid, bool silent);
|
||||
|
||||
extern void AlterTableOwner(Oid relationOid, int32 newOwnerSysId);
|
||||
|
||||
extern void AlterTableAlterOids(Oid myrelid, bool setOid, bool recurse,
|
||||
DropBehavior behavior);
|
||||
|
||||
extern Oid DefineRelation(CreateStmt *stmt, char relkind);
|
||||
|
||||
extern void RemoveRelation(const RangeVar *relation, DropBehavior behavior);
|
||||
|
||||
extern void AlterTable(AlterTableStmt *stmt);
|
||||
|
||||
extern void AlterTableInternal(Oid relid, List *cmds, bool recurse);
|
||||
|
||||
extern void AlterTableCreateToastTable(Oid relOid, bool silent);
|
||||
|
||||
extern void TruncateRelation(const RangeVar *relation);
|
||||
|
||||
extern void renameatt(Oid myrelid,
|
||||
|
||||
Reference in New Issue
Block a user