aboutsummaryrefslogtreecommitdiff
path: root/src/backend/replication/logical/logicalfuncs.c
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2014-12-23 10:22:09 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2014-12-23 10:22:09 -0300
commit1826987a46d079458007b7b6bbcbbd852353adbb (patch)
treec3598d1d9c006551d2adff2b888112a24f2d03ed /src/backend/replication/logical/logicalfuncs.c
parent7eca575d1c28f6eee2bf4564f3d458d10c4a8f47 (diff)
downloadpostgresql-1826987a46d079458007b7b6bbcbbd852353adbb.tar.gz
postgresql-1826987a46d079458007b7b6bbcbbd852353adbb.zip
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
Diffstat (limited to 'src/backend/replication/logical/logicalfuncs.c')
-rw-r--r--src/backend/replication/logical/logicalfuncs.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/backend/replication/logical/logicalfuncs.c b/src/backend/replication/logical/logicalfuncs.c
index 1977f098c79..1a38f56a7cc 100644
--- a/src/backend/replication/logical/logicalfuncs.c
+++ b/src/backend/replication/logical/logicalfuncs.c
@@ -17,18 +17,14 @@
#include <unistd.h>
+#include "access/xlog_internal.h"
+#include "catalog/pg_type.h"
#include "fmgr.h"
#include "funcapi.h"
+#include "mb/pg_wchar.h"
#include "miscadmin.h"
-
-#include "access/xlog_internal.h"
-
-#include "catalog/pg_type.h"
-
#include "nodes/makefuncs.h"
-
-#include "mb/pg_wchar.h"
-
+#include "utils/acl.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/inval.h"
@@ -36,11 +32,9 @@
#include "utils/pg_lsn.h"
#include "utils/resowner.h"
#include "utils/lsyscache.h"
-
#include "replication/decode.h"
#include "replication/logical.h"
#include "replication/logicalfuncs.h"
-
#include "storage/fd.h"
/* private date for writing out data */
@@ -205,7 +199,7 @@ XLogRead(char *buf, TimeLineID tli, XLogRecPtr startptr, Size count)
static void
check_permissions(void)
{
- 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 use replication slots"))));