mirror of
https://github.com/postgres/postgres.git
synced 2025-07-17 06:41:09 +03:00
Adjust more backend functions to return OID rather than void.
This is again intended to support extensions to the event trigger functionality. This may go a bit further than we need for that purpose, but there's some value in being consistent, and the OID may be useful for other purposes also. Dimitri Fontaine
This commit is contained in:
@ -191,7 +191,7 @@ InsertRule(char *rulname,
|
||||
* DefineRule
|
||||
* Execute a CREATE RULE command.
|
||||
*/
|
||||
void
|
||||
Oid
|
||||
DefineRule(RuleStmt *stmt, const char *queryString)
|
||||
{
|
||||
List *actions;
|
||||
@ -208,13 +208,13 @@ DefineRule(RuleStmt *stmt, const char *queryString)
|
||||
relId = RangeVarGetRelid(stmt->relation, AccessExclusiveLock, false);
|
||||
|
||||
/* ... and execute */
|
||||
DefineQueryRewrite(stmt->rulename,
|
||||
relId,
|
||||
whereClause,
|
||||
stmt->event,
|
||||
stmt->instead,
|
||||
stmt->replace,
|
||||
actions);
|
||||
return DefineQueryRewrite(stmt->rulename,
|
||||
relId,
|
||||
whereClause,
|
||||
stmt->event,
|
||||
stmt->instead,
|
||||
stmt->replace,
|
||||
actions);
|
||||
}
|
||||
|
||||
|
||||
@ -225,7 +225,7 @@ DefineRule(RuleStmt *stmt, const char *queryString)
|
||||
* This is essentially the same as DefineRule() except that the rule's
|
||||
* action and qual have already been passed through parse analysis.
|
||||
*/
|
||||
void
|
||||
Oid
|
||||
DefineQueryRewrite(char *rulename,
|
||||
Oid event_relid,
|
||||
Node *event_qual,
|
||||
@ -239,6 +239,7 @@ DefineQueryRewrite(char *rulename,
|
||||
ListCell *l;
|
||||
Query *query;
|
||||
bool RelisBecomingView = false;
|
||||
Oid ruleId = InvalidOid;
|
||||
|
||||
/*
|
||||
* If we are installing an ON SELECT rule, we had better grab
|
||||
@ -489,14 +490,14 @@ DefineQueryRewrite(char *rulename,
|
||||
/* discard rule if it's null action and not INSTEAD; it's a no-op */
|
||||
if (action != NIL || is_instead)
|
||||
{
|
||||
InsertRule(rulename,
|
||||
event_type,
|
||||
event_relid,
|
||||
event_attno,
|
||||
is_instead,
|
||||
event_qual,
|
||||
action,
|
||||
replace);
|
||||
ruleId = InsertRule(rulename,
|
||||
event_type,
|
||||
event_relid,
|
||||
event_attno,
|
||||
is_instead,
|
||||
event_qual,
|
||||
action,
|
||||
replace);
|
||||
|
||||
/*
|
||||
* Set pg_class 'relhasrules' field TRUE for event relation. If
|
||||
@ -527,6 +528,8 @@ DefineQueryRewrite(char *rulename,
|
||||
|
||||
/* Close rel, but keep lock till commit... */
|
||||
heap_close(event_relation, NoLock);
|
||||
|
||||
return ruleId;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user