@@ -11,11 +11,11 @@ INSERT INTO lotest_stash_values (loid) SELECT lo_creat(42);
11
11
BEGIN;
12
12
-- lo_open(lobjId oid, mode integer) returns integer
13
13
-- The mode parameter to lo_open uses two constants:
14
- -- INV_READ = 0x20000 = 2 * 16^4
15
- -- INV_WRITE = 0x40000 = 4 * 16^4
14
+ -- INV_READ = 0x20000
15
+ -- INV_WRITE = 0x40000
16
16
-- The return value is a file descriptor-like value which remains valid for the
17
17
-- transaction.
18
- UPDATE lotest_stash_values SET fd = lo_open(loid, CAST((2 | 4) * 16^4 AS integer));
18
+ UPDATE lotest_stash_values SET fd = lo_open(loid, CAST(x'20000' | x'40000' AS integer));
19
19
-- loread/lowrite names are wonky, different from other functions which are lo_*
20
20
-- lowrite(fd integer, data bytea) returns integer
21
21
-- the integer is the number of bytes written
@@ -58,7 +58,7 @@ SELECT lo_close(fd) FROM lotest_stash_values;
58
58
END;
59
59
-- Read out a portion
60
60
BEGIN;
61
- UPDATE lotest_stash_values SET fd=lo_open(loid, CAST((2 | 4) * 16^4 AS integer));
61
+ UPDATE lotest_stash_values SET fd=lo_open(loid, CAST(x'20000' | x'40000' AS integer));
62
62
-- lo_lseek(fd integer, offset integer, whence integer) returns integer
63
63
-- offset is in bytes, whence is one of three values:
64
64
-- SEEK_SET (= 0) meaning relative to beginning
@@ -191,7 +191,7 @@ SELECT lo_unlink(loid) from lotest_stash_values;
191
191
TRUNCATE lotest_stash_values;
192
192
INSERT INTO lotest_stash_values (loid) SELECT lo_import('@abs_srcdir@/data/tenk.data');
193
193
BEGIN;
194
- UPDATE lotest_stash_values SET fd=lo_open(loid, CAST((2 | 4) * 16^4 AS integer));
194
+ UPDATE lotest_stash_values SET fd=lo_open(loid, CAST(x'20000' | x'40000' AS integer));
195
195
-- with the default BLKSZ, LOBLKSZ = 2048, so this positions us for a block
196
196
-- edge case
197
197
SELECT lo_lseek(fd, 2030, 0) FROM lotest_stash_values;
0 commit comments