You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
469 B
19 lines
469 B
#include <postgres.h>
|
|
#include <string.h>
|
|
#include <fmgr.h>
|
|
#include <executor/executor.h>
|
|
|
|
PG_FUNCTION_INFO_V1(get_int4_record_val);
|
|
|
|
Datum get_int4_record_val(PG_FUNCTION_ARGS) {
|
|
TupleTableSlot* t=(TupleTableSlot*)PG_GETARG_POINTER(0);
|
|
text* valName=(text*)PG_GETARG_POINTER(1);
|
|
int32 val;
|
|
bool isnull;
|
|
|
|
val=DatumGetInt32(GetAttributeByName(t, VARDATA(valName), &isnull));
|
|
if(isnull)
|
|
PG_RETURN_NULL();
|
|
|
|
PG_RETURN_INT32(val);
|
|
}
|