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

38.9. 内部関数 #

<title>Internal Functions</title>

Internal functions are functions written in C that have been statically linked into the <productname>PostgreSQL</productname> server. The <quote>body</quote> of the function definition specifies the C-language name of the function, which need not be the same as the name being declared for SQL use. (For reasons of backward compatibility, an empty body is accepted as meaning that the C-language function name is the same as the SQL name.) 内部関数とは、Cで作成された、PostgreSQLサーバに静的にリンクされた関数です。 関数定義の本体では関数のC言語における名前を指定します。 この名前をSQLでの使用のために宣言される名前と同じにする必要はありません。 (後方互換性のため、C言語関数名がSQL名と同じであるという意味として、空の本体も受け付けられます。)

Normally, all internal functions present in the server are declared during the initialization of the database cluster (see <xref linkend="creating-cluster"/>), but a user could use <command>CREATE FUNCTION</command> to create additional alias names for an internal function. Internal functions are declared in <command>CREATE FUNCTION</command> with language name <literal>internal</literal>. For instance, to create an alias for the <function>sqrt</function> function: 通常、サーバに存在するすべての内部関数は、データベースクラスタの初期化(19.2参照)の際に宣言されますが、ユーザはCREATE FUNCTIONを使用して、内部関数の別名をさらに作成できます。 内部関数はinternalという言語名を付けたCREATE FUNCTIONによって宣言されます。 例えば、sqrt関数の別名を作成するには以下のようにします。

CREATE FUNCTION square_root(double precision) RETURNS double precision
    AS 'dsqrt'
    LANGUAGE internal
    STRICT;

(Most internal functions expect to be declared <quote>strict</quote>.) (ほとんどの内部関数はstrictとして宣言されることを想定しています。)

注記

Not all <quote>predefined</quote> functions are <quote>internal</quote> in the above sense. Some predefined functions are written in SQL. 定義済みの関数のすべてが上の意味での内部ではありません。 SQLで作成された定義済み関数もあります。