On Fri, Sep 10, 2021 at 7:36 PM Ashish Kumar
<ashish.kumar2@getfareye.com> wrote:
>
> On Fri, Sep 10, 2021 at 3:36 PM PG Bug reporting form <noreply@postgresql.org> wrote:
>>
>> The following bug has been logged on the website:
>>
>> Bug reference: 17188
>> Logged by: DBA TEAM
>> Email address: devops@getfareye.com
>> PostgreSQL version: 9.6.22
>> Operating system: Ubuntu 20.04.2 LTS
>> Description:
>>
>> We are having a table Users in which multiple columns named emp_code and
>> company_id have a unique constraint applied to them.But for multiple rows
>> there are values which are equal for both of the columns.
>>
>> Users table definition
>> Table "public.users"
>> [...]
>> Indexes:
>> "users_pkey" PRIMARY KEY, btree (id)
>> "users_company_id_emp_code_key" UNIQUE CONSTRAINT, btree (company_id,
>> emp_code)
>>
>> Here is the sample data
>> select id,company_id,emp_code from users where
>> emp_code='4742_bpl-14_bpl';
>>
>> id | company_id | emp_code
>> ------+------------+-----------------
>> 5065 | 8 | 4742_bpl-14_bpl
>> 1594 | 8 | 4742_bpl-14_bpl
It looks like an index corruption. Is there any chance you can try
amcheck (it should be available with ppgdg packages, but if needed:
https://github.com/petergeoghegan/amcheck) and verify the
users_company_id_emp_code_key (and possibly the other) index?