pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedPKEY getting corrupted
4+ messages / 4 participants
[nested] [flat]
* PKEY getting corrupted
@ 2020-09-10 10:43 Abraham, Danny <danny_abraham@bmc.com>
0 siblings, 3 replies; 4+ messages in thread
From: Abraham, Danny @ 2020-09-10 10:43 UTC (permalink / raw)
To: pgsql-general; +Cc: Abraham, Danny <danny_abraham@bmc.com>
Hi,
We have seen several times a situation where a PKEY is compromised and duplicate values are created within a table.
This has happened so far on PG 928 on Linux and Windows, and also on PG955 on AIX.
We ran massive test on PG10.4 but it has not recreated the problem.
Has anyone faced the same issue? Any known bug?
Thanks
Danny
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: PKEY getting corrupted
@ 2020-09-10 13:05 Philip Semanchuk <philip@americanefficient.com>
parent: Abraham, Danny <danny_abraham@bmc.com>
2 siblings, 0 replies; 4+ messages in thread
From: Philip Semanchuk @ 2020-09-10 13:05 UTC (permalink / raw)
To: Abraham, Danny <danny_abraham@bmc.com>; +Cc: pgsql-general
> On Sep 10, 2020, at 6:43 AM, Abraham, Danny <danny_abraham@bmc.com> wrote:
>
> Hi,
>
> We have seen several times a situation where a PKEY is compromised and duplicate values are created within a table.
>
> This has happened so far on PG 928 on Linux and Windows, and also on PG955 on AIX.
>
> We ran massive test on PG10.4 but it has not recreated the problem.
>
> Has anyone faced the same issue? Any known bug?
In my experience, this is usually due to an application writing PK values rather than allowing a Postgres sequence to generate them, or due to the application misusing sequences. Postgres sequences are monotonically increasing, so even if you insert sequence values “out of order”, they won’t overlap. That’s not to say a bug in Postgres is impossible, but every time I’ve seen this problem, it’s been my application, not Postgres.
Postgres 10 added new syntax for PK columns "GENERATED ALWAYS AS IDENTITY” (https://www.postgresql.org/docs/10/sql-createtable.html). Postgres will raise an exception if an application tries to insert a specific value into a column defined this way. When we upgraded from 9.6 to 11 we converted all of our PK columns to use this syntax which added a nice safety net for us.
You’re probably already aware that 9.5.23 is the oldest supported version in the 9.x series, so the sooner you can upgrade those unsupported 9.x versions the better. Maybe you’re in the middle of an upgrade already which is why this came up. :-)
Cheers
Philip
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: PKEY getting corrupted
@ 2020-09-10 13:28 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Abraham, Danny <danny_abraham@bmc.com>
2 siblings, 0 replies; 4+ messages in thread
From: Adrian Klaver @ 2020-09-10 13:28 UTC (permalink / raw)
To: Abraham, Danny <danny_abraham@bmc.com>; pgsql-general
On 9/10/20 3:43 AM, Abraham, Danny wrote:
> Hi,
>
> We have seen several times a situation where a PKEY is compromised and duplicate values are created within a table.
Table definition?
The situation is?
Postgres log entries from the error?
> This has happened so far on PG 928 on Linux and Windows, and also on PG955 on AIX.
>
> We ran massive test on PG10.4 but it has not recreated the problem.
The test would be?
>
> Has anyone faced the same issue? Any known bug?
>
> Thanks
>
> Danny
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: PKEY getting corrupted
@ 2020-09-10 13:34 Alvaro Herrera <alvherre@2ndquadrant.com>
parent: Abraham, Danny <danny_abraham@bmc.com>
2 siblings, 0 replies; 4+ messages in thread
From: Alvaro Herrera @ 2020-09-10 13:34 UTC (permalink / raw)
To: Abraham, Danny <danny_abraham@bmc.com>; +Cc: pgsql-general
Danny,
On 2020-Sep-10, Abraham, Danny wrote:
> We have seen several times a situation where a PKEY is compromised and
> duplicate values are created within a table.
Yeah, this is not unheard of.
> This has happened so far on PG 928 on Linux and Windows, and also on
> PG955 on AIX.
You do realize that 9.2.8 is not only missing the many bugfixes that
happened until 9.2.24 was released in November 2017, but also any
bugfixes that were done after that branch was abandoned?
9.5.5 sounds more interesting as a target, but it's still missing all
updates until 9.5.23 released last month.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2020-09-10 13:34 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-09-10 10:43 PKEY getting corrupted Abraham, Danny <danny_abraham@bmc.com>
2020-09-10 13:05 ` Philip Semanchuk <philip@americanefficient.com>
2020-09-10 13:28 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-09-10 13:34 ` Alvaro Herrera <alvherre@2ndquadrant.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