*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.7 2000/10/05 19:48:22 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.8 2000/10/16 17:08:05 momjian Exp $
*
*-------------------------------------------------------------------------
onerel = heap_open(relid, AccessShareLock);
-#ifndef NO_SECURITY
if (!pg_ownercheck(GetUserId(), RelationGetRelationName(onerel),
RELNAME))
{
CommitTransactionCommand();
return;
}
-#endif
elog(MESSAGE_LEVEL, "Analyzing...");
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.106 2000/10/10 17:13:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.107 2000/10/16 17:08:05 momjian Exp $
*
* NOTES
* The PerformAddAttribute() code, like most of the relation
if (!allowSystemTableMods && IsSystemRelationName(relationName))
elog(ERROR, "ALTER TABLE: relation \"%s\" is a system catalog",
relationName);
-#ifndef NO_SECURITY
if (!pg_ownercheck(GetUserId(), relationName, RELNAME))
elog(ERROR, "ALTER TABLE: permission denied");
-#endif
/*
* Grab an exclusive lock on the target table, which we will NOT
scan = heap_beginscan(rel, false, SnapshotNow, 0, NULL);
AssertState(scan != NULL);
- /*
+ /*
* We need to make a parse state and range table to allow
* us to transformExpr and fix_opids to get a version of
* the expression we can pass to ExecQual
rte->eref->relname = relationName;
rtlist = makeList1(rte);
- /*
+ /*
* Scan through the rows now, making the necessary things
* for ExecQual, and then call it to evaluate the
* expression.
pfree(rte);
heap_endscan(scan);
- heap_close(rel, NoLock);
+ heap_close(rel, NoLock);
- if (!successful)
+ if (!successful)
{
elog(ERROR, "AlterTableAddConstraint: rejected due to CHECK constraint %s", name);
}
- /*
+ /*
* Call AddRelationRawConstraints to do the real adding --
* It duplicates some of the above, but does not check the
* validity of the constraint against tuples already in
pkrel = heap_openr(fkconstraint->pktable_name, AccessExclusiveLock);
if (pkrel->rd_rel->relkind != RELKIND_RELATION)
- elog(ERROR, "referenced table \"%s\" not a relation",
+ elog(ERROR, "referenced table \"%s\" not a relation",
fkconstraint->pktable_name);
/*
}
}
if (found)
- break;
+ break;
indexStruct = NULL;
}
if (!found)
if (((Form_pg_class) GETSTRUCT(reltup))->reltoastrelid != InvalidOid)
{
- if (silent)
+ if (silent)
{
heap_close(rel, NoLock);
heap_close(class_rel, NoLock);
elog(ERROR, "ALTER TABLE: relation \"%s\" already has a toast table",
relationName);
- }
+ }
/*
* Check to see whether the table actually needs a TOAST table.
*/
if (! needs_toast_table(rel))
{
- if (silent)
+ if (silent)
{
heap_close(rel, NoLock);
heap_close(class_rel, NoLock);
if (rel->rd_rel->relkind != RELKIND_RELATION)
elog(ERROR, "LOCK TABLE: %s is not a table", lockstmt->relname);
- if (is_view(rel))
+ if (is_view(rel))
elog(ERROR, "LOCK TABLE: cannot lock a view");
if (lockstmt->mode == AccessShareLock)
while (HeapTupleIsValid(tuple = heap_getnext(scanDesc, 0)))
{
- if (tuple->t_data != NULL)
+ if (tuple->t_data != NULL)
{
data = (Form_pg_rewrite) GETSTRUCT(tuple);
if (data->ev_type == '1')
heap_endscan(scanDesc);
heap_close(RewriteRelation, RowExclusiveLock);
-
+
return retval;
}
/*** First, check object security ***/
-#ifndef NO_SECURITY
if (!pg_ownercheck(GetUserId(), relname, RELNAME))
elog(ERROR, "you are not permitted to comment on class '%s'", relname);
-#endif
/*** Now, attempt to find the oid in the cached version of pg_class ***/
/*** First, check object security ***/
-#ifndef NO_SECURITY
if (!pg_ownercheck(GetUserId(), relname, RELNAME))
elog(ERROR, "you are not permitted to comment on class '%s\'", relname);
-#endif
/*** Now, fetch the attribute oid from the system cache ***/
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.53 2000/10/07 00:58:16 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.54 2000/10/16 17:08:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
if (HeapTupleIsValid(tup))
{
-#ifndef NO_SECURITY
if (!pg_ownercheck(GetUserId(),
(char *) ObjectIdGetDatum(tup->t_data->t_oid),
OPEROID))
elog(ERROR, "RemoveOperator: operator '%s': permission denied",
operatorName);
-#endif
/*** Delete any comments associated with this operator ***/
Oid typeOid;
char *shadow_type;
-#ifndef NO_SECURITY
if (!pg_ownercheck(GetUserId(), typeName, TYPENAME))
elog(ERROR, "RemoveType: type '%s': permission denied",
typeName);
-#endif
relation = heap_openr(TypeRelationName, RowExclusiveLock);
}
}
-#ifndef NO_SECURITY
if (!pg_func_ownercheck(GetUserId(), functionName, nargs, argList))
{
elog(ERROR, "RemoveFunction: function '%s': permission denied",
functionName);
}
-#endif
relation = heap_openr(ProcedureRelationName, RowExclusiveLock);
tup = SearchSysCacheTuple(PROCNAME,
else
basetypeID = 0;
-#ifndef NO_SECURITY
if (!pg_aggr_ownercheck(GetUserId(), aggName, basetypeID))
{
if (aggType)
aggName);
}
}
-#endif
relation = heap_openr(AggregateRelationName, RowExclusiveLock);
tup = SearchSysCacheTuple(AGGNAME,
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.48 2000/10/16 14:52:03 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.49 2000/10/16 17:08:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
if (!allowSystemTableMods && IsSystemRelationName(relname))
elog(ERROR, "renameatt: class \"%s\" is a system catalog",
relname);
-#ifndef NO_SECURITY
if (!IsBootstrapProcessingMode() &&
!pg_ownercheck(GetUserId(), relname, RELNAME))
elog(ERROR, "renameatt: you do not own class \"%s\"",
relname);
-#endif
/*
* Grab an exclusive lock on the target table, which we will NOT
next,
rescnt = 0;
-#ifndef NO_SECURITY
if (pg_aclcheck(seqname, GetUserId(), ACL_WR) != ACLCHECK_OK)
elog(ERROR, "%s.nextval: you don't have permissions to set sequence %s",
seqname, seqname);
-#endif
/* open and AccessShareLock sequence */
elm = init_sequence("nextval", seqname);
SeqTable elm;
int32 result;
-#ifndef NO_SECURITY
if (pg_aclcheck(seqname, GetUserId(), ACL_RD) != ACLCHECK_OK)
elog(ERROR, "%s.currval: you don't have permissions to read sequence %s",
seqname, seqname);
-#endif
/* open and AccessShareLock sequence */
elm = init_sequence("currval", seqname);
PG_RETURN_INT32(result);
}
-static void
+static void
do_setval(char *seqname, int32 next, bool iscalled)
{
SeqTable elm;
Buffer buf;
Form_pg_sequence seq;
-#ifndef NO_SECURITY
if (pg_aclcheck(seqname, GetUserId(), ACL_WR) != ACLCHECK_OK)
elog(ERROR, "%s.setval: you don't have permissions to set sequence %s",
seqname, seqname);
-#endif
/* open and AccessShareLock sequence */
elm = init_sequence("setval", seqname);
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.77 2000/09/06 14:15:16 petere Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.78 2000/10/16 17:08:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
if (!allowSystemTableMods && IsSystemRelationName(stmt->relname))
elog(ERROR, "CreateTrigger: can't create trigger for system relation %s", stmt->relname);
-#ifndef NO_SECURITY
if (!pg_ownercheck(GetUserId(), stmt->relname, RELNAME))
elog(ERROR, "%s: %s", stmt->relname, aclcheck_error_strings[ACLCHECK_NOT_OWNER]);
-#endif
/* ----------
* If trigger is a constraint, user trigger name as constraint
int found = 0;
int tgfound = 0;
-#ifndef NO_SECURITY
if (!pg_ownercheck(GetUserId(), stmt->relname, RELNAME))
elog(ERROR, "%s: %s", stmt->relname, aclcheck_error_strings[ACLCHECK_NOT_OWNER]);
-#endif
rel = heap_openr(stmt->relname, AccessExclusiveLock);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.167 2000/10/05 19:48:22 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.168 2000/10/16 17:08:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
onerel = heap_open(relid, AccessExclusiveLock);
-#ifndef NO_SECURITY
if (!pg_ownercheck(GetUserId(), RelationGetRelationName(onerel),
RELNAME))
{
CommitTransactionCommand();
return;
}
-#endif
/*
* Remember the relation'ss TOAST relation for later
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.129 2000/10/05 19:11:26 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.130 2000/10/16 17:08:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Do permissions checks.
*/
-#ifndef NO_SECURITY
ExecCheckQueryPerms(operation, parseTree, plan);
-#endif
/*
* get information from query descriptor
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.95 2000/10/07 00:58:18 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.96 2000/10/16 17:08:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
relname);
/* close rel, but keep lock until end of xact */
heap_close(rel, NoLock);
-#ifndef NO_SECURITY
if (!pg_ownercheck(GetUserId(), relname, RELNAME))
elog(ERROR, "you do not own class \"%s\"",
relname);
-#endif
}
/* OK, terminate 'em all */
foreach(arg, args)
relname);
heap_close(rel, NoLock);
-#ifndef NO_SECURITY
if (!pg_ownercheck(GetUserId(), relname, RELNAME))
elog(ERROR, "you do not own class \"%s\"", relname);
-#endif
TruncateRelation(relname);
}
break;
if (!allowSystemTableMods && IsSystemRelationName(relname))
elog(ERROR, "ALTER TABLE: relation \"%s\" is a system catalog",
relname);
-#ifndef NO_SECURITY
if (!pg_ownercheck(GetUserId(), relname, RELNAME))
elog(ERROR, "permission denied");
-#endif
/* ----------------
* XXX using len == 3 to tell the difference
RuleStmt *stmt = (RuleStmt *) parsetree;
int aclcheck_result;
-#ifndef NO_SECURITY
relname = stmt->object->relname;
aclcheck_result = pg_aclcheck(relname, GetUserId(), ACL_RU);
if (aclcheck_result != ACLCHECK_OK)
elog(ERROR, "%s: %s", relname, aclcheck_error_strings[aclcheck_result]);
-#endif
set_ps_display(commandTag = "CREATE");
DefineQueryRewrite(stmt);
if (!allowSystemTableMods && IsSystemRelationName(relname))
elog(ERROR, "class \"%s\" is a system catalog index",
relname);
-#ifndef NO_SECURITY
if (!pg_ownercheck(GetUserId(), relname, RELNAME))
elog(ERROR, "%s: %s", relname, aclcheck_error_strings[ACLCHECK_NOT_OWNER]);
-#endif
RemoveIndex(relname);
break;
case RULE:
char *rulename = stmt->name;
int aclcheck_result;
-#ifndef NO_SECURITY
-
relationName = RewriteGetRuleEventRel(rulename);
aclcheck_result = pg_aclcheck(relationName, GetUserId(), ACL_RU);
if (aclcheck_result != ACLCHECK_OK)
elog(ERROR, "%s: %s", relationName, aclcheck_error_strings[aclcheck_result]);
-#endif
RemoveRewriteRule(rulename);
}
break;
case TYPE_P:
-#ifndef NO_SECURITY
/* XXX moved to remove.c */
-#endif
RemoveType(stmt->name);
break;
case VIEW:
char *viewName = stmt->name;
char *ruleName;
-#ifndef NO_SECURITY
-
ruleName = MakeRetrieveViewRuleName(viewName);
relationName = RewriteGetRuleEventRel(ruleName);
if (!pg_ownercheck(GetUserId(), relationName, RELNAME))
elog(ERROR, "%s: %s", relationName, aclcheck_error_strings[ACLCHECK_NOT_OWNER]);
pfree(ruleName);
-#endif
RemoveView(viewName);
}
break;
elog(ERROR, "\"%s\" is a system index. call REINDEX under standalone postgres with -P -O options",
relname);
}
-#ifndef NO_SECURITY
if (!pg_ownercheck(GetUserId(), relname, RELNAME))
elog(ERROR, "%s: %s", relname, aclcheck_error_strings[ACLCHECK_NOT_OWNER]);
-#endif
ReindexIndex(relname, stmt->force);
break;
case TABLE:
relname);
}
-#ifndef NO_SECURITY
if (!pg_ownercheck(GetUserId(), relname, RELNAME))
elog(ERROR, "%s: %s", relname, aclcheck_error_strings[ACLCHECK_NOT_OWNER]);
-#endif
ReindexTable(relname, stmt->force);
break;
case DATABASE:
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.50 2000/10/07 00:58:19 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.51 2000/10/16 17:08:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
if (rel && rel->rd_rel->relkind == RELKIND_INDEX)
elog(ERROR, "\"%s\" is an index relation",
relname);
-#ifndef NO_SECURITY
if (!pg_ownercheck(GetUserId(), relname, RELNAME))
elog(ERROR, "you do not own class \"%s\"",
relname);
-#endif
ChangeAcl(relname, &aclitem, modechg);
/* close rel, but keep lock until end of xact */
heap_close(rel, NoLock);
* or in config.h afterwards. Of course, if you edit config.h, then your
* changes will be overwritten the next time you run configure.
*
- * $Id: config.h.in,v 1.142 2000/10/14 23:56:58 momjian Exp $
+ * $Id: config.h.in,v 1.143 2000/10/16 17:08:11 momjian Exp $
*/
#ifndef CONFIG_H
/* #define RTDEBUG */
/* #define GISTDEBUG */
/* #define OMIT_PARTIAL_INDEX */
-/* #define NO_SECURITY */
/* #define LOCK_DEBUG */
/*