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

Re: Largeobject Access Controls and pg_migrator

From: KaiGai Kohei <kaigai(at)kaigai(dot)gr(dot)jp>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>, Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, Greg Smith <greg(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Largeobject Access Controls and pg_migrator
Date: 2009-12-13 01:55:29
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
(2009/12/13 10:39), Bruce Momjian wrote:
> Bruce Momjian wrote:
>> KaiGai Kohei wrote:
>>>> What happens when
>>>> there is no entry in pg_largeobject_metadata for a specific row?
>>> In this case, these rows become orphan.
>>> So, I think we need to create an empty large object with same LOID on
>>> pg_migrator. It makes an entry on pg_largeobject_metadata without
>>> writing anything to the pg_largeobject.
>>> I guess rest of migrations are not difference. Correct?
>> Agreed.  I have modified pg_migrator with the attached patch which
>> creates a script that adds default permissions for all large object
>> tables.
> Oops, seem like I have a problem in getting pg_migrator to populate
> pg_largeobject_metadata:
> 	test=>  select lo_import('/etc/profile');
> 	 lo_import
> 	-----------
> 	     16385
> 	(1 row)
> 	test=>  select lo_import('/etc/profile.env');
> 	 lo_import
> 	-----------
> 	     16386
> 	(1 row)
> 	test=>  select oid,* from pg_largeobject_metadata;
> 	  oid  | lomowner | lomacl
> 	-------+----------+--------
> 	 16385 |       10 |
> 	 16386 |       10 |
> 	(2 rows)

lo_import() has an another prototype which takes second argument to
specify LOID. Isn't it available to restore a large object with
correct LOID? For example, lo_import('/etc/profile', 1234)

Or, if you intend to restore metadata in the second lo_import(),
ALTER LAEGE OBJECT and GRANT LARGE OBJECT enable to set up metadata
of a certain large object.

Or, am I missing the problem?

> You might remember that INSERT cannot set the oid of a row, so I don't
> see how pg_migrator can migrate this?  Is there a reason we used 'oid'
> in pg_largeobject_metadata but 'lobj' in pg_largeobject?  Why did't we
> add the lomowner and lomacl columns to pg_largeobject?

A large object consists of multiple tuples within pg_largeobject.
If we added lomowner and lomacl into pg_largeobject, we have to manage
all the pages in a large object to keep consistent state.

KaiGai Kohei <kaigai(at)kaigai(dot)gr(dot)jp>

In response to


pgsql-hackers by date

Next:From: Bruce MomjianDate: 2009-12-13 02:15:42
Subject: Re: Largeobject Access Controls and pg_migrator
Previous:From: Bruce MomjianDate: 2009-12-13 01:39:22
Subject: Largeobject Access Controls and pg_migrator

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