You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/postgresql/migrate/migration-service/concepts-user-roles-migration-service.md
+58-19Lines changed: 58 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,28 +54,67 @@ We removed all privileges for non-superusers on the following pg_catalog views.
54
54
55
55
Allowing unrestricted access to these system tables and views could lead to unauthorized modifications, accidental deletions, or even security breaches. By restricting access, we're reducing the risk of unintended changes or data exposure.
56
56
57
+
### pg_pltemplate deprecation
58
+
59
+
Another important consideration is the deprecation of the **pg_pltemplate** system table within the pg_catalog schema by the PostgreSQL community **starting from version 13.** Therefore, if you're migrating to Flexible Server versions 13 and above, and if you have granted permissions to users on the pg_pltemplate table, it is necessary to undo these permissions before initiating the migration process.
60
+
57
61
#### What is the impact?
58
62
- If your application is designed to directly query the affected tables and views, it will encounter issues upon migrating to the flexible server. We strongly advise you to refactor your application to avoid direct queries to these system tables.
59
63
60
-
- If you have granted privileges to any users or roles for the affected pg_catalog tables and views, you encounter an error during the migration process. This error will be identified by the following pattern: **"pg_restore error: could not execute query GRANT/REVOKE PRIVILEGES on TABLENAME to username."**
61
-
To resolve this error, it's necessary to revoke the select privileges granted to various users and roles on the pg_catalog tables and views. You can accomplish this by taking the following steps.
62
-
1. Take a pg_dump of the database containing only the schema by executing the following command from a machine with access to your single server.
2. Search for **GRANT** statements associated with the impacted tables and views in the dump file. These GRANT statements follow this format.
67
-
```sql
68
-
GRANT <privileges> to pg_catalog.<impacted tablename/viewname> to <username>;
69
-
```
70
-
3. If any such statements exist, ensure to execute the following command on your single server for each GRANT statement.
71
-
```sql
72
-
REVOKE <privileges> ON pg_catalog.<impacted tablename/viewname> from <username>;
73
-
```
74
-
75
-
##### Understanding pg_pltemplate deprecation
76
-
Another important consideration is the deprecation of the **pg_pltemplate** system table within the pg_catalog schema by the PostgreSQL community **starting from version 13.** Therefore, if you're migrating to Flexible Server versions 13 and above, and if you have granted permissions to users on the pg_pltemplate table, it is necessary to revoke these permissions before initiating the migration process. You can follow the same steps outlined above and conduct a search for **pg_pltemplate** in Step 2. Failure to do so leads to a failed migration.
77
-
78
-
After completing these steps, you can proceed to initiate a new migration from the single server to the flexible server using the migration tool. You're expected not to encounter permission-related issues during this process.
64
+
- If you have specifically granted or revoked privileges to any users or roles for the affected pg_catalog tables and views, you will encounter an error during the migration process. This error will be identified by the following pattern:
65
+
66
+
```sql
67
+
pg_restore error: could not execute query <GRANT/REVOKE><PRIVILEGES>on<affected TABLE/VIEWS> to <user>.
68
+
```
69
+
70
+
To resolve this error, it's necessary to undo the privileges granted to users and roles on the affected pg_catalog tables and views. You can accomplish this by taking the following steps.
71
+
72
+
**Step 1: Identify Privileges**
73
+
74
+
Execute the following query on your single server by logging in as the admin user:
75
+
76
+
```sql
77
+
SELECT
78
+
array_to_string(array_agg(acl.privilege_type), ', ') AS privileges,
The output of the above query will show the list of privileges granted to roles on the impacted tables and views.
99
+
100
+
For example:
101
+
102
+
| Privileges | Relation name | Grantee |
103
+
| :--- | :--- | :--- |
104
+
| SELECT | pg_authid | adminuser1
105
+
| SELECT, UPDATE | pg_shadow | adminuser2
106
+
107
+
**Step 3: Undo the privileges**
108
+
109
+
To undo the privileges, run REVOKE statements for each privilege on the relation from the grantee. In the above example, you would run:
110
+
111
+
```sql
112
+
REVOKESELECTON pg_authid FROM adminuser1;
113
+
REVOKESELECTON pg_shadow FROM adminuser2;
114
+
REVOKEUPDATEON pg_shadow FROM adminuser2;
115
+
```
116
+
117
+
After completing these steps, you can proceed to initiate a new migration from the single server to the flexible server using the migration service. You should not encounter permission-related issues during this process.
0 commit comments