diff options
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/commands/tablecmds.h | 3 | ||||
| -rw-r--r-- | src/include/utils/usercontext.h | 26 |
2 files changed, 28 insertions, 1 deletions
diff --git a/src/include/commands/tablecmds.h b/src/include/commands/tablecmds.h index e7c2b91a58..17b9404937 100644 --- a/src/include/commands/tablecmds.h +++ b/src/include/commands/tablecmds.h @@ -60,7 +60,8 @@ extern void ExecuteTruncateGuts(List *explicit_rels, List *relids, List *relids_logged, DropBehavior behavior, - bool restart_seqs); + bool restart_seqs, + bool run_as_table_owner); extern void SetRelationHasSubclass(Oid relationId, bool relhassubclass); diff --git a/src/include/utils/usercontext.h b/src/include/utils/usercontext.h new file mode 100644 index 0000000000..a8195c194d --- /dev/null +++ b/src/include/utils/usercontext.h @@ -0,0 +1,26 @@ +/*------------------------------------------------------------------------- + * + * usercontext.h + * Convenience functions for running code as a different database user. + * + *------------------------------------------------------------------------- + */ +#ifndef USERCONTEXT_H +#define USERCONTEXT_H + +/* + * When temporarily changing to run as a different user, this structure + * holds the details needed to restore the original state. + */ +typedef struct UserContext +{ + Oid save_userid; + int save_sec_context; + int save_nestlevel; +} UserContext; + +/* Function prototypes. */ +extern void SwitchToUntrustedUser(Oid userid, UserContext *context); +extern void RestoreUserContext(UserContext *context); + +#endif /* USERCONTEXT_H */ |
