{"id":2409,"date":"2025-03-11T17:03:40","date_gmt":"2025-03-11T10:03:40","guid":{"rendered":"https:\/\/www.pgtutorial.com\/?page_id=2409"},"modified":"2025-03-11T17:05:17","modified_gmt":"2025-03-11T10:05:17","slug":"postgresql-role-membership","status":"publish","type":"page","link":"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-role-membership\/","title":{"rendered":"PostgreSQL Role Membership"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: In this tutorial, you learn about role membership, how to create a user group and manage role membership by adding a user to a group and removing a user from a group.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"creating-a-group\" id='creating-a-group'>Creating a group <a href=\"#creating-a-group\" class=\"anchor\" id=\"creating-a-group\" title=\"Anchor for Creating a group\">#<\/a><\/h2>\n\n\n\n<p>You can use the\u00a0<code><a href=\"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-create-role\/\">CREATE ROLE<\/a><\/code>\u00a0statement to create a user group. In PostgreSQL, a user group is called a group role.<\/p>\n\n\n\n<p>For example, the following&nbsp;<code>CREATE ROLE<\/code>&nbsp;statement creates a new group called&nbsp;<code>admin<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">ROLE<\/span> <span class=\"hljs-keyword\">admin<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Typically, a group does not have&nbsp;<code>LOGIN<\/code>&nbsp;privilege. But you can allow it to log in if necessary.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"adding-users-to-a-group\" id='adding-users-to-a-group'>Adding users to a group <a href=\"#adding-users-to-a-group\" class=\"anchor\" id=\"adding-users-to-a-group\" title=\"Anchor for Adding users to a group\">#<\/a><\/h2>\n\n\n\n<p>The following statements create two users (roles) with the&nbsp;<code>LOGIN<\/code>&nbsp;privilege:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">ROLE<\/span> bob <span class=\"hljs-keyword\">WITH<\/span> <span class=\"hljs-keyword\">LOGIN<\/span> <span class=\"hljs-keyword\">PASSWORD<\/span> <span class=\"hljs-string\">'securepassword'<\/span>;\n<span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">ROLE<\/span> alice <span class=\"hljs-keyword\">WITH<\/span> <span class=\"hljs-keyword\">LOGIN<\/span> <span class=\"hljs-keyword\">PASSWORD<\/span> <span class=\"hljs-string\">'securepassword'<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>You can use the\u00a0<code><a href=\"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-grant\/\">GRANT<\/a><\/code>\u00a0statement to add a user (a role) to a group (group role).<\/p>\n\n\n\n<p>For example, the following&nbsp;<code>GRANT<\/code>&nbsp;statement adds the user&nbsp;<code>bob<\/code>&nbsp;to the&nbsp;<code>admin<\/code>&nbsp;group:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">GRANT<\/span> <span class=\"hljs-keyword\">admin<\/span> <span class=\"hljs-keyword\">TO<\/span> bob;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>A group can have multiple users. For example, the following statement grants the membership of the&nbsp;<code>admin<\/code>&nbsp;to&nbsp;<code>alice<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">GRANT<\/span> <span class=\"hljs-keyword\">admin<\/span> <span class=\"hljs-keyword\">TO<\/span> alice;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The users&nbsp;<code>bob<\/code>&nbsp;and&nbsp;<code>alice<\/code>&nbsp;are now the members of the&nbsp;<code>admin<\/code>&nbsp;group.<\/p>\n\n\n\n<p>A user may belong to multiple groups. The relationship between users and groups is many-to-many.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"inheritance-of-privileges\" id='inheritance-of-privileges'>Inheritance of privileges <a href=\"#inheritance-of-privileges\" class=\"anchor\" id=\"inheritance-of-privileges\" title=\"Anchor for Inheritance of privileges\">#<\/a><\/h2>\n\n\n\n<p>Since&nbsp;<code>bob<\/code>&nbsp;and&nbsp;<code>alice<\/code>&nbsp;are members of the&nbsp;<code>admin<\/code>&nbsp;group, they inherit the privileges granted to the&nbsp;<code>admin<\/code>&nbsp;group by default.<\/p>\n\n\n\n<p>It means that&nbsp;<code>bob<\/code>&nbsp;and&nbsp;<code>alice<\/code>&nbsp;can use privileges granted to the&nbsp;<code>admin<\/code>.<\/p>\n\n\n\n<p>For example, if you grant the&nbsp;<code>SELECT<\/code>&nbsp;privilege on the&nbsp;<code>products<\/code>&nbsp;table to the&nbsp;<code>admin<\/code>&nbsp;as follows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">GRANT<\/span> <span class=\"hljs-keyword\">SELECT<\/span> <span class=\"hljs-keyword\">ON<\/span> <span class=\"hljs-keyword\">TABLE<\/span> products <span class=\"hljs-keyword\">TO<\/span> <span class=\"hljs-keyword\">admin<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Both&nbsp;<code>bob<\/code>&nbsp;and&nbsp;<code>alice<\/code>&nbsp;can select data from the&nbsp;<code>products<\/code>&nbsp;table, even though we do not directly grant the&nbsp;<code>SELECT<\/code>&nbsp;privilege on the&nbsp;<code>products<\/code>&nbsp;table to&nbsp;<code>bob<\/code>&nbsp;and&nbsp;<code>alice<\/code>.<\/p>\n\n\n\n<p>If you log in to the&nbsp;<code>inventory<\/code>&nbsp;database using&nbsp;<code>bob<\/code>&nbsp;or&nbsp;<code>alice<\/code>, you should be able to select data from the&nbsp;<code>products<\/code>&nbsp;table:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">SELECT<\/span> * <span class=\"hljs-keyword\">FROM<\/span> products;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>If you don&#8217;t want&nbsp;<code>bob<\/code>&nbsp;and&nbsp;<code>alice<\/code>&nbsp;to inherit privileges in the&nbsp;<code>admin<\/code>&nbsp;group, you can set the&nbsp;<code>INHERIT<\/code>&nbsp;to&nbsp;<code>FALSE<\/code>. Both users will not inherit privileges from the&nbsp;<code>admin<\/code>&nbsp;group:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">GRANT<\/span> <span class=\"hljs-keyword\">admin<\/span> <span class=\"hljs-keyword\">TO<\/span> alice <span class=\"hljs-keyword\">WITH<\/span> <span class=\"hljs-keyword\">INHERIT<\/span> <span class=\"hljs-keyword\">FALSE<\/span>;\n<span class=\"hljs-keyword\">GRANT<\/span> <span class=\"hljs-keyword\">admin<\/span> <span class=\"hljs-keyword\">TO<\/span> bob <span class=\"hljs-keyword\">WITH<\/span> <span class=\"hljs-keyword\">INHERIT<\/span> <span class=\"hljs-keyword\">FALSE<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"removing-users-from-groups\" id='removing-users-from-groups'>Removing users from groups <a href=\"#removing-users-from-groups\" class=\"anchor\" id=\"removing-users-from-groups\" title=\"Anchor for Removing users from groups\">#<\/a><\/h2>\n\n\n\n<p>To remove a user from a group, you use the&nbsp;<code>REVOKE<\/code>&nbsp;statement:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">REVOKE<\/span> group_role <span class=\"hljs-keyword\">FROM<\/span> role1, role2;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>For example, the following statement removes&nbsp;<code>alice<\/code>&nbsp;and&nbsp;<code>bob<\/code>&nbsp;from the&nbsp;<code>admin<\/code>&nbsp;group:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">REVOKE<\/span> <span class=\"hljs-keyword\">admin<\/span> <span class=\"hljs-keyword\">FROM<\/span> alice, bob;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"summary-1\" id='summary'>Summary <a href=\"#summary\" class=\"anchor\" id=\"summary\" title=\"Anchor for Summary\">#<\/a><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use the&nbsp;<code>CREATE ROLE<\/code>&nbsp;statement to create a group.<\/li>\n\n\n\n<li>Use the&nbsp;<code>GRANT<\/code>&nbsp;statement to add a user to a group.<\/li>\n\n\n\n<li>A user inherits the privileges of the group by default.<\/li>\n\n\n\n<li>Use the&nbsp;<code>REVOKE<\/code>&nbsp;statement to remove a user from a group.<\/li>\n<\/ul>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful ?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"2409\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-role-membership\/\"\n\t\t\t\tdata-post-title=\"PostgreSQL Role Membership\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"2409\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-role-membership\/\"\n\t\t\t\tdata-post-title=\"PostgreSQL Role Membership\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>You learn about PostgreSQL role membership, how to create a user group, add a user to a group, remove a user from a group.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":2269,"menu_order":15,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2409","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>PostgreSQL Role Membership<\/title>\n<meta name=\"description\" content=\"You learn about PostgreSQL role membership, how to create a user group, add a user to a group, remove a user from a group.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-role-membership\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PostgreSQL Role Membership\" \/>\n<meta property=\"og:description\" content=\"You learn about PostgreSQL role membership, how to create a user group, add a user to a group, remove a user from a group.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-role-membership\/\" \/>\n<meta property=\"og:site_name\" content=\"PostgreSQL Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-11T10:05:17+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pgtutorial.com\\\/postgresql-database-administration\\\/postgresql-role-membership\\\/\",\"url\":\"https:\\\/\\\/www.pgtutorial.com\\\/postgresql-database-administration\\\/postgresql-role-membership\\\/\",\"name\":\"PostgreSQL Role Membership\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pgtutorial.com\\\/#website\"},\"datePublished\":\"2025-03-11T10:03:40+00:00\",\"dateModified\":\"2025-03-11T10:05:17+00:00\",\"description\":\"You learn about PostgreSQL role membership, how to create a user group, add a user to a group, remove a user from a group.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pgtutorial.com\\\/postgresql-database-administration\\\/postgresql-role-membership\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pgtutorial.com\\\/postgresql-database-administration\\\/postgresql-role-membership\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pgtutorial.com\\\/postgresql-database-administration\\\/postgresql-role-membership\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pgtutorial.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PostgreSQL Database Administration\",\"item\":\"https:\\\/\\\/www.pgtutorial.com\\\/postgresql-database-administration\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"PostgreSQL Role Membership\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pgtutorial.com\\\/#website\",\"url\":\"https:\\\/\\\/www.pgtutorial.com\\\/\",\"name\":\"PostgreSQL Tutorial\",\"description\":\"Learn PostgreSQL from Scratch\",\"alternateName\":\"PostgreSQL\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pgtutorial.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PostgreSQL Role Membership","description":"You learn about PostgreSQL role membership, how to create a user group, add a user to a group, remove a user from a group.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-role-membership\/","og_locale":"en_US","og_type":"article","og_title":"PostgreSQL Role Membership","og_description":"You learn about PostgreSQL role membership, how to create a user group, add a user to a group, remove a user from a group.","og_url":"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-role-membership\/","og_site_name":"PostgreSQL Tutorial","article_modified_time":"2025-03-11T10:05:17+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-role-membership\/","url":"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-role-membership\/","name":"PostgreSQL Role Membership","isPartOf":{"@id":"https:\/\/www.pgtutorial.com\/#website"},"datePublished":"2025-03-11T10:03:40+00:00","dateModified":"2025-03-11T10:05:17+00:00","description":"You learn about PostgreSQL role membership, how to create a user group, add a user to a group, remove a user from a group.","breadcrumb":{"@id":"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-role-membership\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-role-membership\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/postgresql-role-membership\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pgtutorial.com\/"},{"@type":"ListItem","position":2,"name":"PostgreSQL Database Administration","item":"https:\/\/www.pgtutorial.com\/postgresql-database-administration\/"},{"@type":"ListItem","position":3,"name":"PostgreSQL Role Membership"}]},{"@type":"WebSite","@id":"https:\/\/www.pgtutorial.com\/#website","url":"https:\/\/www.pgtutorial.com\/","name":"PostgreSQL Tutorial","description":"Learn PostgreSQL from Scratch","alternateName":"PostgreSQL","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pgtutorial.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/pages\/2409","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/comments?post=2409"}],"version-history":[{"count":3,"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/pages\/2409\/revisions"}],"predecessor-version":[{"id":2412,"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/pages\/2409\/revisions\/2412"}],"up":[{"embeddable":true,"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/pages\/2269"}],"wp:attachment":[{"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/media?parent=2409"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}