pg_dump: schema with OID XXXXX does not exist - was Concurrent CREATE TABLE/DROP SCHEMA leaves inconsistent leftovers

Started by Nikhil Sontakkeabout 14 years ago5 messages
#1Nikhil Sontakke
nikkhils@gmail.com

Hi,

But if it's deemed to be a
problem, I want to see a solution that's actually watertight.)

After Daniel's hunch about pg_dump barfing due to such leftover entries
proving out to be true, we have one credible explanation (there might be
other reasons too) for this long standing issue. I see some reports from as
early as 2004 and some as latest as Feb, 2011!

http://archives.postgresql.org/pgsql-bugs/2011-02/msg00185.php

One way in 9.x could be to modify get_object_address to additionally accept
objoid as an argument and use that to lock the schema in AccessShareLock
mode from all places where schema based objects (tables, views, types,
sequences, functions, indexes, extensions, constraints, operators stuff, ts
stuff, rules, domains, etc. phew!) can be created. Or since this is schema
specific, we can as well right a new function to do this. We might also add
logic to only lock user created schemas.

This can be added right after the namespace for the involved object has
been correctly identified. The lock can then get released later as part of
the transaction commit.

Regards,
Nikhils

#2Daniel Farina
daniel@heroku.com
In reply to: Nikhil Sontakke (#1)
Re: pg_dump: schema with OID XXXXX does not exist - was Concurrent CREATE TABLE/DROP SCHEMA leaves inconsistent leftovers

On Thu, Nov 10, 2011 at 11:57 PM, Nikhil Sontakke <nikkhils@gmail.com> wrote:

Hi,

But if it's deemed to be a
problem, I want to see a solution that's actually watertight.)

After Daniel's hunch about pg_dump barfing due to such leftover entries
proving out to be true, we have one credible explanation (there might be
other reasons too) for this long standing issue. I see some reports from as
early as 2004 and some as latest as Feb, 2011!

The 2004 report was in version 7.3, released in 2002. So it's Very
Nearly a ten year old bug, and may very well go back further back in
time.

--
fdr

#3Alvaro Herrera
alvherre@commandprompt.com
In reply to: Daniel Farina (#2)
Re: Re: pg_dump: schema with OID XXXXX does not exist - was Concurrent CREATE TABLE/DROP SCHEMA leaves inconsistent leftovers

Excerpts from Daniel Farina's message of vie nov 11 16:08:01 -0300 2011:

On Thu, Nov 10, 2011 at 11:57 PM, Nikhil Sontakke <nikkhils@gmail.com> wrote:

Hi,

But if it's deemed to be a
problem, I want to see a solution that's actually watertight.)

After Daniel's hunch about pg_dump barfing due to such leftover entries
proving out to be true, we have one credible explanation (there might be
other reasons too) for this long standing issue. I see some reports from as
early as 2004 and some as latest as Feb, 2011!

The 2004 report was in version 7.3, released in 2002. So it's Very
Nearly a ten year old bug, and may very well go back further back in
time.

Wasn't 7.3 the release that introduced schemas in the first place? I
wonder if there's any other kind of "container" sort of object that
could present a similar problem, in releases prior to that.

If we delay fixing it for 16 more days, it would last nine years.

--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alvaro Herrera (#3)
Re: Re: pg_dump: schema with OID XXXXX does not exist - was Concurrent CREATE TABLE/DROP SCHEMA leaves inconsistent leftovers

Alvaro Herrera <alvherre@commandprompt.com> writes:

Excerpts from Daniel Farina's message of vie nov 11 16:08:01 -0300 2011:

The 2004 report was in version 7.3, released in 2002. So it's Very
Nearly a ten year old bug, and may very well go back further back in
time.

Wasn't 7.3 the release that introduced schemas in the first place?

I think there's a very good chance that the older reports with similar
symptoms are completely unrelated, anyhow.

regards, tom lane

#5Nikhil Sontakke
nikkhils@gmail.com
In reply to: Tom Lane (#4)
Re: Re: pg_dump: schema with OID XXXXX does not exist - was Concurrent CREATE TABLE/DROP SCHEMA leaves inconsistent leftovers

Wasn't 7.3 the release that introduced schemas in the first place?

I think there's a very good chance that the older reports with similar
symptoms are completely unrelated, anyhow.

Tom Lane is reluctant and that should tell me something :)

So unless the list feels that this should be fixed and also agrees on the
general approach, I will not touch a single line of code. Obviously someone
else is welcome to have a stab at this too.

Regards,
Nikhils