create-db.sql: Handle exception if zulip user already exists.

Fixes #13530.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2020-01-15 19:02:01 -05:00 committed by Tim Abbott
parent 3cc6ff5480
commit 298d45b46a
1 changed files with 5 additions and 1 deletions

View File

@ -1,4 +1,8 @@
CREATE USER zulip; DO $$BEGIN
CREATE USER zulip;
EXCEPTION WHEN duplicate_object THEN
RAISE NOTICE 'zulip user already exists';
END$$;
ALTER ROLE zulip SET search_path TO zulip,public; ALTER ROLE zulip SET search_path TO zulip,public;
CREATE DATABASE zulip OWNER=zulip; CREATE DATABASE zulip OWNER=zulip;
\connect zulip \connect zulip