We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ce81cb5 commit eceec7bCopy full SHA for eceec7b
src/backend/utils/adt/json.c
@@ -47,6 +47,32 @@ json_in(PG_FUNCTION_ARGS)
47
PG_RETURN_TEXT_P(result);
48
}
49
50
+/*
51
+ * Output.
52
+ */
53
+Datum
54
+json_out(PG_FUNCTION_ARGS)
55
+{
56
+ /* we needn't detoast because text_to_cstring will handle that */
57
+ Datum txt = PG_GETARG_DATUM(0);
58
+
59
+ PG_RETURN_CSTRING(TextDatumGetCString(txt));
60
+}
61
62
63
+ * Binary send.
64
65
66
+json_send(PG_FUNCTION_ARGS)
67
68
+ text *t = PG_GETARG_TEXT_PP(0);
69
+ StringInfoData buf;
70
71
+ pq_begintypsend(&buf);
72
+ pq_sendtext(&buf, VARDATA_ANY(t), VARSIZE_ANY_EXHDR(t));
73
+ PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
74
75
76
/*
77
* Binary receive.
78
*/
0 commit comments