We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
postgres
1 parent 956dfd8 commit 0e14390Copy full SHA for 0e14390
ansible/files/postgresql_extension_custom_scripts/postgres_fdw/after-create.sql
@@ -0,0 +1,21 @@
1
+do $$
2
+declare
3
+ is_super boolean;
4
+begin
5
+ is_super = (
6
+ select usesuper
7
+ from pg_user
8
+ where usename = 'postgres'
9
+ );
10
+
11
+ -- Need to be superuser to own FDWs, so we temporarily make postgres superuser.
12
+ if not is_super then
13
+ alter role postgres superuser;
14
+ end if;
15
16
+ alter foreign data wrapper postgres_fdw owner to postgres;
17
18
19
+ alter role postgres nosuperuser;
20
21
+end $$;
0 commit comments