-
Notifications
You must be signed in to change notification settings - Fork 1
/
pg_msgpack--0.0.1.sql
45 lines (38 loc) · 1.15 KB
/
pg_msgpack--0.0.1.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
CREATE FUNCTION msgpack_in(cstring) RETURNS msgpack AS
'MODULE_PATHNAME'
LANGUAGE c IMMUTABLE STRICT;
CREATE FUNCTION msgpack_out(msgpack) RETURNS cstring AS
'MODULE_PATHNAME'
LANGUAGE c IMMUTABLE STRICT;
CREATE FUNCTION msgpack_recv(internal) RETURNS msgpack AS
'MODULE_PATHNAME'
LANGUAGE c IMMUTABLE STRICT;
CREATE FUNCTION msgpack_send(msgpack) RETURNS bytea AS
'MODULE_PATHNAME'
LANGUAGE c IMMUTABLE STRICT;
CREATE TYPE msgpack (
INPUT = msgpack_in,
OUTPUT = msgpack_out,
RECEIVE = msgpack_recv,
SEND = msgpack_send
);
CREATE CAST (msgpack AS json) WITH INOUT;
CREATE CAST (json AS msgpack) WITH INOUT;
CREATE CAST (msgpack AS bytea) WITHOUT FUNCTION AS ASSIGNMENT;
CREATE CAST (bytea AS msgpack) WITHOUT FUNCTION AS ASSIGNMENT;
CREATE FUNCTION msgpack_object_field(msgpack, text) RETURNS msgpack AS
'MODULE_PATHNAME'
LANGUAGE c IMMUTABLE STRICT;
CREATE OPERATOR -> (
LEFTARG = msgpack,
RIGHTARG = text,
PROCEDURE = msgpack_object_field
);
CREATE FUNCTION msgpack_array_element(msgpack, integer) RETURNS msgpack AS
'MODULE_PATHNAME'
LANGUAGE c IMMUTABLE STRICT;
CREATE OPERATOR -> (
LEFTARG = msgpack,
RIGHTARG = integer,
PROCEDURE = msgpack_array_element
);