BUG #15865: ALTER TABLE statements causing "relation already exists" errors when some indexes exist
От | PG Bug reporting form |
---|---|
Тема | BUG #15865: ALTER TABLE statements causing "relation already exists" errors when some indexes exist |
Дата | |
Msg-id | 15865-17940eacc8f8b081@postgresql.org обсуждение исходный текст |
Ответы |
Re: BUG #15865: ALTER TABLE statements causing "relation alreadyexists" errors when some indexes exist
|
Список | pgsql-bugs |
The following bug has been logged on the website: Bug reference: 15865 Logged by: Keith Fiske Email address: keith.fiske@crunchydata.com 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); -----------------------------
В списке pgsql-bugs по дате отправления: