1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-24 09:27:52 +03:00

Add large object functions catering to SQL callers.

With these, one need no longer manipulate large object descriptors and
extract numeric constants from header files in order to read and write
large object contents from SQL.

Pavel Stehule, reviewed by Rushabh Lathia.
This commit is contained in:
Noah Misch
2013-10-27 22:42:46 -04:00
parent 9c339eb4f8
commit c50b7c09d8
9 changed files with 362 additions and 7 deletions

View File

@@ -203,5 +203,26 @@ SELECT pageno, data FROM pg_largeobject WHERE loid = :newloid;
SELECT lo_unlink(loid) FROM lotest_stash_values;
\lo_unlink :newloid
\lo_import 'results/lotest.txt'
\set newloid_1 :LASTOID
SELECT lo_create(0, lo_get(:newloid_1)) AS newloid_2
\gset
SELECT md5(lo_get(:newloid_1)) = md5(lo_get(:newloid_2));
SELECT lo_get(:newloid_1, 0, 20);
SELECT lo_get(:newloid_1, 10, 20);
SELECT lo_put(:newloid_1, 5, decode('afafafaf', 'hex'));
SELECT lo_get(:newloid_1, 0, 20);
SELECT lo_put(:newloid_1, 4294967310, 'foo');
SELECT lo_get(:newloid_1);
SELECT lo_get(:newloid_1, 4294967294, 100);
\lo_unlink :newloid_1
\lo_unlink :newloid_2
TRUNCATE lotest_stash_values;
DROP ROLE regresslo;