PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/htup_details.h"
#include "catalog/pg_type.h"
#include "funcapi.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h"
#include "plpy_elog.h"
#include "plpy_main.h"
#include "plpy_typeio.h"
#include "plpython.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
Go to the source code of this file.
PyObject* PLy_input_convert | ( | PLyDatumToOb * | arg, |
Datum | val | ||
) |
Definition at line 81 of file plpy_typeio.c.
References arg, MemoryContextReset(), MemoryContextSwitchTo(), PLy_current_execution_context(), PLy_get_scratch_context(), and val.
Referenced by PLy_function_build_args().
PyObject* PLy_input_from_tuple | ( | PLyDatumToOb * | arg, |
HeapTuple | tuple, | ||
TupleDesc | desc, | ||
bool | include_generated | ||
) |
Definition at line 134 of file plpy_typeio.c.
References arg, MemoryContextReset(), MemoryContextSwitchTo(), PLy_current_execution_context(), PLy_get_scratch_context(), and PLyDict_FromTuple().
Referenced by PLy_cursor_fetch(), PLy_cursor_iternext(), PLy_spi_execute_fetch_result(), and PLy_trigger_build_args().
void PLy_input_setup_func | ( | PLyDatumToOb * | arg, |
MemoryContext | arg_mcxt, | ||
Oid | typeOid, | ||
int32 | typmod, | ||
PLyProcedure * | proc | ||
) |
Definition at line 418 of file plpy_typeio.c.
References arg, check_stack_depth(), TypeCacheEntry::domainBaseType, TypeCacheEntry::domainBaseTypmod, fmgr_info_cxt(), get_transform_fromsql(), getTypeOutputInfo(), INVALID_TUPLEDESC_IDENTIFIER, PLyProcedure::langid, lookup_type_cache(), MemoryContextAllocZero(), PLyBool_FromBool(), PLyBytes_FromBytea(), PLyDecimal_FromNumeric(), PLyDict_FromComposite(), PLyFloat_FromFloat4(), PLyFloat_FromFloat8(), PLyList_FromArray(), PLyLong_FromInt16(), PLyLong_FromInt32(), PLyLong_FromInt64(), PLyLong_FromOid(), PLyObject_FromTransform(), PLyUnicode_FromScalar(), PLyProcedure::trftypes, TypeCacheEntry::typalign, TypeCacheEntry::typbyval, TYPECACHE_DOMAIN_BASE_INFO, TypeCacheEntry::typelem, TypeCacheEntry::typlen, and TypeCacheEntry::typtype.
Referenced by PLy_cursor_plan(), PLy_cursor_query(), PLy_exec_trigger(), PLy_input_setup_tuple(), PLy_procedure_create(), and PLy_spi_execute_fetch_result().
void PLy_input_setup_tuple | ( | PLyDatumToOb * | arg, |
TupleDesc | desc, | ||
PLyProcedure * | proc | ||
) |
Definition at line 165 of file plpy_typeio.c.
References arg, Assert, i, MemoryContextAllocZero(), TupleDescData::natts, pfree(), PLy_input_setup_func(), PLyDict_FromComposite(), TupleDescAttr, PLyDatumToOb::typmod, and PLyDatumToOb::typoid.
Referenced by PLy_cursor_fetch(), PLy_cursor_iternext(), PLy_exec_trigger(), PLy_spi_execute_fetch_result(), and PLyDict_FromComposite().
Datum PLy_output_convert | ( | PLyObToDatum * | arg, |
PyObject * | val, | ||
bool * | isnull | ||
) |
Definition at line 120 of file plpy_typeio.c.
Referenced by PLy_cursor_plan(), PLy_exec_function(), PLy_modify_tuple(), and PLy_spi_execute_plan().
void PLy_output_setup_func | ( | PLyObToDatum * | arg, |
MemoryContext | arg_mcxt, | ||
Oid | typeOid, | ||
int32 | typmod, | ||
PLyProcedure * | proc | ||
) |
Definition at line 296 of file plpy_typeio.c.
References arg, check_stack_depth(), TypeCacheEntry::domainBaseType, TypeCacheEntry::domainBaseTypmod, fmgr_info_cxt(), get_transform_tosql(), getBaseType(), getTypeInputInfo(), INVALID_TUPLEDESC_IDENTIFIER, InvalidOid, PLyProcedure::langid, lookup_type_cache(), MemoryContextAllocZero(), PLyObject_ToBool(), PLyObject_ToBytea(), PLyObject_ToComposite(), PLyObject_ToDomain(), PLyObject_ToScalar(), PLyObject_ToTransform(), PLySequence_ToArray(), PLyProcedure::trftypes, TypeCacheEntry::typalign, TypeCacheEntry::typbyval, TYPECACHE_DOMAIN_BASE_INFO, TypeCacheEntry::typelem, TypeCacheEntry::typlen, and TypeCacheEntry::typtype.
Referenced by PLy_exec_trigger(), PLy_output_setup_tuple(), PLy_procedure_create(), and PLy_spi_prepare().
void PLy_output_setup_record | ( | PLyObToDatum * | arg, |
TupleDesc | desc, | ||
PLyProcedure * | proc | ||
) |
Definition at line 261 of file plpy_typeio.c.
References arg, Assert, BlessTupleDesc(), PLy_output_setup_tuple(), TupleDescData::tdtypeid, and TupleDescData::tdtypmod.
Referenced by PLy_exec_function().
void PLy_output_setup_tuple | ( | PLyObToDatum * | arg, |
TupleDesc | desc, | ||
PLyProcedure * | proc | ||
) |
Definition at line 215 of file plpy_typeio.c.
References arg, Assert, i, MemoryContextAllocZero(), TupleDescData::natts, pfree(), PLy_output_setup_func(), PLyObject_ToComposite(), TupleDescAttr, PLyObToDatum::typmod, and PLyObToDatum::typoid.
Referenced by PLy_exec_trigger(), PLy_output_setup_record(), and PLyObject_ToComposite().
|
static |
Definition at line 550 of file plpy_typeio.c.
References DatumGetBool().
Referenced by PLy_input_setup_func().
|
static |
Definition at line 628 of file plpy_typeio.c.
References DatumGetByteaPP, size, str, VARDATA_ANY, and VARSIZE_ANY_EXHDR.
Referenced by PLy_input_setup_func().
|
static |
Definition at line 570 of file plpy_typeio.c.
References DatumGetCString(), decimal_constructor, DirectFunctionCall1, ERROR, numeric_out(), PLy_elog, and str.
Referenced by PLy_input_setup_func().
|
static |
Definition at line 781 of file plpy_typeio.c.
References arg, DatumGetHeapTupleHeader, HeapTupleHeaderGetDatumLength, HeapTupleHeaderGetTypeId, HeapTupleHeaderGetTypMod, lookup_rowtype_tupdesc(), PLy_current_execution_context(), PLy_input_setup_tuple(), PLyDict_FromTuple(), ReleaseTupleDesc, HeapTupleData::t_data, and HeapTupleData::t_len.
Referenced by PLy_input_setup_func(), and PLy_input_setup_tuple().
|
static |
Definition at line 815 of file plpy_typeio.c.
References arg, Assert, PLyDatumToOb::func, heap_getattr(), i, sort-test::key, NameStr, TupleDescData::natts, PG_CATCH, PG_END_TRY, PG_RE_THROW, PG_TRY, TupleDescAttr, and value.
Referenced by PLy_input_from_tuple(), and PLyDict_FromComposite().
|
static |
Definition at line 558 of file plpy_typeio.c.
References DatumGetFloat4().
Referenced by PLy_input_setup_func().
|
static |
Definition at line 564 of file plpy_typeio.c.
References DatumGetFloat8().
Referenced by PLy_input_setup_func().
|
static |
Definition at line 1484 of file plpy_typeio.c.
References arg, ereport, errcode(), errhint(), errmsg(), ERROR, PLyObToDatum::func, heap_copy_tuple_as_datum(), heap_form_tuple(), heap_freetuple(), i, sort-test::key, NameStr, TupleDescData::natts, palloc(), pfree(), PG_CATCH, PG_END_TRY, PG_RE_THROW, PG_TRY, TupleDescAttr, value, and values.
Referenced by PLyObject_ToComposite().
|
static |
Definition at line 667 of file plpy_typeio.c.
References arg, ARR_DATA_PTR, ARR_DIMS, ARR_NDIM, ARR_NULLBITMAP, Assert, DatumGetArrayTypeP, MAXDIM, and PLyList_FromArray_recurse().
Referenced by PLy_input_setup_func().
|
static |
Definition at line 707 of file plpy_typeio.c.
References att_addlength_pointer, att_align_nominal, fetch_att(), PLyDatumToOb::func, i, sort-test::list, PLyDatumToOb::typalign, PLyDatumToOb::typbyval, and PLyDatumToOb::typlen.
Referenced by PLyList_FromArray().
|
static |
Definition at line 604 of file plpy_typeio.c.
References DatumGetInt16().
Referenced by PLy_input_setup_func().
|
static |
Definition at line 610 of file plpy_typeio.c.
References DatumGetInt32().
Referenced by PLy_input_setup_func().
|
static |
Definition at line 616 of file plpy_typeio.c.
References DatumGetInt64().
Referenced by PLy_input_setup_func().
|
static |
Definition at line 622 of file plpy_typeio.c.
References DatumGetObjectId().
Referenced by PLy_input_setup_func().
|
static |
Definition at line 1342 of file plpy_typeio.c.
References arg, Assert, ereport, errcode(), errhint(), errmsg(), ERROR, PLyObToDatum::func, heap_copy_tuple_as_datum(), heap_form_tuple(), heap_freetuple(), i, sort-test::key, NameStr, TupleDescData::natts, palloc(), pfree(), PG_CATCH, PG_END_TRY, PG_RE_THROW, PG_TRY, TupleDescAttr, value, and values.
Referenced by PLyObject_ToComposite().
char* PLyObject_AsString | ( | PyObject * | plrv | ) |
Definition at line 1024 of file plpy_typeio.c.
References elog, ereport, errcode(), errmsg(), ERROR, pg_verifymbstr(), PLy_elog, PLyUnicode_Bytes(), and pstrdup().
Referenced by PLyObject_ToScalar(), and PLyUnicode_ToComposite().
|
static |
Definition at line 655 of file plpy_typeio.c.
References arg, DatumGetPointer(), and FunctionCall1.
Referenced by PLy_input_setup_func().
|
static |
Definition at line 879 of file plpy_typeio.c.
References BoolGetDatum().
Referenced by PLy_output_setup_func().
|
static |
Definition at line 897 of file plpy_typeio.c.
References ERROR, len, palloc(), PG_END_TRY, PG_FINALLY, PG_TRY, PLy_elog, PointerGetDatum(), SET_VARSIZE, size, VARDATA, and VARHDRSZ.
Referenced by PLy_output_setup_func().
|
static |
Definition at line 941 of file plpy_typeio.c.
References arg, Assert, lookup_rowtype_tupdesc(), TupleDescData::natts, PinTupleDesc, PLy_current_execution_context(), PLy_output_setup_tuple(), PLyGenericObject_ToComposite(), PLyMapping_ToComposite(), PLySequence_ToComposite(), PLyUnicode_ToComposite(), and ReleaseTupleDesc.
Referenced by PLy_output_setup_func(), and PLy_output_setup_tuple().
|
static |
Definition at line 1099 of file plpy_typeio.c.
References arg, domain_check(), and PLyObToDatum::func.
Referenced by PLy_output_setup_func().
|
static |
Definition at line 1074 of file plpy_typeio.c.
References arg, InputFunctionCall(), PLyObject_AsString(), and str.
Referenced by PLy_output_setup_func().
|
static |
Definition at line 1116 of file plpy_typeio.c.
References arg, FunctionCall1, and PointerGetDatum().
Referenced by PLy_output_setup_func().
|
static |
Definition at line 1133 of file plpy_typeio.c.
References arg, construct_empty_array(), CurrentMemoryContext, ereport, errcode(), errmsg(), ERROR, i, makeMdArrayResult(), MAXDIM, PLySequence_ToArray_recurse(), and PointerGetDatum().
Referenced by PLy_output_setup_func().
|
static |
Definition at line 1193 of file plpy_typeio.c.
References accumArrayResult(), CurrentMemoryContext, ereport, errcode(), errmsg(), ERROR, PLyObToDatum::func, i, initArrayResult(), len, MAXDIM, PG_END_TRY, PG_FINALLY, PG_TRY, and PLy_elog.
Referenced by PLySequence_ToArray().
|
static |
Definition at line 1407 of file plpy_typeio.c.
References arg, Assert, ereport, errcode(), errmsg(), ERROR, PLyObToDatum::func, heap_copy_tuple_as_datum(), heap_form_tuple(), heap_freetuple(), i, idx(), TupleDescData::natts, palloc(), pfree(), PG_CATCH, PG_END_TRY, PG_RE_THROW, PG_TRY, TupleDescAttr, value, and values.
Referenced by PLyObject_ToComposite().
|
static |
Definition at line 642 of file plpy_typeio.c.
References arg, OutputFunctionCall(), pfree(), PLyUnicode_FromString(), and x.
Referenced by PLy_input_setup_func().
|
static |
Definition at line 1281 of file plpy_typeio.c.
References arg, ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, fmgr_info_cxt(), InputFunctionCall(), OidIsValid, PLyObject_AsString(), and str.
Referenced by PLyObject_ToComposite().