Re: [HACKERS] a modest improvement to get_object_address()

2011-11-09 Thread Robert Haas
On Wed, Nov 9, 2011 at 3:40 PM, Dimitri Fontaine wrote: > Back to the problem you raised, it's DDL and we're sitting in between > SnapshotNow and catalog cache entries.  Not so comfy.  I would guess > that the problem (I confess didn't read carefully enough) happens after > having done a cache loo

Re: [HACKERS] a modest improvement to get_object_address()

2011-11-09 Thread Dimitri Fontaine
Robert Haas writes: > e.g. Suppose that you have a table with a unique index on column a. > Transaction A deletes the tuple where a = 1. Transaction B attempts to That's DML, I agree with you there, no need. In DML we have MVCC. Back to the problem you raised, it's DDL and we're sitting in betw

Re: [HACKERS] a modest improvement to get_object_address()

2011-11-09 Thread Robert Haas
On Wed, Nov 9, 2011 at 10:50 AM, Cédric Villemain wrote: > 2011/11/9 Robert Haas : >> On Wed, Nov 9, 2011 at 8:37 AM, Cédric Villemain >> wrote: >>> Maybe I miss something but: > > I read that the error was produced by first session and didn't check > carefuly (it fails silently in 9.0! and 'work

Re: [HACKERS] a modest improvement to get_object_address()

2011-11-09 Thread Robert Haas
On Wed, Nov 9, 2011 at 10:33 AM, Tom Lane wrote: > Robert Haas writes: >> On Wed, Nov 9, 2011 at 9:54 AM, Tom Lane wrote: >>> I would think you need to drop the now-useless lock, and I sure hope >>> that RangeVarGetRelid does likewise. > >> It doesn't currently.  The now-useless lock doesn't rea

Re: [HACKERS] a modest improvement to get_object_address()

2011-11-09 Thread Cédric Villemain
2011/11/9 Robert Haas : > On Wed, Nov 9, 2011 at 8:37 AM, Cédric Villemain > wrote: >> Maybe I miss something but: I read that the error was produced by first session and didn't check carefuly (it fails silently in 9.0! and 'works' as expected in 9.1) No objection, but I would like to still be a

Re: [HACKERS] a modest improvement to get_object_address()

2011-11-09 Thread Tom Lane
Robert Haas writes: > On Wed, Nov 9, 2011 at 9:54 AM, Tom Lane wrote: >> I would think you need to drop the now-useless lock, and I sure hope >> that RangeVarGetRelid does likewise. > It doesn't currently. The now-useless lock doesn't really hurt > anything, aside from taking up space in the lo

Re: [HACKERS] a modest improvement to get_object_address()

2011-11-09 Thread Robert Haas
On Wed, Nov 9, 2011 at 9:54 AM, Tom Lane wrote: > Robert Haas writes: >> I'd like to propose the attached patch, which changes >> get_object_address() in a manner similar to what we did in >> RangeVarGetRelid() in commit 4240e429d0c2d889d0cda23c618f94e12c13ade7. > > I would think you need to drop

Re: [HACKERS] a modest improvement to get_object_address()

2011-11-09 Thread Tom Lane
Robert Haas writes: > I'd like to propose the attached patch, which changes > get_object_address() in a manner similar to what we did in > RangeVarGetRelid() in commit 4240e429d0c2d889d0cda23c618f94e12c13ade7. I would think you need to drop the now-useless lock, and I sure hope that RangeVarGetRe

Re: [HACKERS] a modest improvement to get_object_address()

2011-11-09 Thread Robert Haas
On Wed, Nov 9, 2011 at 8:37 AM, Cédric Villemain wrote: > Maybe I miss something but: > The ERROR message is misleading:  the schema 'x' does exist. No, it doesn't. The concurrent transaction has dropped it. > And also > why a drop schema would fail and a drop+create would success ?! Because y

Re: [HACKERS] a modest improvement to get_object_address()

2011-11-09 Thread Cédric Villemain
2011/11/9 Robert Haas : > I'd like to propose the attached patch, which changes > get_object_address() in a manner similar to what we did in > RangeVarGetRelid() in commit 4240e429d0c2d889d0cda23c618f94e12c13ade7. >  The basic idea is that, if we look up an object name, acquire the > corresponding

[HACKERS] a modest improvement to get_object_address()

2011-11-09 Thread Robert Haas
I'd like to propose the attached patch, which changes get_object_address() in a manner similar to what we did in RangeVarGetRelid() in commit 4240e429d0c2d889d0cda23c618f94e12c13ade7. The basic idea is that, if we look up an object name, acquire the corresponding lock, and then find that the objec