Bug with concurrent CREATE OR REPLACE (?) - Mailing list pgsql-hackers

From Daniil Davydov
Subject Bug with concurrent CREATE OR REPLACE (?)
Date
Msg-id CAJDiXghv2JF5zbLyyybokWKM+-GYsTG+hw7xseLNgJOJwf0+8w@mail.gmail.com
Whole thread Raw
Responses Re: Bug with concurrent CREATE OR REPLACE (?)
List pgsql-hackers
Hi,
I found that this command sequence leads to an error. :

session 1:
begin;
create or replace function *some funcion*;

session 2:
begin;
create or replace function *same function as above*;

session 1:
commit;

session 2:
ERROR:  duplicate key value violates unique constraint
"pg_proc_proname_args_nsp_index"

Error causes, because both transactions check catcache, decide that
function doesn't exist and then try to insert appropriate tuples into
pg_proc and its index (which has a unique constraint).
I found thread [1] in which Robert Haas said that this behaviour is
wrong, but nobody has enough time to fix it.

My question is, can we consider this behavior to be a mistake or a
normal occurrence?

[1] https://www.postgresql.org/message-id/flat/4B9EA2FD.8090902%40agliodbs.com

--
Best regards,
Daniil Davydov



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: No error checking when reading from file using zstd in pg_dump
Next
From: Jim Jones
Date:
Subject: Re: Bug with concurrent CREATE OR REPLACE (?)