Largeobject Access Controls and pg_migrator

Bruce Momjian <bruce@momjian.us>

From: Bruce Momjian <bruce@momjian.us>
To: KaiGai Kohei <kaigai@kaigai.gr.jp>, KaiGai Kohei <kaigai@ak.jp.nec.com>
Cc: Takahiro Itagaki <itagaki.takahiro@oss.ntt.co.jp>, Tom Lane <tgl@sss.pgh.pa.us>, Jaime Casanova <jcasanov@systemguards.com.ec>, Greg Smith <greg@2ndquadrant.com>, pgsql-hackers@postgresql.org
Date: 2009-12-13T01:39:22Z
Lists: pgsql-hackers
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)

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?

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +