*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.46 1998/08/24 01:13:50 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.47 1998/08/25 21:24:09 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#include "tcop/utility.h"
#include "fmgr.h" /* For load_file() */
#include "storage/fd.h"
+#include "utils/ps_status.h"
#ifndef NO_SECURITY
#include "miscadmin.h"
void AlterUser(AlterUserStmt *stmt);
void RemoveUser(char *username);
-extern const char **ps_status; /* from postgres.c */
-
/* ----------------
* CHECK_IF_ABORTED() is used to avoid doing unnecessary
* processing within an aborted transaction block.
switch (stmt->command)
{
case BEGIN_TRANS:
- *ps_status = commandTag = "BEGIN";
+ PS_SET_STATUS( commandTag = "BEGIN" );
CHECK_IF_ABORTED();
BeginTransactionBlock();
break;
case END_TRANS:
- *ps_status = commandTag = "END";
+ PS_SET_STATUS( commandTag = "END" );
EndTransactionBlock();
break;
case ABORT_TRANS:
- *ps_status = commandTag = "ABORT";
+ PS_SET_STATUS( commandTag = "ABORT" );
UserAbortTransactionBlock();
break;
}
{
ClosePortalStmt *stmt = (ClosePortalStmt *) parsetree;
- *ps_status = commandTag = "CLOSE";
+ PS_SET_STATUS( commandTag = "CLOSE" );
CHECK_IF_ABORTED();
PerformPortalClose(stmt->portalname, dest);
bool forward;
int count;
- *ps_status = commandTag = (stmt->ismove) ? "MOVE" : "FETCH";
+ PS_SET_STATUS( commandTag = (stmt->ismove) ? "MOVE" : "FETCH" );
CHECK_IF_ABORTED();
forward = (bool) (stmt->direction == FORWARD);
*
*/
case T_CreateStmt:
- *ps_status = commandTag = "CREATE";
+ PS_SET_STATUS( commandTag = "CREATE" );
CHECK_IF_ABORTED();
DefineRelation((CreateStmt *) parsetree, RELKIND_RELATION);
List *args = stmt->relNames;
Relation rel;
- *ps_status = commandTag = "DROP";
+ PS_SET_STATUS( commandTag = "DROP" );
CHECK_IF_ABORTED();
foreach(arg, args)
{
CopyStmt *stmt = (CopyStmt *) parsetree;
- *ps_status = commandTag = "COPY";
+ PS_SET_STATUS( commandTag = "COPY" );
CHECK_IF_ABORTED();
DoCopy(stmt->relname,
{
AddAttrStmt *stmt = (AddAttrStmt *) parsetree;
- *ps_status = commandTag = "ADD";
+ PS_SET_STATUS( commandTag = "ADD" );
CHECK_IF_ABORTED();
/*
{
RenameStmt *stmt = (RenameStmt *) parsetree;
- *ps_status = commandTag = "RENAME";
+ PS_SET_STATUS( commandTag = "RENAME" );
CHECK_IF_ABORTED();
relname = stmt->relname;
AclItem *aip;
unsigned modechg;
- *ps_status = commandTag = "CHANGE";
+ PS_SET_STATUS( commandTag = "CHANGE" );
CHECK_IF_ABORTED();
aip = stmt->aclitem;
{
DefineStmt *stmt = (DefineStmt *) parsetree;
- *ps_status = commandTag = "CREATE";
+ PS_SET_STATUS( commandTag = "CREATE" );
CHECK_IF_ABORTED();
switch (stmt->defType)
{
ViewStmt *stmt = (ViewStmt *) parsetree;
- *ps_status = commandTag = "CREATE";
+ PS_SET_STATUS( commandTag = "CREATE" );
CHECK_IF_ABORTED();
DefineView(stmt->viewname, stmt->query); /* retrieve parsetree */
}
break;
case T_ProcedureStmt: /* CREATE FUNCTION */
- *ps_status = commandTag = "CREATE";
+ PS_SET_STATUS( commandTag = "CREATE" );
CHECK_IF_ABORTED();
CreateFunction((ProcedureStmt *) parsetree, dest); /* everything */
break;
{
IndexStmt *stmt = (IndexStmt *) parsetree;
- *ps_status = commandTag = "CREATE";
+ PS_SET_STATUS( commandTag = "CREATE" );
CHECK_IF_ABORTED();
DefineIndex(stmt->relname, /* relation name */
stmt->idxname, /* index name */
if (aclcheck_result != ACLCHECK_OK)
elog(ERROR, "%s: %s", relname, aclcheck_error_strings[aclcheck_result]);
#endif
- *ps_status = commandTag = "CREATE";
+ PS_SET_STATUS( commandTag = "CREATE" );
CHECK_IF_ABORTED();
DefineQueryRewrite(stmt);
}
break;
case T_CreateSeqStmt:
- *ps_status = commandTag = "CREATE";
+ PS_SET_STATUS( commandTag = "CREATE" );
CHECK_IF_ABORTED();
DefineSequence((CreateSeqStmt *) parsetree);
{
ExtendStmt *stmt = (ExtendStmt *) parsetree;
- *ps_status = commandTag = "EXTEND";
+ PS_SET_STATUS( commandTag = "EXTEND" );
CHECK_IF_ABORTED();
ExtendIndex(stmt->idxname, /* index name */
{
RemoveStmt *stmt = (RemoveStmt *) parsetree;
- *ps_status = commandTag = "DROP";
+ PS_SET_STATUS( commandTag = "DROP" );
CHECK_IF_ABORTED();
switch (stmt->removeType)
{
RemoveAggrStmt *stmt = (RemoveAggrStmt *) parsetree;
- *ps_status = commandTag = "DROP";
+ PS_SET_STATUS( commandTag = "DROP" );
CHECK_IF_ABORTED();
RemoveAggregate(stmt->aggname, stmt->aggtype);
}
{
RemoveFuncStmt *stmt = (RemoveFuncStmt *) parsetree;
- *ps_status = commandTag = "DROP";
+ PS_SET_STATUS( commandTag = "DROP" );
CHECK_IF_ABORTED();
RemoveFunction(stmt->funcname,
length(stmt->args),
char *type1 = (char *) NULL;
char *type2 = (char *) NULL;
- *ps_status = commandTag = "DROP";
+ PS_SET_STATUS( commandTag = "DROP" );
CHECK_IF_ABORTED();
if (lfirst(stmt->args) != NULL)
{
CreatedbStmt *stmt = (CreatedbStmt *) parsetree;
- *ps_status = commandTag = "CREATEDB";
+ PS_SET_STATUS( commandTag = "CREATEDB" );
CHECK_IF_ABORTED();
createdb(stmt->dbname, stmt->dbpath, stmt->encoding);
}
{
DestroydbStmt *stmt = (DestroydbStmt *) parsetree;
- *ps_status = commandTag = "DESTROYDB";
+ PS_SET_STATUS( commandTag = "DESTROYDB" );
CHECK_IF_ABORTED();
destroydb(stmt->dbname);
}
{
NotifyStmt *stmt = (NotifyStmt *) parsetree;
- *ps_status = commandTag = "NOTIFY";
+ PS_SET_STATUS( commandTag = "NOTIFY" );
CHECK_IF_ABORTED();
Async_Notify(stmt->relname);
{
ListenStmt *stmt = (ListenStmt *) parsetree;
- *ps_status = commandTag = "LISTEN";
+ PS_SET_STATUS( commandTag = "LISTEN" );
CHECK_IF_ABORTED();
Async_Listen(stmt->relname, MyProcPid);
FILE *fp;
char *filename;
- *ps_status = commandTag = "LOAD";
+ PS_SET_STATUS( commandTag = "LOAD" );
CHECK_IF_ABORTED();
filename = stmt->filename;
{
ClusterStmt *stmt = (ClusterStmt *) parsetree;
- *ps_status = commandTag = "CLUSTER";
+ PS_SET_STATUS( commandTag = "CLUSTER" );
CHECK_IF_ABORTED();
cluster(stmt->relname, stmt->indexname);
break;
case T_VacuumStmt:
- *ps_status = commandTag = "VACUUM";
+ PS_SET_STATUS( commandTag = "VACUUM" );
CHECK_IF_ABORTED();
vacuum(((VacuumStmt *) parsetree)->vacrel,
((VacuumStmt *) parsetree)->verbose,
{
ExplainStmt *stmt = (ExplainStmt *) parsetree;
- *ps_status = commandTag = "EXPLAIN";
+ PS_SET_STATUS( commandTag = "EXPLAIN" );
CHECK_IF_ABORTED();
ExplainQuery(stmt->query, stmt->verbose, dest);
{
RecipeStmt *stmt = (RecipeStmt *) parsetree;
- *ps_status = commandTag = "EXECUTE RECIPE";
+ PS_SET_STATUS( commandTag = "EXECUTE RECIPE" );
CHECK_IF_ABORTED();
beginRecipe(stmt);
}
VariableSetStmt *n = (VariableSetStmt *) parsetree;
SetPGVariable(n->name, n->value);
- *ps_status = commandTag = "SET VARIABLE";
+ PS_SET_STATUS( commandTag = "SET VARIABLE" );
}
break;
VariableShowStmt *n = (VariableShowStmt *) parsetree;
GetPGVariable(n->name);
- *ps_status = commandTag = "SHOW VARIABLE";
+ PS_SET_STATUS( commandTag = "SHOW VARIABLE" );
}
break;
VariableResetStmt *n = (VariableResetStmt *) parsetree;
ResetPGVariable(n->name);
- *ps_status = commandTag = "RESET VARIABLE";
+ PS_SET_STATUS( commandTag = "RESET VARIABLE" );
}
break;
* ******************************** TRIGGER statements *******************************
*/
case T_CreateTrigStmt:
- *ps_status = commandTag = "CREATE";
+ PS_SET_STATUS( commandTag = "CREATE" );
CHECK_IF_ABORTED();
CreateTrigger((CreateTrigStmt *) parsetree);
break;
case T_DropTrigStmt:
- *ps_status = commandTag = "DROP";
+ PS_SET_STATUS( commandTag = "DROP" );
CHECK_IF_ABORTED();
DropTrigger((DropTrigStmt *) parsetree);
* ************* PROCEDURAL LANGUAGE statements *****************
*/
case T_CreatePLangStmt:
- *ps_status = commandTag = "CREATE";
+ PS_SET_STATUS( commandTag = "CREATE" );
CHECK_IF_ABORTED();
CreateProceduralLanguage((CreatePLangStmt *) parsetree);
break;
case T_DropPLangStmt:
- *ps_status = commandTag = "DROP";
+ PS_SET_STATUS( commandTag = "DROP" );
CHECK_IF_ABORTED();
DropProceduralLanguage((DropPLangStmt *) parsetree);
*
*/
case T_CreateUserStmt:
- *ps_status = commandTag = "CREATE USER";
+ PS_SET_STATUS( commandTag = "CREATE USER" );
CHECK_IF_ABORTED();
DefineUser((CreateUserStmt *) parsetree);
break;
case T_AlterUserStmt:
- *ps_status = commandTag = "ALTER USER";
+ PS_SET_STATUS( commandTag = "ALTER USER" );
CHECK_IF_ABORTED();
AlterUser((AlterUserStmt *) parsetree);
break;
case T_DropUserStmt:
- *ps_status = commandTag = "DROP USER";
+ PS_SET_STATUS( commandTag = "DROP USER" );
CHECK_IF_ABORTED();
RemoveUser(((DropUserStmt *) parsetree)->user);