- バックアップ一覧
- 差分 を表示
- 現在との差分 を表示
- ソース を表示
- PostgreSQL/開発/include/fmgr.h へ行く。
- 1 (2017-06-01 (木) 21:50:28)
- 2 (2017-06-01 (木) 22:03:41)
- 3 (2017-06-03 (土) 13:40:28)
- 4 (2017-06-03 (土) 22:58:56)
- 5 (2017-06-04 (日) 14:59:59)
- 6 (2017-06-04 (日) 22:25:30)
- 7 (2017-06-04 (日) 23:27:37)
- 8 (2017-06-13 (火) 23:47:25)
- 9 (2017-06-16 (金) 22:37:42)
- 10 (2017-12-25 (月) 22:34:39)
- 11 (2018-01-28 (日) 09:43:58)
- 12 (2018-02-04 (日) 22:32:14)
ただいま作成中・・・
概要 †
- 関数マネージャと関数呼び出しインターフェースの定義ファイル
定義 †
変数,エイリアス †
マクロ †
列挙型 †
FmgrInfo †
番号 | データ型 | フィールド | 説明 |
---|---|---|---|
1 | PGFunction | fn_addr | 実行される関数のポインタ |
2 | Oid | fn_oid | 関数のOID |
3 | short | fn_nargs | 関数の引数の数 |
4 | bool | fn_strict | 関数がstrictモードが否か。 true:strictモード,false:strictモードでない |
5 | bool | fn_retset | setを返す関数か否か。 true:setを返す,false:setを返さない |
6 | unsigned char | fn_stats | 関数が統計情報を収集するか。この値より大きな値の場合に収集する。 参考 enum TrackFunctionsLevel - on doxygen.postgresql.org |
7 | void* | fn_extra | 関数で利用可能な領域 |
8 | MemoryContext | fn_mcxt | fn_extraを格納するためのメモリコンテキスト |
9 | fmNodePtr | fn_expr | パースツリーのノード表現 |
FunctionCallInfoData †
番号 | データ型 | フィールド | 説明 |
---|---|---|---|
1 | FmgrInfo* | flinfo | 関数情報を保持する構造体のポインタ |
2 | fmNodePtr | context | 関数呼び出しのコンテキスト。 例:TriggerData,AggState,WindowAggState |
3 | fmNodePtr | resultinfo | 実行結果に関する情報。 例:ReturnSetInfo |
4 | Oid | fncollation | collation |
5 | bool | isnull | 結果がNULLを返すか否か。 true:返す,false:返さない |
6 | short | nargs | 関数の引数の数 |
7 | Datum | arg[FUNC_MAX_ARGS] | 引数 |
8 | bool | argnull[FUNC_MAX_ARGS] | arg[i]がNULLであるか否か true:NULL,false:NULLでない |
関数呼び出しに関する情報を保持する構造体。
参考 FunctionCallInfoData - on doxygen.postgresql.org
サンプル
// 指定されたOIDの関数情報を取得する。 FmgrInfo *fmgr = palloc(sizeof(FmgrInfo)); fmgr_info((Oid)1396, fmgr); // abs(int64)の情報を構造体に格納する
関数 †
関数名 †
void test_invoke() { Datum result; FunctionCallInfoData fcinfo; FmgrInfo *fmgr = palloc(sizeof(FmgrInfo)); fmgr_info((Oid)1396, fmgr); // abs(int64); // Basic way int64 arg0 = -100; InitFunctionCallInfoData(fcinfo, fmgr, 1, 0, NULL, NULL); fcinfo.isnull = false; fcinfo.argnull[0] = false; fcinfo.arg[0] = Int64GetDatum(arg0); result = FunctionCallInvoke(&fcinfo); elog(INFO, "abs(-100) = %ld", DatumGetInt64(result)); } /* Output is the following: ------------------------------ INFO: abs(-100) = 100 */
- 説明
サンプルプログラム †
#ifdef PG_MODULE_MAGIC PG_MODULE_MAGIC; #endif PG_FUNCTION_INFO_V1(test_fdw_handler); /* これは以下のように展開される extern Datum test_fdw_handler(FunctionCallInfo fcinfo); extern const Pg_finfo_record * pg_finfo_test_fdw_handler(void); const Pg_finfo_record * pg_finfo_test_fdw_handler(void) { static const Pg_finfo_record my_finfo = { 1 }; return &my_finfo; } extern int no_such_variable; /*
参考・関連 †
- fmgr.h - on doxygen.postgresql.org
- fmgr.c - on doxygen.postgresql.org
- fmgrtab.h - on doxygen.postgresql.org
- CREATE FUNCTION - PostgreSQL 9.5文書
- 49.37. pg_proc - PostgreSQL 9.5文書
関連