Vanishing unique constraint - Mailing list pgsql-general

From Bernhard Beroun
Subject Vanishing unique constraint
Date
Msg-id 5301-5ed4b600-3-d1dc0d0@127402255
Whole thread Raw
Responses Re: Vanishing unique constraint
List pgsql-general
Hello,

I am experiencing a strange thing on my production database server, which I can't explain.

On my production database server, there is a table called "label_suggestion" which has a unique constraint on the "name" column. If I do a "\d+ label_suggestion" I can see, that the unique constraint shows up with

"label_suggestion_name_unique" UNIQUE CONSTRAINT, btree (name)

in the output. But when I execute the following query

SELECT name FROM label_suggestion GROUP BY name HAVING COUNT(name) > 1

I can see that there are actually entries with a duplicate name in the database, which makes me believe that the unique constraint isn't there at all. (or at least it's not enforced)

Next, I dumped the complete production database (via pg_dumpall) and applied the dump on my local machine. I did again a "\d+ label_suggestion" and now the unique constraint doesn't show up anymore.

Anyone an idea what's going on here?

(Both the production database server and my local database server are running at version 9.6.18)

Any help is really appreciated.

Thanks,
Bernhard

pgsql-general by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: Oracle vs. PostgreSQL - a comment
Next
From: Gabriele Bulfon
Date:
Subject: Re: problem with self built postgres 9.0.9