예제 #1
0
/*
 * DefineRule
 *		Execute a CREATE RULE command.
 */
ObjectAddress
DefineRule(RuleStmt *stmt, const char *queryString)
{
	List	   *actions;
	Node	   *whereClause;
	Oid			relId;

	/* Parse analysis. */
	transformRuleStmt(stmt, queryString, &actions, &whereClause);

	/*
	 * Find and lock the relation.  Lock level should match
	 * DefineQueryRewrite.
	 */
	relId = RangeVarGetRelid(stmt->relation, AccessExclusiveLock, false);

	/* ... and execute */
	return DefineQueryRewrite(stmt->rulename,
							  relId,
							  whereClause,
							  stmt->event,
							  stmt->instead,
							  stmt->replace,
							  actions);
}
예제 #2
0
파일: rewriteDefine.c 프로젝트: GisKook/Gis
/*
 * DefineRule
 *		Execute a CREATE RULE command.
 */
void
DefineRule(RuleStmt *stmt, const char *queryString)
{
	List	   *actions;
	Node	   *whereClause;
	Oid			relId;

	/* Parse analysis ... */
	transformRuleStmt(stmt, queryString, &actions, &whereClause);

	/* ... find the relation ... */
	relId = RangeVarGetRelid(stmt->relation, false);

	/* ... and execute */
	DefineQueryRewrite(stmt->rulename,
					   relId,
					   whereClause,
					   stmt->event,
					   stmt->instead,
					   stmt->replace,
					   actions);
}