Index: contrib/lo/lo_test.sql =================================================================== --- contrib/lo/lo_test.sql (head) +++ contrib/lo/lo_test.sql (work) @@ -12,7 +12,7 @@ -- -- 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 @@ 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 Index: contrib/vacuumlo/vacuumlo.c =================================================================== --- contrib/vacuumlo/vacuumlo.c (head) +++ contrib/vacuumlo/vacuumlo.c (work) @@ -142,7 +142,10 @@ */ 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) {