BUG #14844: Failure/Duplicate key value with ALTER DATABASE set search_path

From: buschmann(at)nidsa(dot)net
To: pgsql-bugs(at)postgresql(dot)org
Cc: buschmann(at)nidsa(dot)net
Subject: BUG #14844: Failure/Duplicate key value with ALTER DATABASE set search_path
Date: 2017-10-06 11:04:19
Message-ID: 20171006110419.14642.67184@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14844
Logged by: Hans Buschmann
Email address: buschmann(at)nidsa(dot)net
PostgreSQL version: 10.0
Operating system: Windows x64
Description:

After pg_dump/pg_restore of individual databases from 9.6.5 to 10.0 I have
to set the search path for each database according to the schemas used (the
searchpath is not restored with pg_restore).

This is done with a cmd like

ALTER DATABASE cpsdb SET search_path TO public,part1,part2,part3;

In the application I do not handle the search_path, but need access to all
mentioned schemas.

For one database this alter database cmd succeeded, the application works.

For the second database I also entered the command, but the search_path is
not set in the application.

When trying to change or reset the search path the following error occurs
(PG 10.0):

didisdb=# ALTER DATABASE xxxdb SET search_path TO public,xxxo,xxxp;
ERROR: duplicate key value violates unique constraint
"pg_db_role_setting_databaseid_rol_index"
DETAIL: Key (setdatabase, setrole)=(19084, 0) already exists.

Even resetting the search_path with

alter database xxxb set search_path to "$user", public;
ERROR: duplicate key value violates unique constraint
"pg_db_role_setting_databaseid_rol_index"
DETAIL: Key (setdatabase, setrole)=(19084, 0) already exists.

produces the same error.
I never experienced duplicate key violations in postgres catalog
relations.

PS: setting the search_path with set in the psql session works, but is not
permanent...

What am I missing here?

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message josef.machytka 2017-10-06 11:24:26 BUG #14845: postgres_fdw and mysql_fdw can cause crash of instance
Previous Message David Binderman 2017-10-06 07:21:33 postgresql-10.0/src/bin/psql/mainloop.c:465: suspicious condition ?