バージョンごとのドキュメント一覧

42.12. Tclプロシージャ名 #

<title>Tcl Procedure Names</title>

In <productname>PostgreSQL</productname>, the same function name can be used for different function definitions if the functions are placed in different schemas, or if the number of arguments or their types differ. Tcl, however, requires all procedure names to be distinct. PL/Tcl deals with this by including the argument type names in the internal Tcl procedure name, and then appending the function's object ID (OID) to the internal Tcl procedure name if necessary to make it different from the names of all previously-loaded functions in the same Tcl interpreter. Thus, <productname>PostgreSQL</productname> functions with the same name and different argument types will be different Tcl procedures, too. This is not normally a concern for a PL/Tcl programmer, but it might be visible when debugging. PostgreSQLでは、関数が異なるスキーマにある場合や、引数の数または引数の型が異なる場合に、同じ関数名を異なる関数定義に使用できます。 しかし、Tclではプロシージャ名の重複は許されません。 PL/Tclでは、引数の型名を内部Tclプロシージャ名に含め、必要に応じて関数のオブジェクトID(OID)を内部Tclプロシージャ名に追加することで、これに対応しています。これにより、同じTclインタプリタに以前にロードされたすべての関数とは異なる名前になります。 したがって、異なる引数の型を持つ同じ名前のPostgreSQL関数も、異なるTclプロシージャになります。 PL/Tclプログラマにとって、普段は問題にはなりませんが、デバッグの際に表面に現れます。

For this reason among others, a PL/Tcl function cannot call another one directly (that is, within Tcl). If you need to do that, you must go through SQL, using <function>spi_exec</function> or a related command. この理由などにより、PL/Tclの関数は、他の関数を直接(つまり、Tclの内部で)呼び出すことはできません。 その必要がある場合、spi_execまたは関連するコマンドを使用して、SQLを経由することが必要です。