END;
+-- Copy to another large object.
+-- Note: we intentionally don't remove the object created here;
+-- it's left behind to help test pg_dump.
+
+SELECT lo_from_bytea(0, lo_get(loid)) AS newloid FROM lotest_stash_values
+\gset
+
+-- Ideally we'd put a comment on this object for pg_dump testing purposes.
+-- But since pg_upgrade fails to preserve large object comments, doing so
+-- would break pg_upgrade's regression test.
+-- COMMENT ON LARGE OBJECT :newloid IS 'I Wandered Lonely as a Cloud';
+
-- Read out a portion
BEGIN;
UPDATE lotest_stash_values SET fd=lo_open(loid, CAST(x'20000' | x'40000' AS integer));
EXCEPT
SELECT pageno, data FROM pg_largeobject WHERE loid = :newloid;
-
SELECT lo_unlink(loid) FROM lotest_stash_values;
+
+TRUNCATE lotest_stash_values;
+
\lo_unlink :newloid
\lo_import 'results/lotest.txt'
\lo_unlink :newloid_1
\lo_unlink :newloid_2
-TRUNCATE lotest_stash_values;
+-- This object is left in the database for pg_dump test purposes
+SELECT lo_from_bytea(0, E'\\xdeadbeef') AS newloid
+\gset
+
+SET bytea_output TO hex;
+SELECT lo_get(:newloid);
+
+DROP TABLE lotest_stash_values;
+
DROP ROLE regresslo;
(1 row)
END;
+-- Copy to another large object.
+-- Note: we intentionally don't remove the object created here;
+-- it's left behind to help test pg_dump.
+SELECT lo_from_bytea(0, lo_get(loid)) AS newloid FROM lotest_stash_values
+\gset
+-- Ideally we'd put a comment on this object for pg_dump testing purposes.
+-- But since pg_upgrade fails to preserve large object comments, doing so
+-- would break pg_upgrade's regression test.
+-- COMMENT ON LARGE OBJECT :newloid IS 'I Wandered Lonely as a Cloud';
-- Read out a portion
BEGIN;
UPDATE lotest_stash_values SET fd=lo_open(loid, CAST(x'20000' | x'40000' AS integer));
1
(1 row)
+TRUNCATE lotest_stash_values;
\lo_unlink :newloid
\lo_import 'results/lotest.txt'
\set newloid_1 :LASTOID
\lo_unlink :newloid_1
\lo_unlink :newloid_2
-TRUNCATE lotest_stash_values;
+-- This object is left in the database for pg_dump test purposes
+SELECT lo_from_bytea(0, E'\\xdeadbeef') AS newloid
+\gset
+SET bytea_output TO hex;
+SELECT lo_get(:newloid);
+ lo_get
+------------
+ \xdeadbeef
+(1 row)
+
+DROP TABLE lotest_stash_values;
DROP ROLE regresslo;
(1 row)
END;
+-- Copy to another large object.
+-- Note: we intentionally don't remove the object created here;
+-- it's left behind to help test pg_dump.
+SELECT lo_from_bytea(0, lo_get(loid)) AS newloid FROM lotest_stash_values
+\gset
+-- Ideally we'd put a comment on this object for pg_dump testing purposes.
+-- But since pg_upgrade fails to preserve large object comments, doing so
+-- would break pg_upgrade's regression test.
+-- COMMENT ON LARGE OBJECT :newloid IS 'I Wandered Lonely as a Cloud';
-- Read out a portion
BEGIN;
UPDATE lotest_stash_values SET fd=lo_open(loid, CAST(x'20000' | x'40000' AS integer));
1
(1 row)
+TRUNCATE lotest_stash_values;
\lo_unlink :newloid
\lo_import 'results/lotest.txt'
\set newloid_1 :LASTOID
\lo_unlink :newloid_1
\lo_unlink :newloid_2
-TRUNCATE lotest_stash_values;
+-- This object is left in the database for pg_dump test purposes
+SELECT lo_from_bytea(0, E'\\xdeadbeef') AS newloid
+\gset
+SET bytea_output TO hex;
+SELECT lo_get(:newloid);
+ lo_get
+------------
+ \xdeadbeef
+(1 row)
+
+DROP TABLE lotest_stash_values;
DROP ROLE regresslo;