Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
2 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
-- S.1. bytea 60 МиБ проходит, 65 МиБ упирается в dbms_java.max_frame_mb.
SET statement_timeout = 0;
 
CALL dbms_java_dropjava('rjt.Stress');
CALL dbms_java_create_source('rjt.Stress', $src$
package rjt;
public class Stress {
    public static int blen(byte[] a) { return a == null ? -1 : a.length; }
}
$src$, current_schema()::varchar2, true);
 
CREATE OR REPLACE FUNCTION rjt_blen(a bytea) RETURNS int
    LANGUAGE java AS 'rjt.Stress.blen(byte[]) return int';
 
DO $$
DECLARE
    n int;
BEGIN
    n := rjt_blen(repeat(E'\\000', 62914560)::bytea);
    RAISE NOTICE 'Expected: 62914560';
    RAISE NOTICE 'Actual:   %', n;
END;
$$;
 
DO $$
DECLARE
    msg text;
BEGIN
    BEGIN
        PERFORM rjt_blen(repeat(E'\\000', 68157440)::bytea);
        msg := 'ok';
    EXCEPTION
        WHEN OTHERS THEN
            msg := SQLERRM;
    END;
    RAISE NOTICE 'Expected: dbms_java: кадр больше max_frame_mb (64)';
    RAISE NOTICE 'Actual:   %', msg;
END;
$$;
 
DROP FUNCTION rjt_blen(bytea);
CALL dbms_java_dropjava('rjt.Stress');