1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-25 01:02:05 +03:00

Additional fixes for large object access control.

Use pg_largeobject_metadata.oid instead of pg_largeobject.loid
to enumerate existing large objects in pg_dump, pg_restore, and
contrib modules.
This commit is contained in:
Itagaki Takahiro
2009-12-14 00:39:11 +00:00
parent 0182d6f646
commit 84f910a707
9 changed files with 56 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/contrib/lo/lo_test.sql,v 1.5 2007/11/13 04:24:28 momjian Exp $ */
/* $PostgreSQL: pgsql/contrib/lo/lo_test.sql,v 1.6 2009/12/14 00:39:10 itagaki Exp $ */
-- Adjust this setting to control where the objects get created.
SET search_path = public;
@ -12,7 +12,7 @@ SET search_path = public;
--
-- Check what is in pg_largeobject
SELECT count(DISTINCT loid) FROM pg_largeobject;
SELECT count(oid) FROM pg_largeobject_metadata;
-- ignore any errors here - simply drop the table if it already exists
DROP TABLE a;
@ -74,6 +74,6 @@ DELETE FROM a;
DROP TABLE a;
-- Check what is in pg_largeobject ... if different from original, trouble
SELECT count(DISTINCT loid) FROM pg_largeobject;
SELECT count(oid) FROM pg_largeobject_metadata;
-- end of tests

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/contrib/vacuumlo/vacuumlo.c,v 1.42 2009/07/13 22:56:30 momjian Exp $
* $PostgreSQL: pgsql/contrib/vacuumlo/vacuumlo.c,v 1.43 2009/12/14 00:39:10 itagaki Exp $
*
*-------------------------------------------------------------------------
*/
@ -142,7 +142,10 @@ vacuumlo(char *database, struct _param * param)
*/
buf[0] = '\0';
strcat(buf, "CREATE TEMP TABLE vacuum_l AS ");
strcat(buf, "SELECT DISTINCT loid AS lo FROM pg_largeobject ");
if (PQserverVersion(conn) >= 80500)
strcat(buf, "SELECT oid AS lo FROM pg_largeobject_metadata");
else
strcat(buf, "SELECT DISTINCT loid AS lo FROM pg_largeobject");
res = PQexec(conn, buf);
if (PQresultStatus(res) != PGRES_COMMAND_OK)
{