PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID15865
PG Version11.4
OSCentOS7
Opened2019-06-20 20:14:29+00
Reported byKeith Fiske
StatusNew

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      15865
Logged by:          Keith Fiske
Email address:      (redacted)
PostgreSQL version: 11.4
Operating system:   CentOS7
Description:        

When testing the setup of our monitoring platform, we started running into
an error when using PostgreSQL as a backend for Grafana. We narrowed down
the issue to only occurring with the latest point release of PG,
specifically 11.4, 10.9 and 9.6.14 (previous major versions were not tested
at this time). The issue can be recreated by following the setup steps for
Grafana with a PG backend and it will occur when the Grafana service is
started for the first time and it tries to set up its schema in PG. We do
not see the error occurring with the previous minor versions (11.3, 10.8,
9.6.13).

A standalone, reproducible use-case is as follows. The final, ALTER TABLE
statement (which is generated by Grafana) will cause the error:

-----------------------------
ERROR:  relation "UQE_user_login" already exists
-----------------------------

However if each ALTER COLUMN statement is run independently, it seems to
work fine.

-----------------------------
CREATE TABLE public."user" (
    id integer NOT NULL,
    version integer NOT NULL,
    login character varying(190) NOT NULL,
    email character varying(190) NOT NULL,
    name character varying(255),
    password character varying(255),
    salt character varying(50),
    rands character varying(50),
    company character varying(255),
    org_id bigint NOT NULL,
    is_admin boolean NOT NULL,
    email_verified boolean,
    theme character varying(255),
    created timestamp without time zone NOT NULL,
    updated timestamp without time zone NOT NULL,
    help_flags1 bigint DEFAULT 0 NOT NULL
);

CREATE SEQUENCE public.user_id_seq1
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER TABLE ONLY public."user" ALTER COLUMN id SET DEFAULT
nextval('public.user_id_seq1'::regclass);

SELECT pg_catalog.setval('public.user_id_seq1', 1, false);

ALTER TABLE ONLY public."user" ADD CONSTRAINT user_pkey1 PRIMARY KEY (id);

CREATE UNIQUE INDEX "UQE_user_email" ON public."user" USING btree (email);

CREATE UNIQUE INDEX "UQE_user_login" ON public."user" USING btree (login);

ALTER TABLE "user" ALTER "login" TYPE VARCHAR(190), ALTER "email" TYPE
VARCHAR(190), ALTER "name" TYPE VARCHAR(255), ALTER "password" TYPE
VARCHAR(255), ALTER "salt" TYPE VARCHAR(50), ALTER "rands" TYPE VARCHAR(50),
ALTER "company" TYPE VARCHAR(255), ALTER "theme" TYPE VARCHAR(255);
-----------------------------

Messages

DateAuthorSubject
2019-06-20 20:14:29+00PG Bug reporting formBUG #15865: ALTER TABLE statements causing "relation already exists" errors when some indexes exist
2019-06-20 20:45:05+00Alvaro HerreraRe: BUG #15865: ALTER TABLE statements causing "relation already exists" errors when some indexes exist
2019-06-20 21:08:29+00Tom LaneRe: BUG #15865: ALTER TABLE statements causing "relation already exists" errors when some indexes exist
2019-06-21 00:20:55+00Tom LaneRe: BUG #15865: ALTER TABLE statements causing "relation already exists" errors when some indexes exist
2019-06-21 00:45:54+00Michael PaquierRe: BUG #15865: ALTER TABLE statements causing "relation already exists" errors when some indexes exist
2019-06-21 01:54:46+00Tom LaneRe: BUG #15865: ALTER TABLE statements causing "relation already exists" errors when some indexes exist
2019-06-21 14:10:27+00Keith FiskeRe: BUG #15865: ALTER TABLE statements causing "relation already exists" errors when some indexes exist
2019-06-21 16:12:00+00Tom LaneRe: BUG #15865: ALTER TABLE statements causing "relation already exists" errors when some indexes exist
2019-06-21 16:47:55+00Tom LaneRe: BUG #15865: ALTER TABLE statements causing "relation already exists" errors when some indexes exist
2019-06-21 17:06:19+00Keith FiskeRe: BUG #15865: ALTER TABLE statements causing "relation already exists" errors when some indexes exist
2019-06-21 17:27:47+00Tom LaneRe: BUG #15865: ALTER TABLE statements causing "relation already exists" errors when some indexes exist
2019-06-24 19:05:30+00Tom LaneRe: BUG #15865: ALTER TABLE statements causing "relation already exists" errors when some indexes exist