Skip site navigation (1) Skip section navigation (2)

Re: Largeobject Access Controls (r2460)

From: KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>
To: Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Largeobject Access Controls (r2460)
Date: 2009-12-11 07:46:22
Message-ID: 4B21F8CE.108@ak.jp.nec.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Takahiro Itagaki wrote:
> KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com> wrote:
> 
>> The attached patch fixes these matters.
> 
> I'll start to check it.

Thanks,

>>   We have to reference pg_largeobject_metadata to check whether a certain
>>   large objct exists, or not.
> 
> What is the situation where there is a row in pg_largeobject_metadata
> and no corresponding rows in pg_largeobject? Do we have a method to
> delete all rows in pg_largeobject but leave some metadata?

It is a case when we create a new large object, but write nothing.

  postgres=# SELECT lo_create(1234);
   lo_create
  -----------
        1234
  (1 row)

  postgres=# SELECT * FROM pg_largeobject_metadata WHERE oid = 1234;
   lomowner | lomacl
  ----------+--------
         10 |
  (1 row)

  postgres=# SELECT * FROM pg_largeobject WHERE loid = 1234;
   loid | pageno | data
  ------+--------+------
  (0 rows)

In this case, the following two queries are not equivalent.
 * SELECT oid FROM pg_largeobject_metadata
 * SELECT DISTINCT loid FROM pg_largeobject

The second query does not return the loid of empty large objects.

The prior implementation inserted a zero-length page to show here is
a large object with this loid, but it got unnecessary with this
enhancement.
If we need compatibility in this level, we can insert a zero-length
page into pg_largeobject on LargeObjectCreate().
It is harmless, but its worth is uncertain.

Thanks,
-- 
OSS Platform Development Division, NEC
KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>

In response to

Responses

pgsql-hackers by date

Next:From: Fujii MasaoDate: 2009-12-11 08:01:15
Subject: Re: Streaming replication, some small issues
Previous:From: Takahiro ItagakiDate: 2009-12-11 07:35:22
Subject: Re: Largeobject Access Controls (r2460)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group