mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
Use a bitmask to represent role attributes
The previous representation using a boolean column for each attribute would not scale as well as we want to add further attributes. Extra auxilliary functions are added to go along with this change, to make up for the lost convenience of access of the old representation. Catalog version bumped due to change in catalogs and the new functions. Author: Adam Brightwell, minor tweaks by Álvaro Reviewed by: Stephen Frost, Andres Freund, Álvaro Herrera
This commit is contained in:
@ -27,6 +27,7 @@
|
||||
#include "miscadmin.h"
|
||||
#include "replication/walreceiver.h"
|
||||
#include "storage/smgr.h"
|
||||
#include "utils/acl.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/numeric.h"
|
||||
#include "utils/guc.h"
|
||||
@ -54,7 +55,7 @@ pg_start_backup(PG_FUNCTION_ARGS)
|
||||
|
||||
backupidstr = text_to_cstring(backupid);
|
||||
|
||||
if (!superuser() && !has_rolreplication(GetUserId()))
|
||||
if (!have_role_attribute(ROLE_ATTR_REPLICATION))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||
errmsg("must be superuser or replication role to run a backup")));
|
||||
@ -82,7 +83,7 @@ pg_stop_backup(PG_FUNCTION_ARGS)
|
||||
{
|
||||
XLogRecPtr stoppoint;
|
||||
|
||||
if (!superuser() && !has_rolreplication(GetUserId()))
|
||||
if (!have_role_attribute(ROLE_ATTR_REPLICATION))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||
(errmsg("must be superuser or replication role to run a backup"))));
|
||||
|
Reference in New Issue
Block a user