1/*-------------------------------------------------------------------------
2 *
3 * rewriteDefine.h
4 *
5 *
6 *
7 * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
9 *
10 * src/include/rewrite/rewriteDefine.h
11 *
12 *-------------------------------------------------------------------------
13 */
14#ifndef REWRITEDEFINE_H
15#define REWRITEDEFINE_H
16
17#include "catalog/objectaddress.h"
18#include "nodes/parsenodes.h"
19#include "utils/relcache.h"
20
21#define RULE_FIRES_ON_ORIGIN 'O'
22#define RULE_FIRES_ALWAYS 'A'
23#define RULE_FIRES_ON_REPLICA 'R'
24#define RULE_DISABLED 'D'
25
26extern ObjectAddress DefineRule(RuleStmt *stmt, const char *queryString);
27
28extern ObjectAddress DefineQueryRewrite(const char *rulename,
29 Oid event_relid,
30 Node *event_qual,
31 CmdType event_type,
32 bool is_instead,
33 bool replace,
34 List *action);
35
36extern ObjectAddress RenameRewriteRule(RangeVar *relation, const char *oldName,
37 const char *newName);
38
39extern void setRuleCheckAsUser(Node *node, Oid userid);
40
41extern void EnableDisableRule(Relation rel, const char *rulename,
42 char fires_when);
43
44#endif /* REWRITEDEFINE_H */
45