-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sql
91 lines (73 loc) · 3.03 KB
/
install.sql
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
CREATE SCHEMA sqlj;
GRANT USAGE ON SCHEMA sqlj TO public;
CREATE FUNCTION sqlj.java_call_handler()
RETURNS language_handler AS 'pljava'
LANGUAGE C;
CREATE TRUSTED LANGUAGE java HANDLER sqlj.java_call_handler;
CREATE FUNCTION sqlj.javau_call_handler()
RETURNS language_handler AS 'pljava'
LANGUAGE C;
CREATE LANGUAGE javaU HANDLER sqlj.javau_call_handler;
CREATE TABLE sqlj.jar_repository(
jarId SERIAL PRIMARY KEY,
jarName VARCHAR(100) UNIQUE NOT NULL,
jarOrigin VARCHAR(500) NOT NULL,
jarOwner NAME NOT NULL,
jarManifest TEXT
);
GRANT SELECT ON sqlj.jar_repository TO public;
CREATE TABLE sqlj.jar_entry(
entryId SERIAL PRIMARY KEY,
entryName VARCHAR(200) NOT NULL,
jarId INT NOT NULL REFERENCES sqlj.jar_repository ON DELETE CASCADE,
entryImage BYTEA NOT NULL,
UNIQUE(jarId, entryName)
);
GRANT SELECT ON sqlj.jar_entry TO public;
CREATE TABLE sqlj.jar_descriptor(
jarId INT REFERENCES sqlj.jar_repository ON DELETE CASCADE,
ordinal INT2,
PRIMARY KEY (jarId, ordinal),
entryId INT NOT NULL REFERENCES sqlj.jar_entry ON DELETE CASCADE
);
GRANT SELECT ON sqlj.jar_descriptor TO public;
CREATE TABLE sqlj.classpath_entry(
schemaName VARCHAR(30) NOT NULL,
ordinal INT2 NOT NULL,
jarId INT NOT NULL REFERENCES sqlj.jar_repository ON DELETE CASCADE,
PRIMARY KEY(schemaName, ordinal)
);
GRANT SELECT ON sqlj.classpath_entry TO public;
CREATE TABLE sqlj.typemap_entry(
mapId SERIAL PRIMARY KEY,
javaName VARCHAR(200) NOT NULL,
sqlName NAME NOT NULL
);
GRANT SELECT ON sqlj.typemap_entry TO public;
CREATE FUNCTION sqlj.install_jar(VARCHAR, VARCHAR, BOOLEAN) RETURNS void
AS 'org.postgresql.pljava.management.Commands.installJar'
LANGUAGE java SECURITY DEFINER;
CREATE FUNCTION sqlj.install_jar(BYTEA, VARCHAR, BOOLEAN) RETURNS void
AS 'org.postgresql.pljava.management.Commands.installJar'
LANGUAGE java SECURITY DEFINER;
CREATE FUNCTION sqlj.replace_jar(VARCHAR, VARCHAR, BOOLEAN) RETURNS void
AS 'org.postgresql.pljava.management.Commands.replaceJar'
LANGUAGE java SECURITY DEFINER;
CREATE FUNCTION sqlj.replace_jar(BYTEA, VARCHAR, BOOLEAN) RETURNS void
AS 'org.postgresql.pljava.management.Commands.replaceJar'
LANGUAGE java SECURITY DEFINER;
CREATE FUNCTION sqlj.remove_jar(VARCHAR, BOOLEAN) RETURNS void
AS 'org.postgresql.pljava.management.Commands.removeJar'
LANGUAGE java SECURITY DEFINER;
CREATE FUNCTION sqlj.set_classpath(VARCHAR, VARCHAR) RETURNS void
AS 'org.postgresql.pljava.management.Commands.setClassPath'
LANGUAGE java SECURITY DEFINER;
CREATE FUNCTION sqlj.get_classpath(VARCHAR) RETURNS VARCHAR
AS 'org.postgresql.pljava.management.Commands.getClassPath'
LANGUAGE java STABLE SECURITY DEFINER;
CREATE FUNCTION sqlj.add_type_mapping(VARCHAR, VARCHAR) RETURNS void
AS 'org.postgresql.pljava.management.Commands.addTypeMapping'
LANGUAGE java SECURITY DEFINER;
CREATE FUNCTION sqlj.drop_type_mapping(VARCHAR) RETURNS void
AS 'org.postgresql.pljava.management.Commands.dropTypeMapping'
LANGUAGE java SECURITY DEFINER;