Re: duplicate key value violates unique constraint "pg_class_relname_nsp_index"

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Melvin Davidson <melvin6925(at)gmail(dot)com>, Mitu Verma <mitu(dot)verma(at)ericsson(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: duplicate key value violates unique constraint "pg_class_relname_nsp_index"
Date: 2015-05-27 13:32:37
Message-ID: 5565C775.3070609@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 05/27/2015 06:05 AM, Melvin Davidson wrote:
> What this indicates is that someone, or some thing, is trying to create
> a table in a schema that already exists.

The error you see in that situation is:

postgres-2015-05-27 06:25:10.173 PDT-0ERROR: relation "table1" already
exists
postgres-2015-05-27 06:25:10.173 PDT-0STATEMENT: create table table1 (i
int);

Best guess is as Pete and Albe said, some user code is directly
accessing pg_class or the index has been corrupted.

> Here is the structure of pg_class_relname_nsp_index:
> CREATE UNIQUE INDEX pg_class_relname_nsp_index ON pg_class USING btree
> (relname, relnamespace)
>
> What you should also see in the error log is a line immediately
> following that error which shows you exactly what the conflict is, but
> you have not provided that to us.
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andy Colson 2015-05-27 13:43:12 Re: Reg: BULK COLLECT
Previous Message Melvin Davidson 2015-05-27 13:05:57 Re: duplicate key value violates unique constraint "pg_class_relname_nsp_index"