Corrections: etc/nsd/zone.d/* - Champ SPF déprécié
[lhc/ateliers.git] / local / postgresql-role-create
1 #!/bin/sh -eux
2 role="$1"; shift
3 sudo -u postgres psql "$@" -a -f - --set ON_ERROR_STOP=1 <<-EOF
4 \set ON_ERROR_STOP on
5 DO LANGUAGE plpgsql \$\$
6 BEGIN
7 IF NOT EXISTS (
8 SELECT *
9 FROM pg_catalog.pg_roles
10 WHERE rolname = '$role'
11 LIMIT 1
12 ) THEN
13 CREATE ROLE $role
14 NOLOGIN
15 NOCREATEDB
16 NOCREATEROLE
17 NOINHERIT
18 NOSUPERUSER;
19 END IF;
20 END;
21 \$\$;
22 EOF