6#include "utils/fmgrprotos.h"
11 .
name =
"jsonb_plpython",
32typedef PyObject *(*PLyUnicode_FromStringAndSize_t)
58#define PLyObject_AsString (PLyObject_AsString_p)
59#define PLyUnicode_FromStringAndSize (PLyUnicode_FromStringAndSize_p)
61#define PLy_elog (PLy_elog_impl_p)
150 if (v.
val.array.rawScalar)
157 elog(
ERROR,
"unexpected jsonb token: %d", r);
218 elog(
ERROR,
"unexpected jsonb token: %d", r);
252 elog(
ERROR,
"unexpected jsonb token: %d", r);
290 jbvKey.val.string.len = 0;
291 jbvKey.val.string.val =
"";
376 errmsg(
"could not convert value \"%s\" to jsonb",
str)));
389 errmsg(
"cannot convert NaN to jsonb")));
393 errmsg(
"cannot convert infinity to jsonb")));
396 jbvNum->val.numeric = num;
446 errmsg(
"Python type \"%s\" cannot be transformed to jsonb",
513 PLy_elog(
ERROR,
"transformation from jsonb to Python failed");
Datum numeric_out(PG_FUNCTION_ARGS)
Datum numeric_in(PG_FUNCTION_ARGS)
bool numeric_is_nan(Numeric num)
bool numeric_is_inf(Numeric num)
#define AssertVariableIsOfType(varname, typename)
#define Assert(condition)
void * load_external_function(const char *filename, const char *funcname, bool signalNotFound, void **filehandle)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define palloc_object(type)
#define PG_GETARG_POINTER(n)
#define PG_MODULE_MAGIC_EXT(...)
#define DirectFunctionCall1(func, arg1)
#define PG_FUNCTION_INFO_V1(funcname)
#define DirectFunctionCall3(func, arg1, arg2, arg3)
#define PG_RETURN_POINTER(x)
#define PG_GETARG_JSONB_P(x)
static void PLyMapping_ToJsonbValue(PyObject *obj, JsonbInState *jsonb_state)
#define PLyUnicode_FromStringAndSize
static void PLyObject_ToJsonbValue(PyObject *obj, JsonbInState *jsonb_state, bool is_elem)
static PLy_elog_impl_t PLy_elog_impl_p
static JsonbValue * PLyNumber_ToJsonbValue(PyObject *obj, JsonbValue *jbvNum)
PyObject *(* PLyUnicode_FromStringAndSize_t)(const char *s, Py_ssize_t size)
Datum plpython_to_jsonb(PG_FUNCTION_ARGS)
void(* PLy_elog_impl_t)(int elevel, const char *fmt,...)
static PyObject * PLyObject_FromJsonbValue(JsonbValue *jsonbValue)
static PLyObject_AsString_t PLyObject_AsString_p
static void PLySequence_ToJsonbValue(PyObject *obj, JsonbInState *jsonb_state)
char *(* PLyObject_AsString_t)(PyObject *plrv)
static PyObject * decimal_constructor
Datum jsonb_to_plpython(PG_FUNCTION_ARGS)
static PLyUnicode_FromStringAndSize_t PLyUnicode_FromStringAndSize_p
static void PLyUnicode_ToJsonbValue(PyObject *obj, JsonbValue *jbvElem)
static PyObject * PLyObject_FromJsonbContainer(JsonbContainer *jsonb)
#define PLyObject_AsString
static PyObject * PLyUnicode_FromJsonbValue(JsonbValue *jbv)
void pushJsonbValue(JsonbInState *pstate, JsonbIteratorToken seq, JsonbValue *jbval)
JsonbIterator * JsonbIteratorInit(JsonbContainer *container)
JsonbIteratorToken JsonbIteratorNext(JsonbIterator **it, JsonbValue *val, bool skipNested)
Jsonb * JsonbValueToJsonb(JsonbValue *val)
void pfree(void *pointer)
static Numeric DatumGetNumeric(Datum X)
static Datum NumericGetDatum(Numeric X)
void PLy_elog_impl(int elevel, const char *fmt,...)
static Datum PointerGetDatum(const void *X)
static Datum ObjectIdGetDatum(Oid X)
static char * DatumGetCString(Datum X)
static Datum CStringGetDatum(const char *X)
static Datum Int32GetDatum(int32 X)