diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-11-11 22:19:25 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-11-11 22:19:25 +0000 |
commit | f9b5b41ef993a9b76b7f97b271df8034f1a24154 (patch) | |
tree | ddd95da1ffa8ce1fee1ebc807822d6cc67cd8cdd /src/include/commands/tablecmds.h | |
parent | 1b342df00af318055a1cf432c3eaa3b74347df39 (diff) | |
download | postgresql-f9b5b41ef993a9b76b7f97b271df8034f1a24154.tar.gz postgresql-f9b5b41ef993a9b76b7f97b271df8034f1a24154.zip |
Code review for ON COMMIT patch. Make the actual on-commit action happen
before commit, not after :-( --- the original coding is not only unsafe
if an error occurs while it's processing, but it generates an invalid
sequence of WAL entries. Resurrect 7.2 logic for deleting items when
no longer needed. Use an enum instead of random macros. Editorialize
on names used for routines and constants. Teach backend/nodes routines
about new field in CreateTable struct. Add a regression test.
Diffstat (limited to 'src/include/commands/tablecmds.h')
-rw-r--r-- | src/include/commands/tablecmds.h | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/src/include/commands/tablecmds.h b/src/include/commands/tablecmds.h index 329f0989dd9..13873dad1b5 100644 --- a/src/include/commands/tablecmds.h +++ b/src/include/commands/tablecmds.h @@ -7,14 +7,13 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: tablecmds.h,v 1.9 2002/11/09 23:56:39 momjian Exp $ + * $Id: tablecmds.h,v 1.10 2002/11/11 22:19:24 tgl Exp $ * *------------------------------------------------------------------------- */ #ifndef TABLECMDS_H #define TABLECMDS_H -#include "access/htup.h" #include "nodes/parsenodes.h" extern void AlterTableAddColumn(Oid myrelid, bool recurse, ColumnDef *colDef); @@ -63,29 +62,10 @@ extern void renameatt(Oid myrelid, extern void renamerel(Oid myrelid, const char *newrelname); -/* - * Temp rel stuff - */ -typedef struct TempTable -{ - Oid relid; /* relid of temp relation */ - char ateoxact; /* what to do at end of xact */ - TransactionId tid; /* trans id where in rel was created */ - bool dead; /* table was dropped in the current xact */ -} TempTable; - -extern void AtEOXact_temp_relations(bool iscommit, int bstate); -extern void reg_temp_rel(TempTable *t); -extern void free_temp_rels(void); -extern void rm_temp_rel(Oid relid); - -/* - * What to do at commit time for temporary relations - */ +extern void register_on_commit_action(Oid relid, OnCommitAction action); +extern void remove_on_commit_action(Oid relid); -#define ATEOXACTNOOP 0 /* no operation at commit */ -#define ATEOXACTPRESERVE 1 /* preserve rows */ -#define ATEOXACTDELETE 2 /* delete rows */ -#define ATEOXACTDROP 3 /* drop temp table */ +extern void PreCommit_on_commit_actions(void); +extern void AtEOXact_on_commit_actions(bool isCommit); #endif /* TABLECMDS_H */ |