Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jfgXk-0005zE-Vg for pgsql-general@arkaria.postgresql.org; Mon, 01 Jun 2020 09:15:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jfgXj-0000cn-SZ for pgsql-general@arkaria.postgresql.org; Mon, 01 Jun 2020 09:15:39 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jffOl-0007hd-VA for pgsql-general@lists.postgresql.org; Mon, 01 Jun 2020 08:02:20 +0000 Received: from hosted.mailcow.de ([2a00:f820:417::202]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jffOj-0000sy-Er for pgsql-general@postgresql.org; Mon, 01 Jun 2020 08:02:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beroun.io; s=default; t=1590998532; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=4T1UJgOpmulAaHrguKK28SamwPwm5N6XnXnNQocZEF4=; b=H2M2iPFQ1AUW9fUwqgFr4Brjb3KYqyOTN0QCRqhL/eD3hUULJn8YSxUl1tZMT6gwuPpwKp X8+bs8CMovMaUQkkxsjm+CPO6BgjEFW9Aa65IlTOdrB7cFUAR7fkiZ/Nco+SiOXR0Qipkj OjIq3a8oi2WYItkSkbO5dFVPga2qcwc= Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPA id 812525C0A0B for ; Mon, 1 Jun 2020 10:02:12 +0200 (CEST) From: "Bernhard Beroun" To: pgsql-general@postgresql.org MIME-Version: 1.0 Date: Mon, 01 Jun 2020 10:02:12 +0200 Subject: Vanishing unique constraint Message-ID: <5301-5ed4b600-3-d1dc0d0@127402255> Content-Type: multipart/alternative; boundary="----=_=-_OpenGroupware_org_NGMime-21249-1590998532.374800-0------" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_=-_OpenGroupware_org_NGMime-21249-1590998532.374800-0------ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Length: 1122 Hello, I am experiencing a strange thing on my production database server, whi= ch I can't explain. On my production database server, there is a table called "label=5Fsugg= estion" which has a unique constraint on the "name" column. If I do a "= \d+ label=5Fsuggestion" I can see, that the unique constraint shows up = with "label=5Fsuggestion=5Fname=5Funique" UNIQUE CONSTRAINT, btree (name) in the output. But when I execute the following query SELECT name FROM label=5Fsuggestion 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=5Fdumpall) and = applied the dump on my local machine. I did again a "\d+ label=5Fsugges= tion" 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 r= unning at version 9.6.18) Any help is really appreciated. Thanks, Bernhard ------=_=-_OpenGroupware_org_NGMime-21249-1590998532.374800-0------ Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Length: 1273 Hello,

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

On my production= database server, there is a table called "label=5Fsuggestion" which ha= s a unique constraint on the "name" column. If I do a "\d+ label=5Fsugg= estion" I can see, that the unique constraint shows up with

= "label=5Fsuggestion=5Fname=5Funique" UNIQUE CONSTRAINT, btree (name)
in the output. But when I execute the following query
SELECT name FROM label=5Fsuggestion GROUP BY name HAVING COUNT(name)= > 1

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

= Next, I dumped the complete production database (via pg=5Fdumpall) and = applied the dump on my local machine. I did again a "\d+ label=5Fsugges= tion" and now the unique constraint doesn't show up anymore.

Anyone an idea what's going on here?

(Both the production d= atabase server and my local database server are running at version 9.6.= 18)

Any help is really appreciated.

Thanks,
= Bernhard ------=_=-_OpenGroupware_org_NGMime-21249-1590998532.374800-0--------