Re: [HACKERS] newoid in invapi.c

From: Peter T Mount <psqlhack(at)maidast(dot)demon(dot)co(dot)uk>
To: Maurice Gittens <mgittens(at)gits(dot)nl>
Cc: PostgreSQL-development <hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] newoid in invapi.c
Date: 1998-03-08 19:43:25
Message-ID: Pine.LNX.3.95.980308193035.3881A-100000@maidast
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 6 Mar 1998, Maurice Gittens wrote:

> Hi,
>
> In the file large_object/inv_api.c there is a statement in the function
> inv_create
> which goes:
>
> file_oid=newoid() + 1;
>
> later on a heap_create_with_catalog call is performed to create a heap
> for the large object called xinv<file_oid>.
>
> According to code (and the comments in the code) the assumption is that the
> oid
> of the heap_relation will be equal to the value of the variable file_oid.
>
> This of course will only be the case if nobody else called newoid()
> before the heap relation is created.
>
> This might lead the large object implementation to confuse
> large object relations with other relations.
>
> According to me this is a bug. I'm I right?

Yes, and no. LargeObjects are supposed to run within a transaction (if you
don't then some fun things happen), and (someone correct me if I'm wrong)
if newoid() is called from within the transaction, it is safe?

--
Peter T Mount petermount(at)earthling(dot)net or pmount(at)maidast(dot)demon(dot)co(dot)uk
Main Homepage: http://www.demon.co.uk/finder
Work Homepage: http://www.maidstone.gov.uk Work EMail: peter(at)maidstone(dot)gov(dot)uk

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-03-08 19:48:31 Re: [DOCS] Re: pgsql-docs-digest V1 #312
Previous Message Hannu Krosing 1998-03-08 19:05:27 Re: pgsql-docs-digest V1 #312