pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #17173: Primary Key ignored resulting in duplicate values
2+ messages / 2 participants
[nested] [flat]

* BUG #17173: Primary Key ignored resulting in duplicate values
@ 2021-09-01 09:21 PG Bug reporting form <noreply@postgresql.org>
  2021-09-01 13:33 ` Re: BUG #17173: Primary Key ignored resulting in duplicate values David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2021-09-01 09:21 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: kdhanjee@gmail.com

The following bug has been logged on the website:

Bug reference:      17173
Logged by:          Ketan Dhanjee
Email address:      kdhanjee@gmail.com
PostgreSQL version: 11.9
Operating system:   CentOS Linux 7
Description:        

Dear Sir/Madam,

We have found issues on our database tables with duplicate values for tables
defined with primary keys.

Below please find output from one of our tables with duplicate values on the
primary key:

Table DDL:

CREATE TABLE component.priceupdate
(
    id bigint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1
MINVALUE 1 MAXVALUE 9223372036854775807 CACHE 1 ),
    reference character varying(50) COLLATE pg_catalog."default",
    effectivedate timestamp(6) without time zone,
    "timestamp" timestamp(6) without time zone,
    priceupdatestatus character varying(50) COLLATE pg_catalog."default",
    modifieddate timestamp(6) without time zone,
    CONSTRAINT priceupdate_pkey PRIMARY KEY (id)
        USING INDEX TABLESPACE pgwlicsdb
)
WITH (
    OIDS = FALSE
)
TABLESPACE pgwlicsdb;

--------------------------------------------
Select output:

select * from component.priceupdate where id=3001279;

id                 |     reference           |       effectivedate          
        |  timestamp                           |    priceupdatestatus      
| modifieddate
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3001279        1250812673793      2021-03-18  00:00:00               
2021-04-06  13:19:14.997     Failed                            2021-05-23 
12:16:49.503
3001279        1250812673793      2021-03-18  00:00:00               
2021-04-06  13:19:14.997     Failed                            2021-05-23 
12:45:09.206

We have other tables that also have duplicates for primary key.

Could you please provide feedback with regards to my query.

Thanks
Ketan



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #17173: Primary Key ignored resulting in duplicate values
  2021-09-01 09:21 BUG #17173: Primary Key ignored resulting in duplicate values PG Bug reporting form <noreply@postgresql.org>
@ 2021-09-01 13:33 ` David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: David G. Johnston @ 2021-09-01 13:33 UTC (permalink / raw)
  To: kdhanjee@gmail.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>

On Wed, Sep 1, 2021 at 4:44 AM PG Bug reporting form <noreply@postgresql.org>
wrote:

>     CONSTRAINT priceupdate_pkey PRIMARY KEY (id)
>         USING INDEX TABLESPACE pgwlicsdb
>
> We have other tables that also have duplicates for primary key.
>
> Could you please provide feedback with regards to my query.
>
>
Remove the duplicates and then reindex the backing unique index.

If the duplicates are being created while running a supported version of
PostgreSQL, and they are all using the same tablespace, consider that it is
good odds whatever filesystem your tablespace is on may have issues.  As
you don't seem to be using a supported version you should probably fix that
deficiency first though, and see whether new problematic records get
created in the future.

David J.

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2021-09-01 13:33 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-09-01 09:21 BUG #17173: Primary Key ignored resulting in duplicate values PG Bug reporting form <noreply@postgresql.org>
2021-09-01 13:33 ` David G. Johnston <david.g.johnston@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox